summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt9
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac2
-rwxr-xr-xversion.sh53
4 files changed, 61 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b9738a49..a675cce1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
diff --git a/Makefile.am b/Makefile.am
index 1da643863..b89bc4c95 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/configure.ac b/configure.ac
index 02d50f829..21195ad60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/version.sh b/version.sh
new file mode 100755
index 000000000..27b192dcf
--- /dev/null
+++ b/version.sh
@@ -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