core: add a script version.sh to get WeeChat stable/devel version

v2.8-utf8proc
Sébastien Helleu 2015-10-24 12:44:13 +02:00
parent f3e0bd5987
commit cfc1f39779
4 changed files with 61 additions and 4 deletions

View File

@ -31,9 +31,12 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror-implicit-function-de
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror-implicit-function-declaration")
# version
set(VERSION_MAJOR "1")
set(VERSION_MINOR "4-dev")
set(VERSION_PATCH "")
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/version.sh devel-major OUTPUT_VARIABLE VERSION_MAJOR)
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/version.sh devel-minor OUTPUT_VARIABLE VERSION_MINOR)
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/version.sh devel-patch OUTPUT_VARIABLE VERSION_PATCH)
string(REGEX REPLACE "\n" "" VERSION_MAJOR "${VERSION_MAJOR}")
string(REGEX REPLACE "\n" "" VERSION_MINOR "${VERSION_MINOR}")
string(REGEX REPLACE "\n" "" VERSION_PATCH "${VERSION_PATCH}")
if(VERSION_PATCH STREQUAL "")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
else()

View File

@ -66,6 +66,7 @@ EXTRA_DIST = AUTHORS.asciidoc \
po/srcfiles.cmake \
tools/build-test.sh \
tools/git-version.sh \
version.sh \
weechat.png \
weechat.pc.in \
weechat.cygport.in

View File

@ -24,7 +24,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 1.4-dev, flashcode@flashtux.org)
AC_INIT(WeeChat, m4_esyscmd([./version.sh devel-full | tr -d '\n']), flashcode@flashtux.org)
AC_CONFIG_SRCDIR([configure.ac])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])

53
version.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh
#
# Copyright (C) 2015 Sébastien 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/>.
#
#
# Returns current stable or devel version of WeeChat.
#
# Syntax:
# version.sh stable|devel|devel-full|devel-major|devel-minor|devel-patch
#
# stable the current stable (e.g. 1.3)
# devel the current devel (e.g. 1.4)
# devel-full the full name of devel (e.g. 1.4-dev or 1.4-rc1)
# devel-major the major version of devel (e.g. 1)
# devel-minor the minor version of devel (e.g. 4-dev)
# devel-patch the patch version of devel (e.g. 2 for version 1.4.2)
#
WEECHAT_STABLE=1.3
WEECHAT_DEVEL=1.4
WEECHAT_DEVEL_FULL=1.4-dev
if [ $# -lt 1 ]; then
echo >&2 "Syntax: $0 stable|devel|devel-full|devel-major|devel-minor|devel-patch"
exit 1
fi
case $1 in
stable ) echo $WEECHAT_STABLE ;;
devel ) echo $WEECHAT_DEVEL ;;
devel-full ) echo $WEECHAT_DEVEL_FULL ;;
devel-major ) echo $WEECHAT_DEVEL_FULL | cut -d'.' -f1 ;;
devel-minor ) echo $WEECHAT_DEVEL_FULL | cut -d'.' -f2 ;;
devel-patch ) echo $WEECHAT_DEVEL_FULL | cut -d'.' -f3- ;;
* ) echo >&2 "ERROR: unknown version."
exit 1 ;;
esac