From 113ef8305f6ba5f3c7df66294a7eb15dcb02e026 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Thu, 13 Dec 2007 21:42:30 -0500 Subject: [PATCH] Store git version string to a C file, not a header. .gitignore: Update git-ignore.* file name. Makefile.am: Update rebuild rules and srvx_SOURCES to match. common.h: Declare git_version[]. main-common.c: Include git_version in version banner. Update copyright years. modcmd.c: Use git_version instead of GIT_VERSION. --- src/.gitignore | 2 +- src/Makefile.am | 19 +++++++++---------- src/common.h | 1 + src/main-common.c | 6 ++++-- src/modcmd.c | 5 ++--- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/.gitignore b/src/.gitignore index 647196b..2b2b6d4 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,6 +2,6 @@ Makefile.in config.h.in .deps config.h -git-version.h +git-version.c modules-list.h stamp-h1 diff --git a/src/Makefile.am b/src/Makefile.am index f24e000..155ccd6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,23 +15,22 @@ noinst_DATA = \ mod-memoserv.help \ mod-sockcheck.help EXTRA_DIST = $(noinst_DATA) -BUILT_SOURCES = git-version.h -noinst_HEADERS = git-version.h if HAS_GIT +BUILT_SOURCES = git-version.c .PHONY: checkversion -git-version.h: checkversion +git-version.c: checkversion checkversion: @GIT_VERSION=`$(GIT) describe`; \ [ "z$$GIT_VERSION" != "z" ] || exit 0; \ - TMPFILE=`mktemp git-version.h.XXXXXX` || exit 1 ; \ - echo "#define GIT_VERSION \"$${GIT_VERSION}\"" >> $$TMPFILE ; \ - if diff -q git-version.h $$TMPFILE >/dev/null 2>&1 ; then \ + TMPFILE=`mktemp git-version.c.XXXXXX` || exit 1 ; \ + echo "const char git_version[] = \"$${GIT_VERSION}\";" >> $$TMPFILE ; \ + if diff -q git-version.c $$TMPFILE >/dev/null 2>&1 ; then \ rm $$TMPFILE ; \ else \ - echo "Putting new git version into git-version.h" ; \ - rm -f git-version.h ; \ - mv $$TMPFILE git-version.h ; \ + echo "Putting new git version into git-version.c" ; \ + rm -f git-version.c ; \ + mv $$TMPFILE git-version.c ; \ fi endif @@ -57,7 +56,7 @@ EXTRA_srvx_SOURCES = \ srvx_LDADD = @MODULE_OBJS@ srvx_DEPENDENCIES = @MODULE_OBJS@ srvx_SOURCES = \ - git-version.h \ + git-version.c \ chanserv.c chanserv.h \ compat.c compat.h \ conf.c conf.h \ diff --git a/src/common.h b/src/common.h index b979aa1..c23597c 100644 --- a/src/common.h +++ b/src/common.h @@ -122,6 +122,7 @@ extern void verify(const void *ptr); extern time_t now; extern int quit_services; extern struct log_type *MAIN_LOG; +extern const char git_version[]; typedef union irc_in_addr { uint32_t in6_32[4]; diff --git a/src/main-common.c b/src/main-common.c index 16ba7c7..2e45710 100644 --- a/src/main-common.c +++ b/src/main-common.c @@ -549,8 +549,10 @@ version() { printf(" --------------------------------------------------\n" " - "PACKAGE_STRING" ("CODENAME"), Built: " __DATE__ ", " __TIME__".\n" - " - Copyright (C) 2000 - 2005, srvx Development Team\n" - " --------------------------------------------------\n"); + " - Copyright (C) 2000 - 2007, srvx Development Team\n" + " - Version tag %s\n" + " --------------------------------------------------\n", + git_version); } static void diff --git a/src/modcmd.c b/src/modcmd.c index 910e22f..e41a1ea 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -18,7 +18,6 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "git-version.h" #include "chanserv.h" #include "conf.h" #include "modcmd.h" @@ -877,7 +876,7 @@ modcmd_privmsg(struct userNode *user, struct userNode *bot, const char *text, in * users, except to add copyright information pertaining * to changes you make to srvx. */ - snprintf(response, sizeof(response), "\x01VERSION %s (%s) %s\x01", PACKAGE_STRING, CODENAME, GIT_VERSION); + snprintf(response, sizeof(response), "\x01VERSION %s (%s) %s\x01", PACKAGE_STRING, CODENAME, git_version); irc_notice_user(bot, user, response); } return; @@ -1857,7 +1856,7 @@ static MODCMD_FUNC(cmd_version) { */ send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b ("CODENAME"), Built: "__DATE__", "__TIME__". Copyright 2000-2007 srvx Development Team."); if (argc > 1) - send_message_type(4, user, cmd->parent->bot, "%s", GIT_VERSION); + send_message_type(4, user, cmd->parent->bot, "%s", git_version); else send_message_type(12, user, cmd->parent->bot, "The srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net."); return 1; -- 2.20.1