diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-12-16 23:07:33 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-12-16 23:07:33 +0100 |
commit | 2b78673aa9717871e993212949287fdd8d0bb033 (patch) | |
tree | cf5ffdc86b646620c2095d6f6f525beda7eb3a25 | |
parent | core: remove unneeded arguments for AM_INIT_AUTOMAKE in configure.in (diff) | |
download | weechat-2b78673aa9717871e993212949287fdd8d0bb033.tar.xz weechat-2b78673aa9717871e993212949287fdd8d0bb033.zip |
core: add git version in build, display it in "weechat-curses --help" and /version
38 files changed, 425 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore index be9f7b128..1b62f8d7b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,9 @@ ABOUT-NLS autom4te* build*/* config.guess -config.h* +config.h +config.h.in* +config-git.h config.log config.rpath config.status diff --git a/CMakeLists.txt b/CMakeLists.txt index 50672896c..0deccfa18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,11 @@ ADD_SUBDIRECTORY( doc ) CONFIGURE_FILE(config.h.cmake config.h @ONLY) +# set the git version in "config-git.h" +ADD_CUSTOM_TARGET(version_git ALL + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/git-version.sh" "${CMAKE_CURRENT_SOURCE_DIR}" "${VERSION}" "config-git.h" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.4.0-dev, 2012-12-08 +v0.4.0-dev, 2012-12-16 Version 0.4.0 (under dev!) -------------------------- +* core: add git version in build, display it in "weechat-curses --help" and + /version * core: fix scroll of one page down when weechat.look.scroll_page_percent is less than 100 (bug #37875) * core: disable paste detection and confirmation if bar item "input_paste" is diff --git a/Makefile.am b/Makefile.am index 799d3468e..dcc240416 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,12 @@ # along with WeeChat. If not, see <http://www.gnu.org/licenses/>. # +# This target will update file config-git.h with output of command "git describe" +# (if needed, and only for a devel/rc version). +BUILT_SOURCES = build-config-git.h +build-config-git.h: + -$(abs_top_srcdir)/git-version.sh "$(abs_top_srcdir)" "$(VERSION)" config-git.h + if DOC doc_dir = doc endif @@ -28,6 +34,8 @@ SUBDIRS = po $(doc_dir) intl src EXTRA_DIST = CMakeLists.txt \ config.rpath \ config.h.cmake \ + git-version.sh \ + makedist.sh \ cmake/CMakeParseArguments.cmake \ cmake/FindAsciidoc.cmake \ cmake/FindAspell.cmake \ @@ -47,7 +55,6 @@ EXTRA_DIST = CMakeLists.txt \ cmake/FindTCL.cmake \ cmake/FindZLIB.cmake \ cmake/cmake_uninstall.cmake.in \ - cmake/makedist.sh.in \ po/CMakeLists.txt \ po/srcfiles.cmake \ weechat.spec \ diff --git a/doc/de/autogen/plugin_api/infos.txt b/doc/de/autogen/plugin_api/infos.txt index 3916acfe7..5c17dba35 100644 --- a/doc/de/autogen/plugin_api/infos.txt +++ b/doc/de/autogen/plugin_api/infos.txt @@ -42,6 +42,8 @@ | weechat | version | WeeChat Version | - +| weechat | version_git | WeeChat git version (output of command "git describe" for a development version only, empty for a stable release) | - + | weechat | version_number | WeeChat Version (als Nummer) | - | weechat | weechat_dir | WeeChat Verzeichnis | - diff --git a/doc/en/autogen/plugin_api/infos.txt b/doc/en/autogen/plugin_api/infos.txt index 341172eab..9c28269fa 100644 --- a/doc/en/autogen/plugin_api/infos.txt +++ b/doc/en/autogen/plugin_api/infos.txt @@ -42,6 +42,8 @@ | weechat | version | WeeChat version | - +| weechat | version_git | WeeChat git version (output of command "git describe" for a development version only, empty for a stable release) | - + | weechat | version_number | WeeChat version (as number) | - | weechat | weechat_dir | WeeChat directory | - diff --git a/doc/en/weechat_dev.en.txt b/doc/en/weechat_dev.en.txt index 52305fab3..cd9c71b76 100644 --- a/doc/en/weechat_dev.en.txt +++ b/doc/en/weechat_dev.en.txt @@ -115,6 +115,7 @@ WeeChat "core" reside in following directories: | wee-url.c | URL transfer (using libcurl) | wee-utf8.c | UTF-8 functions | wee-util.c | Some other functions +| wee-version.c | Functions for WeeChat version | gui/ | Functions for buffers, windows, ... (used by all interfaces) | gui-bar-item.c | Bar items | gui-bar-window.c | Bar windows diff --git a/doc/fr/autogen/plugin_api/infos.txt b/doc/fr/autogen/plugin_api/infos.txt index ceb5a652b..52439b03c 100644 --- a/doc/fr/autogen/plugin_api/infos.txt +++ b/doc/fr/autogen/plugin_api/infos.txt @@ -42,6 +42,8 @@ | weechat | version | version de WeeChat | - +| weechat | version_git | version git de WeeChat (sortie de la commande "git describe" pour une version de développement seulement, vide pour une version stable) | - + | weechat | version_number | version de WeeChat (sous forme de nombre) | - | weechat | weechat_dir | répertoire de WeeChat | - diff --git a/doc/it/autogen/plugin_api/infos.txt b/doc/it/autogen/plugin_api/infos.txt index e77fcbbc0..7bb9670a6 100644 --- a/doc/it/autogen/plugin_api/infos.txt +++ b/doc/it/autogen/plugin_api/infos.txt @@ -42,6 +42,8 @@ | weechat | version | versione di WeeChat | - +| weechat | version_git | WeeChat git version (output of command "git describe" for a development version only, empty for a stable release) | - + | weechat | version_number | versione di WeeChat (come numero) | - | weechat | weechat_dir | directory WeeChat | - diff --git a/doc/ja/autogen/plugin_api/infos.txt b/doc/ja/autogen/plugin_api/infos.txt index ca8279940..70a269ee2 100644 --- a/doc/ja/autogen/plugin_api/infos.txt +++ b/doc/ja/autogen/plugin_api/infos.txt @@ -42,6 +42,8 @@ | weechat | version | WeeChat のバージョン | - +| weechat | version_git | WeeChat git version (output of command "git describe" for a development version only, empty for a stable release) | - + | weechat | version_number | WeeChat のバージョン (数字) | - | weechat | weechat_dir | WeeChat ディレクトリ | - diff --git a/git-version.sh b/git-version.sh new file mode 100755 index 000000000..c15b9446b --- /dev/null +++ b/git-version.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org> +# +# This file is part of WeeChat, the extensible chat client. +# +# WeeChat is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# WeeChat is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with WeeChat. If not, see <http://www.gnu.org/licenses/>. +# + +# +# Updates git version in config-git.h if the output of "git describe" has changed. +# +# Syntax: +# git-version.sh <rootdir> <version> <headerfile> +# +# rootdir : root directory with WeeChat files (to search .git/ directory) +# version : WeeChat version, for example 0.3.9 or 0.4.0-dev +# headerfile: file to update, for example config-git.h +# + +if [ $# -lt 3 ]; then + echo "Syntax: $0 <rootdir> <version> <headerfile>" + exit 1 +fi + +ROOTDIR=$1 +VERSION=$2 +HEADERFILE=$3 + +# debug: +#echo "pwd=$PWD, rootdir=$ROOTDIR, version=$VERSION, headerfile=$HEADERFILE" + +# read git version if we are in a devel/rc version and if we are in a repository +GIT_VERSION="" +case ${VERSION} in +*-*) + # devel/rc version (like 0.4.0-dev or 0.4.0-rc1) + if [ -d "${ROOTDIR}/.git" ]; then + GIT_VERSION=$(cd ${ROOTDIR} && git describe 2>/dev/null) + fi + ;; +*) + # stable version => no git version + ;; +esac + +# check if git version has changed +if [ ! -f ${HEADERFILE} ]; then + # header does not exist => create it + echo "Creating file ${HEADERFILE} with git version: \"${GIT_VERSION}\"" + echo "#define PACKAGE_VERSION_GIT \"${GIT_VERSION}\"" >${HEADERFILE} +else + grep -q "#define PACKAGE_VERSION_GIT \"${GIT_VERSION}\"" ${HEADERFILE} + if [ $? -eq 0 ]; then + # git version matches the file => NO update + echo "File ${HEADERFILE} is up-to-date (git version: \"${GIT_VERSION}\")" + else + # git version not found in file => update file with this git version + echo "Updating file ${HEADERFILE} with git version: \"${GIT_VERSION}\"" + sed "s/#define PACKAGE_VERSION_GIT \".*\"/#define PACKAGE_VERSION_GIT \"${GIT_VERSION}\"/" ${HEADERFILE} >${HEADERFILE}.tmp + mv -f ${HEADERFILE}.tmp ${HEADERFILE} + fi +fi diff --git a/po/POTFILES.in b/po/POTFILES.in index c17d1c59a..6367c85cf 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -40,6 +40,8 @@ ./src/core/wee-utf8.h ./src/core/wee-util.c ./src/core/wee-util.h +./src/core/wee-version.c +./src/core/wee-version.h ./src/gui/curses/gui-curses-bar-window.c ./src/gui/curses/gui-curses-chat.c ./src/gui/curses/gui-curses-color.c @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -31,9 +31,9 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, zkompilováno %s %s\n" @@ -7266,6 +7266,11 @@ msgstr "verze WeeChat" msgid "WeeChat version (as number)" msgstr "verze WeeChat (jako číslo)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "datum kompilace WeeChat" @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-11-04 15:41+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -39,9 +39,9 @@ msgstr "" "X-Poedit-SourceCharset: utf-8\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, kompiliert am %s %s\n" @@ -7939,6 +7939,11 @@ msgstr "WeeChat Version" msgid "WeeChat version (as number)" msgstr "WeeChat Version (als Nummer)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "Datum der WeeChat Kompilierung" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -33,9 +33,9 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, compilado en %s %s\n" @@ -7533,6 +7533,11 @@ msgstr "versión de WeeChat" msgid "WeeChat version (as number)" msgstr "versión de WeeChat (como un número)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "fecha de compilación de WeeChat" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" -"PO-Revision-Date: 2012-12-13 09:11+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" +"PO-Revision-Date: 2012-12-16 17:18+0100\n" "Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: French\n" @@ -34,10 +34,10 @@ msgstr "" #. TRANSLATORS: "%s %s" after "compiled on" is date and time #, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" -"WeeChat %s Copyright %s, compilé le %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compilé le %s %s\n" "Développé par Sebastien Helleu <flashcode@flashtux.org> - %s" #, c-format @@ -7721,6 +7721,13 @@ msgstr "version de WeeChat" msgid "WeeChat version (as number)" msgstr "version de WeeChat (sous forme de nombre)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" +"version git de WeeChat (sortie de la commande \"git describe\" pour une " +"version de développement seulement, vide pour une version stable)" + msgid "WeeChat compilation date" msgstr "date de compilation de WeeChat" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -33,7 +33,7 @@ msgstr "" #. TRANSLATORS: "%s %s" after "compiled on" is date and time #, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "%s Copyright (C) 2003-2010, fordítva: %s %s\n" @@ -6764,6 +6764,11 @@ msgstr "WeeChat szlogen" msgid "WeeChat version (as number)" msgstr "WeeChat szlogen" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + #, fuzzy msgid "WeeChat compilation date" msgstr "Konfigurációs fájl elmentve\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -31,9 +31,9 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, compilato il %s %s\n" @@ -7526,6 +7526,11 @@ msgstr "versione di WeeChat" msgid "WeeChat version (as number)" msgstr "versione di WeeChat (come numero)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "data di compilazione di WeeChat" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/WeeChat>\n" @@ -31,9 +31,9 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s 著作権 %s、%s %s にコンパイル\n" @@ -7359,6 +7359,11 @@ msgstr "WeeChat のバージョン" msgid "WeeChat version (as number)" msgstr "WeeChat のバージョン (数字)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "WeeChat のコンパイル日" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:42+0200\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -33,9 +33,9 @@ msgstr "" "|| n%100>=20) ? 1 : 2);\n" #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, skompilowano na %s %s\n" @@ -7481,6 +7481,11 @@ msgstr "wersja WeeChat" msgid "WeeChat version (as number)" msgstr "wersja WeeChat (jako liczba)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "data kompilacji WeeChat" diff --git a/po/pt_BR.po b/po/pt_BR.po index a40db4680..6787e6d26 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -55,9 +55,9 @@ msgstr "" # bind -> vincular # handshake -> handshake (don't translate it when related to cryptography) #. TRANSLATORS: "%s %s" after "compiled on" is date and time -#, c-format +#, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "WeeChat %s Copyright %s, compilado em %s %s\n" @@ -6944,6 +6944,11 @@ msgstr "versão do WeeChat" msgid "WeeChat version (as number)" msgstr "versão do WeeChat (como um número)" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "data de compilação do WeeChat" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: 2012-09-29 11:43+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -36,7 +36,7 @@ msgstr "" #. TRANSLATORS: "%s %s" after "compiled on" is date and time #, fuzzy, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" "%s Copyright (C) 2003-2010, собран %s %s\n" @@ -6788,6 +6788,11 @@ msgstr "слоган WeeChat" msgid "WeeChat version (as number)" msgstr "слоган WeeChat" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + #, fuzzy msgid "WeeChat compilation date" msgstr "Конфигурационный файл сохранён\n" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index fcbf7c67e..e1d101059 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -41,6 +41,8 @@ SET(WEECHAT_SOURCES ./src/core/wee-utf8.h ./src/core/wee-util.c ./src/core/wee-util.h +./src/core/wee-version.c +./src/core/wee-version.h ./src/gui/curses/gui-curses-bar-window.c ./src/gui/curses/gui-curses-chat.c ./src/gui/curses/gui-curses-color.c diff --git a/po/weechat.pot b/po/weechat.pot index 334104e90..dbfb43b62 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-12-13 18:51+0100\n" +"POT-Creation-Date: 2012-12-16 19:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -20,7 +20,7 @@ msgstr "" #. TRANSLATORS: "%s %s" after "compiled on" is date and time #, c-format msgid "" -"WeeChat %s Copyright %s, compiled on %s %s\n" +"WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> - %s" msgstr "" @@ -5952,6 +5952,11 @@ msgstr "" msgid "WeeChat version (as number)" msgstr "" +msgid "" +"WeeChat git version (output of command \"git describe\" for a development " +"version only, empty for a stable release)" +msgstr "" + msgid "WeeChat compilation date" msgstr "" diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 984c5be15..a61e2cf95 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -42,7 +42,8 @@ wee-upgrade.c wee-upgrade.h wee-upgrade-file.c wee-upgrade-file.h wee-url.c wee-url.h wee-utf8.c wee-utf8.h -wee-util.c wee-util.h) +wee-util.c wee-util.h +wee-version.c wee-version.h) # Check for flock support INCLUDE(CheckSymbolExists) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 6abf84b99..100f85cde 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -66,6 +66,8 @@ lib_weechat_core_a_SOURCES = weechat.c \ wee-utf8.c \ wee-utf8.h \ wee-util.c \ - wee-util.h + wee-util.h \ + wee-version.c \ + wee-version.h EXTRA_DIST = CMakeLists.txt diff --git a/src/core/wee-backtrace.c b/src/core/wee-backtrace.c index d5eea18fa..6a2318800 100644 --- a/src/core/wee-backtrace.c +++ b/src/core/wee-backtrace.c @@ -42,6 +42,7 @@ #include "wee-backtrace.h" #include "wee-log.h" #include "wee-string.h" +#include "wee-version.h" #include "../plugins/plugin.h" @@ -157,7 +158,9 @@ weechat_backtrace () weechat_backtrace_printf ("======= WeeChat backtrace ======="); weechat_backtrace_printf ("(written by %s, compiled on %s %s)", - PACKAGE_STRING, __DATE__, __TIME__); + version_get_name_version (), + version_get_compilation_date (), + version_get_compilation_time ()); #ifdef HAVE_BACKTRACE trace_size = backtrace (trace, BACKTRACE_MAX); diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 10ef4d126..601192561 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -49,6 +49,7 @@ #include "wee-upgrade.h" #include "wee-utf8.h" #include "wee-util.h" +#include "wee-version.h" #include "../gui/gui-bar.h" #include "../gui/gui-bar-item.h" #include "../gui/gui-buffer.h" @@ -4999,20 +5000,28 @@ COMMAND_CALLBACK(uptime) void command_version_display (struct t_gui_buffer *buffer, int send_to_buffer_as_input, - int translated_string) + int translated_string, + int display_git_version) { char string[512]; + const char *git_version; + + /* get git version */ + git_version = (display_git_version) ? version_get_git () : NULL; if (send_to_buffer_as_input) { if (translated_string) { snprintf (string, sizeof (string), - "WeeChat %s [%s %s %s]", - PACKAGE_VERSION, + "WeeChat %s%s%s%s [%s %s %s]", + version_get_version (), + (git_version && git_version[0]) ? " (git: " : "", + (git_version && git_version[0]) ? git_version : "", + (git_version && git_version[0]) ? ")" : "", _("compiled on"), - __DATE__, - __TIME__); + version_get_compilation_date (), + version_get_compilation_time ()); input_data (buffer, string); if (weechat_upgrade_count > 0) { @@ -5028,11 +5037,14 @@ command_version_display (struct t_gui_buffer *buffer, else { snprintf (string, sizeof (string), - "WeeChat %s [%s %s %s]", - PACKAGE_VERSION, + "WeeChat %s%s%s%s [%s %s %s]", + version_get_version (), + (git_version && git_version[0]) ? " (git: " : "", + (git_version && git_version[0]) ? git_version : "", + (git_version && git_version[0]) ? ")" : "", "compiled on", - __DATE__, - __TIME__); + version_get_compilation_date (), + version_get_compilation_time ()); input_data (buffer, string); if (weechat_upgrade_count > 0) { @@ -5048,14 +5060,17 @@ command_version_display (struct t_gui_buffer *buffer, } else { - gui_chat_printf (NULL, "%sWeeChat %s %s[%s%s %s %s%s]", + gui_chat_printf (NULL, "%sWeeChat %s%s%s%s %s[%s%s %s %s%s]", GUI_COLOR(GUI_COLOR_CHAT_BUFFER), - PACKAGE_VERSION, + version_get_version (), + (git_version && git_version[0]) ? " (git: " : "", + (git_version && git_version[0]) ? git_version : "", + (git_version && git_version[0]) ? ")" : "", GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_VALUE), _("compiled on"), - __DATE__, - __TIME__, + version_get_compilation_date (), + version_get_compilation_time (), GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS)); if (weechat_upgrade_count > 0) { @@ -5096,7 +5111,7 @@ COMMAND_CALLBACK(version) } command_version_display (buffer, send_to_buffer_as_input, - translated_string); + translated_string, 1); return WEECHAT_RC_OK; } diff --git a/src/core/wee-command.h b/src/core/wee-command.h index e0f277373..029ab5bf9 100644 --- a/src/core/wee-command.h +++ b/src/core/wee-command.h @@ -65,6 +65,7 @@ extern void command_init (); extern void command_startup (int plugins_loaded); extern void command_version_display (struct t_gui_buffer *buffer, int send_to_buffer_as_input, - int translated_string); + int translated_string, + int display_git_version); #endif /* __WEECHAT_COMMAND_H */ diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 8b86ece90..8acb613d0 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -39,6 +39,7 @@ #include "wee-infolist.h" #include "wee-log.h" #include "wee-string.h" +#include "wee-version.h" #include "../gui/gui-color.h" #include "../gui/gui-chat.h" #include "../plugins/plugin.h" @@ -2042,7 +2043,9 @@ config_file_write_internal (struct t_config_file *config_file, goto error; if (!string_iconv_fprintf (config_file->file, "# %s -- %s v%s\n#\n", - config_file->filename, PACKAGE_NAME, PACKAGE_VERSION)) + config_file->filename, + version_get_name (), + version_get_version ())) goto error; /* write all sections */ diff --git a/src/core/wee-config.c b/src/core/wee-config.c index f82abe419..ff735d6fa 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -45,6 +45,7 @@ #include "wee-list.h" #include "wee-proxy.h" #include "wee-string.h" +#include "wee-version.h" #include "../gui/gui-bar.h" #include "../gui/gui-buffer.h" #include "../gui/gui-chat.h" @@ -304,7 +305,7 @@ config_change_title (void *data, struct t_config_option *option) (void) option; if (CONFIG_BOOLEAN(config_look_set_title)) - gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION); + gui_window_set_title (version_get_name_version ()); } /* diff --git a/src/core/wee-log.c b/src/core/wee-log.c index ecfccee93..94d3470ba 100644 --- a/src/core/wee-log.c +++ b/src/core/wee-log.c @@ -41,6 +41,7 @@ #include "wee-log.h" #include "wee-debug.h" #include "wee-string.h" +#include "wee-version.h" #include "../plugins/plugin.h" @@ -118,7 +119,10 @@ log_init () exit (1); } log_printf ("%s (%s %s %s)", - PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__); + version_get_name_version (), + _("compiled on"), + version_get_compilation_date (), + version_get_compilation_time ()); } /* diff --git a/src/core/wee-version.c b/src/core/wee-version.c new file mode 100644 index 000000000..ba40fab13 --- /dev/null +++ b/src/core/wee-version.c @@ -0,0 +1,106 @@ +/* + * wee-version.c - functions for WeeChat version + * + * Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "config-git.h" + + +/* + * Returns package name ("weechat"). + */ + +const char * +version_get_name () +{ + return PACKAGE_NAME; +} + +/* + * Returns the WeeChat version. + * + * Examples: + * 0.3.9-dev + * 0.3.9-rc1 + * 0.3.9 + */ + +const char * +version_get_version () +{ + return PACKAGE_VERSION; +} + +/* + * Returns the package name ("weechat") + WeeChat version. + * + * Examples: + * weechat 0.3.9-dev + * weechat 0.3.9-rc1 + * weechat 0.3.9 + */ + +const char * +version_get_name_version () +{ + return PACKAGE_STRING; +} + +/* + * Returns the output of "git describe" (non-empty only for a devel version, + * if compilation was made* using the git repository, if git command was found). + * + * Example: + * v0.3.9-104-g7eb5cc + */ + +const char * +version_get_git () +{ + return PACKAGE_VERSION_GIT; +} + +/* + * Returns date of WeeChat compilation. + * + * Example: + * Dec 16 2012 + */ + +const char * +version_get_compilation_date () +{ + return __DATE__; +} + +/* + * Returns time of WeeChat compilation. + * + * Example: + * 18:10:22 + */ + +const char * +version_get_compilation_time () +{ + return __TIME__; +} diff --git a/src/core/wee-version.h b/src/core/wee-version.h new file mode 100644 index 000000000..e843992f2 --- /dev/null +++ b/src/core/wee-version.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __WEECHAT_VERSION_H +#define __WEECHAT_VERSION_H 1 + +extern const char *version_get_name (); +extern const char *version_get_version (); +extern const char *version_get_name_version (); +extern const char *version_get_git (); +extern const char *version_get_compilation_date (); +extern const char *version_get_compilation_time (); + +#endif /* __WEECHAT_VERSION_H */ diff --git a/src/core/weechat.c b/src/core/weechat.c index 96fb363ff..f0a9e575a 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -65,6 +65,7 @@ #include "wee-upgrade.h" #include "wee-utf8.h" #include "wee-util.h" +#include "wee-version.h" #include "../gui/gui-chat.h" #include "../gui/gui-color.h" #include "../gui/gui-completion.h" @@ -103,14 +104,23 @@ char *weechat_startup_commands = NULL; /* startup commands (-r flag) */ void weechat_display_copyright () { + const char *git_version; + + git_version = version_get_git (); string_iconv_fprintf (stdout, "\n"); string_iconv_fprintf (stdout, /* TRANSLATORS: "%s %s" after "compiled on" is date and time */ - _("WeeChat %s Copyright %s, compiled on %s %s\n" + _("WeeChat %s%s%s%s Copyright %s, compiled on %s %s\n" "Developed by Sebastien Helleu <flashcode@flashtux.org> " "- %s"), - PACKAGE_VERSION, WEECHAT_COPYRIGHT_DATE, - __DATE__, __TIME__, WEECHAT_WEBSITE); + version_get_version (), + (git_version && git_version[0]) ? " (git: " : "", + (git_version && git_version[0]) ? git_version : "", + (git_version && git_version[0]) ? ")" : "", + WEECHAT_COPYRIGHT_DATE, + version_get_compilation_date (), + version_get_compilation_time (), + WEECHAT_WEBSITE); string_iconv_fprintf (stdout, "\n"); } @@ -168,7 +178,7 @@ weechat_display_keys () _("%s default keys (context: \"%s\"):\n"), (gui_key_context_string[i] && gui_key_context_string[i][0]) ? _(gui_key_context_string[i]) : "", - PACKAGE_NAME); + version_get_name ()); string_iconv_fprintf (stdout, "\n"); for (ptr_key = gui_keys[i]; ptr_key; ptr_key = ptr_key->next_key) { @@ -299,7 +309,8 @@ weechat_parse_args (int argc, char *argv[]) else if ((strcmp (argv[i], "-v") == 0) || (strcmp (argv[i], "--version") == 0)) { - string_iconv_fprintf (stdout, PACKAGE_VERSION "\n"); + string_iconv_fprintf (stdout, version_get_version ()); + fprintf (stdout, "\n"); weechat_shutdown (EXIT_SUCCESS, 0); } } @@ -412,7 +423,7 @@ weechat_welcome_message () } if (CONFIG_BOOLEAN(config_startup_display_version)) { - command_version_display (NULL, 0, 0); + command_version_display (NULL, 0, 0, 0); } if (CONFIG_BOOLEAN(config_startup_display_logo) || CONFIG_BOOLEAN(config_startup_display_version)) diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 90683ee2f..3b32f7728 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -38,6 +38,7 @@ #include "../../core/wee-string.h" #include "../../core/wee-utf8.h" #include "../../core/wee-util.h" +#include "../../core/wee-version.h" #include "../../plugins/plugin.h" #include "../gui-main.h" #include "../gui-bar.h" @@ -90,6 +91,7 @@ gui_main_init () struct t_gui_buffer *ptr_buffer; struct t_gui_bar *ptr_bar; struct t_gui_bar_window *ptr_bar_win; + char title[256]; initscr (); @@ -138,9 +140,11 @@ gui_main_init () ptr_buffer->short_name = strdup (GUI_BUFFER_MAIN); /* set title for core buffer */ - gui_buffer_set_title (ptr_buffer, - "WeeChat " PACKAGE_VERSION " " - WEECHAT_COPYRIGHT_DATE " - " WEECHAT_WEBSITE); + snprintf (title, sizeof (title), "WeeChat %s %s - %s", + version_get_version (), + WEECHAT_COPYRIGHT_DATE, + WEECHAT_WEBSITE); + gui_buffer_set_title (ptr_buffer, title); /* create main window (using full space) */ if (gui_window_new (NULL, ptr_buffer, 0, 0, @@ -149,7 +153,7 @@ gui_main_init () gui_current_window = gui_windows; if (CONFIG_BOOLEAN(config_look_set_title)) - gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION); + gui_window_set_title (version_get_name_version ()); } /* diff --git a/src/gui/gtk/gui-gtk-main.c b/src/gui/gtk/gui-gtk-main.c index 72278156b..97db3fa94 100644 --- a/src/gui/gtk/gui-gtk-main.c +++ b/src/gui/gtk/gui-gtk-main.c @@ -32,6 +32,7 @@ #include "../../core/weechat.h" #include "../../core/wee-config.h" #include "../../core/wee-utf8.h" +#include "../../core/wee-version.h" #include "../../plugins/plugin.h" #include "../gui-bar.h" #include "../gui-bar-item.h" @@ -103,7 +104,8 @@ gui_main_init () gdk_color_parse ("black", &color_bg); gui_gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (gui_gtk_main_window), PACKAGE_STRING); + gtk_window_set_title (GTK_WINDOW (gui_gtk_main_window), + version_get_name_version ()); g_signal_connect (G_OBJECT (gui_gtk_main_window), "destroy", gtk_main_quit, NULL); @@ -190,7 +192,7 @@ gui_main_init () gui_current_window = gui_windows; if (CONFIG_BOOLEAN(config_look_set_title)) - gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION); + gui_window_set_title (version_get_name_version ()); } /* diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index e62f1fce4..f4953d59f 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -43,6 +43,7 @@ #include "../core/wee-string.h" #include "../core/wee-url.h" #include "../core/wee-util.h" +#include "../core/wee-version.h" #include "../gui/gui-bar.h" #include "../gui/gui-bar-item.h" #include "../gui/gui-bar-window.h" @@ -295,20 +296,24 @@ plugin_api_info_get_internal (void *data, const char *info_name, if (string_strcasecmp (info_name, "version") == 0) { - return PACKAGE_VERSION; + return version_get_version (); } else if (string_strcasecmp (info_name, "version_number") == 0) { if (!version_number[0]) { snprintf (version_number, sizeof (version_number), "%d", - util_version_number (PACKAGE_VERSION)); + util_version_number (version_get_version ())); } return version_number; } + else if (string_strcasecmp (info_name, "version_git") == 0) + { + return version_get_git (); + } else if (string_strcasecmp (info_name, "date") == 0) { - return __DATE__; + return version_get_compilation_date (); } else if (string_strcasecmp (info_name, "dir_separator") == 0) { @@ -1023,6 +1028,11 @@ plugin_api_init () &plugin_api_info_get_internal, NULL); hook_info (NULL, "version_number", N_("WeeChat version (as number)"), NULL, &plugin_api_info_get_internal, NULL); + hook_info (NULL, "version_git", N_("WeeChat git version (output of " + "command \"git describe\" for a " + "development version only, empty for a " + "stable release)"), NULL, + &plugin_api_info_get_internal, NULL); hook_info (NULL, "date", N_("WeeChat compilation date"), NULL, &plugin_api_info_get_internal, NULL); hook_info (NULL, "dir_separator", N_("directory separator"), NULL, |