diff --git a/ChangeLog b/ChangeLog index 8a4a3f984..d1ad5b80e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-06-18 Badlop + + * src/ejabberd.app: The ejabberd version number is defined in the + OTP application resource file, in the key 'vsn' (EJAB-657) + * src/ejabberd.hrl: The macro VERSION now consults the ejabberd + application key vsn + * src/configure.erl: Load the ejabberd application description + * doc/Makefile: Read ejabberd version from ejabberd.app vsn + * doc/api/Makefile: Likewise + 2008-06-18 Christophe Romain * src/mod_pubsub/mod_pubsub.erl: get_default bugfix (EJAB-656) diff --git a/doc/Makefile b/doc/Makefile index bab623dcf..c1f35fdff 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,7 +21,7 @@ release: @echo "Press any key to continue" @read foo @echo "% ejabberd version (automatically generated)." > version.tex - @echo "\newcommand{\version}{"`sed '/VERSION/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ../src/ejabberd.hrl`"}" >> version.tex + @echo "\newcommand{\version}{"`sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ../src/ejabberd.app`"}" >> version.tex @echo -n "% Contributed modules (automatically generated)." > contributed_modules.tex @echo -e "$(CONTRIBUTED_MODULES)" >> contributed_modules.tex diff --git a/doc/api/Makefile b/doc/api/Makefile index 66f399555..f8c7998b1 100644 --- a/doc/api/Makefile +++ b/doc/api/Makefile @@ -1,5 +1,5 @@ APPNAME = ejabberd -VSN = SVN +VSN = $(shell sed '/vsn/!d;s/\(.*\)"\(.*\)"\(.*\)/\2/' ../../src/ejabberd.app) DOCDIR=. SRCDIR=../../src diff --git a/src/configure.erl b/src/configure.erl index f39305b31..b9447c28d 100644 --- a/src/configure.erl +++ b/src/configure.erl @@ -60,6 +60,8 @@ start() -> EVersion = "ERLANG_VERSION = " ++ erlang:system_info(version) ++ "\n", EIDirS = "EI_DIR = " ++ code:lib_dir("erl_interface") ++ "\n", RootDirS = "ERLANG_DIR = " ++ code:root_dir() ++ "\n", + %% Load the ejabberd application description so that ?VERSION can read the vsn key + application:load(ejabberd), Version = "EJABBERD_VERSION = " ++ ?VERSION ++ "\n", ExpatDir = "EXPAT_DIR = c:\\sdk\\Expat-2.0.0\n", OpenSSLDir = "OPENSSL_DIR = c:\\sdk\\OpenSSL\n", diff --git a/src/ejabberd.app b/src/ejabberd.app index ce527086c..ab24bb39d 100644 --- a/src/ejabberd.app +++ b/src/ejabberd.app @@ -2,7 +2,7 @@ {application, ejabberd, [{description, "ejabberd"}, - {vsn, "2.0.0"}, + {vsn, "2.0.x"}, {modules, [acl, adhoc, configure, diff --git a/src/ejabberd.hrl b/src/ejabberd.hrl index 45f26a065..d7b16f1e2 100644 --- a/src/ejabberd.hrl +++ b/src/ejabberd.hrl @@ -19,7 +19,9 @@ %%% %%%---------------------------------------------------------------------- --define(VERSION, "2.0.x"). +%% This macro returns a string of the ejabberd version running, e.g. "2.3.4" +%% If the ejabberd application description isn't loaded, returns atom: undefined +-define(VERSION, element(2, application:get_key(ejabberd,vsn))). -define(MYHOSTS, ejabberd_config:get_global_option(hosts)). -define(MYNAME, hd(ejabberd_config:get_global_option(hosts))).