]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/gvf'
authorAndre Noll <maan@systemlinux.org>
Fri, 8 Apr 2011 09:12:46 +0000 (11:12 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 8 Apr 2011 09:12:46 +0000 (11:12 +0200)
16 files changed:
.gitignore
GIT-VERSION-GEN
Makefile.in
afh.c
audioc.c
audiod.c
client_common.c
command.c
fade.c
filter.c
gui.c
para.h
recv.c
server.c
version.h [new file with mode: 0644]
write.c

index d3a1fc5e94aa4cba84113021557b0a1b882a4f93..91c6f8589b600c26b00e845fa4413b85ba038944 100644 (file)
@@ -30,4 +30,4 @@ web_sync
 confdefs.h
 conftest
 conftest.c
-GIT-VERSION-FILE
+git-version.h
index a64d79612ef3fbde0eadf35d657a5ed67825abce..15c387942fad6748244a530728bf58edc69c83ff 100755 (executable)
@@ -1,22 +1,17 @@
-#!/bin/sh
-
-if test $# -ne 1; then
-       echo >&2 "usage: $0 <version file>"
-       exit 1
-fi
+#!/usr/bin/env bash
 
+(($# > 1)) && { echo >&2 "usage: $0 [<version file>]"; exit 1; }
 GVF="$1"
-DEF_VER="unnamed_version"
 
+DEF_VER="unnamed_version"
 LF='
 '
 
 # First see if there is a version file (included in release tarballs),
 # then try git-describe, then default.
-if test -f VERSION
-then
+if [[ -f VERSION ]]; then
        VN=$(cat VERSION) || VN="$DEF_VER"
-elif test -d .git -o -f .git &&
+elif [[ -d .git || -f .git ]] &&
        VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
        case "$VN" in
        *$LF*) (exit 1) ;;
@@ -32,14 +27,12 @@ else
 fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
+echo "$VN"
 
-if test -r $GVF
-then
-       VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
-       VC=unset
+[[ -z "$GVF" ]] && exit 0
+if [[ -r "$GVF" ]]; then
+       VC=$(sed -e 's/^#define GIT_VERSION "//; s/"$//' < "$GVF")
+       [[ "$VN" == "$VC" ]] && exit 0
 fi
-test "$VN" = "$VC" || {
-       echo >&2 "GIT_VERSION = $VN"
-       echo "GIT_VERSION = $VN" >$GVF
-}
+echo >&2 "new git version: $VN"
+echo "#define GIT_VERSION \"$VN\"" >$GVF
index 8963adad3b7339a1ff6b750f69b597acde1c49f6..8b33aaac0c9fe58bab3b20c61cee25476af90965 100644 (file)
@@ -17,6 +17,8 @@ uname_rs := $(shell uname -rs)
 cc_version := $(shell $(CC) --version | head -n 1)
 codename := infinite rollback
 
+GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h)
+
 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
 DEBUG_CPPFLAGS += -Wredundant-decls
 DEBUG_CPPFLAGS += -Wall
@@ -59,7 +61,6 @@ CPPFLAGS += @arch_cppflags@
 CPPFLAGS += -I/usr/local/include
 CPPFLAGS += -I$(cmdline_dir)
 CPPFLAGS += @osl_cppflags@
-CPPFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"'
 
 man_pages := $(patsubst %, man/man1/%.1, @executables@)
 man_pages_in := $(patsubst %, web/%.man.in.html, @executables@)
@@ -100,18 +101,12 @@ else
        Q =
 endif
 
-.PHONY: dep all clean distclean maintainer-clean install man tarball\
-       .FORCE-GIT-VERSION-FILE
+.PHONY: dep all clean distclean maintainer-clean install man tarball
 all: dep @executables@ $(man_pages)
 dep: $(deps)
 man: $(man_pages)
 tarball: $(tarball)
 
-GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
-       @./GIT-VERSION-GEN GIT-VERSION-FILE
--include GIT-VERSION-FILE
-@executables@: GIT-VERSION-FILE
-
 -include $(ggo_dir)/makefile
 
 %_command_list.c: %.cmd
@@ -309,7 +304,7 @@ $(tarball): $(cmdline_generated)
        git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
                | tar --delete $(tarball_delete) > $(tarball_pfx).tar
        mkdir -p $(tarball_pfx)/$(cmdline_dir)
-       echo $(GIT_VERSION) > $(tarball_pfx)/VERSION
+       ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
        cp -r $(autocrap) $(tarball_pfx)
        cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir)
        tar rf $(tarball_pfx).tar $(tarball_pfx)/*
diff --git a/afh.c b/afh.c
index c5d7aec296a7a44b2fedfd2532ad838f89654e6c..37d71224ba5631cc24f79c194810c20f9d9eb95e 100644 (file)
--- a/afh.c
+++ b/afh.c
@@ -16,6 +16,7 @@
 #include "fd.h"
 #include "afh.h"
 #include "error.h"
+#include "version.h"
 
 static struct afh_args_info conf;
 /** The list of all status items */
index 74fb824cfff9d7193ebe42af9bfdc97ed5863fe0..adcae715e28d29c48da934a16360dab8b5ecc476 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -16,6 +16,7 @@
 #include "net.h"
 #include "string.h"
 #include "fd.h"
+#include "version.h"
 
 INIT_AUDIOC_ERRLISTS;
 
index e5db0cd2b075c726e931f22ea854d0b916b7e8ef..5bc22c816896d22b7c1269dc7ceb3fa234efd7b0 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -33,6 +33,7 @@
 #include "write.h"
 #include "write_common.h"
 #include "signal.h"
+#include "version.h"
 
 /** define the array of error lists needed by para_audiod */
 INIT_AUDIOD_ERRLISTS;
index a7115fd75ac33495d9dd36862ff446757bd9666c..54bb9433e34cbd0a5bbfed50d07a7d536e0f8b65 100644 (file)
@@ -25,6 +25,7 @@
 #include "client.h"
 #include "hash.h"
 #include "buffer_tree.h"
+#include "version.h"
 
 /** The size of the receiving buffer. */
 #define CLIENT_BUFSIZE 4000
index 5217f9b487cd260aebe5d5a986f4fd8e957b0270..24ddf7897d81e3b27c6f1777f975da49ca31ee52 100644 (file)
--- a/command.c
+++ b/command.c
@@ -37,6 +37,7 @@
 #include "afs_command_list.h"
 #include "sched.h"
 #include "signal.h"
+#include "version.h"
 
 /** Commands including options must be shorter than this. */
 #define MAX_COMMAND_LEN 32768
diff --git a/fade.c b/fade.c
index 5fbd0dd48027ad990345aa5d8f86fa0d952e6188..41b4a6d78e2b40d80cb24e31a5b0030c37db4584 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -23,6 +23,7 @@
 #include "fd.h"
 #include "string.h"
 #include "error.h"
+#include "version.h"
 
 INIT_FADE_ERRLISTS;
 static struct fade_args_info conf;
index 1d938c45ac059a92ac59ac364be5abc73ebc2a13..0dfc94b1cc7213e024f6bc626c48be79cb09df75 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -20,6 +20,7 @@
 #include "stdin.h"
 #include "stdout.h"
 #include "error.h"
+#include "version.h"
 
 /** The list of all status items used by para_{server,audiod,gui}. */
 const char *status_item_list[] = {STATUS_ITEM_ARRAY};
diff --git a/gui.c b/gui.c
index 3c1889ca51ae44fa89fdea7999aad0dcd31dcb33..578eeed0c96d502767a57b5cb80f0cad2c9cfc07 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -22,6 +22,7 @@
 #include "list.h"
 #include "sched.h"
 #include "signal.h"
+#include "version.h"
 
 /** define the array of error lists needed by para_gui */
 INIT_GUI_ERRLISTS;
diff --git a/para.h b/para.h
index 08eb0ee6c20ab1a7779cc3f10de2b5fca094f44b..7217486d7965c93dfa0361c54982e6225aa06875 100644 (file)
--- a/para.h
+++ b/para.h
                va_end(argp); \
        }
 
-/** Version text used by various commands if -V switch was given. */
-#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
-       " (" GIT_VERSION ": " CODENAME ")" "\n" \
-       "Copyright (C) 2011 Andre Noll\n" \
-       "This is free software with ABSOLUTELY NO WARRANTY." \
-       " See COPYING for details.\n" \
-       "Written by Andre Noll.\n" \
-       "Report bugs to <maan@systemlinux.org>.\n"
-
-/** Print out \p VERSION_TEXT and exit if version flag was given. */
-#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
-       if (_args_info_struct.version_given) { \
-               printf("%s", VERSION_TEXT(_prefix)); \
-               exit(EXIT_SUCCESS); \
-       }
-
 /** Sent by para_client to initiate the authentication procedure. */
 #define AUTH_REQUEST_MSG "auth rsa "
 /** Sent by para_server for commands that expect a data file. */
diff --git a/recv.c b/recv.c
index a737e4cbde81760cc2bf2014bd72b56b07210a60..ae8a1f663b725cbed40f763e0105fd04d2d4dcc9 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -22,6 +22,7 @@
 #include "error.h"
 #include "stdout.h"
 #include "buffer_tree.h"
+#include "version.h"
 
 /** The gengetopt args info struct. */
 static struct recv_args_info conf;
index 35d6f19137b3a881482df4e65c3945d6bcdb8a78..4d54f74b63d47e52fee508a899bc3b8970d1e1b6 100644 (file)
--- a/server.c
+++ b/server.c
@@ -91,6 +91,7 @@
 #include "signal.h"
 #include "user_list.h"
 #include "color.h"
+#include "version.h"
 
 /** Define the array of error lists needed by para_server. */
 INIT_SERVER_ERRLISTS;
diff --git a/version.h b/version.h
new file mode 100644 (file)
index 0000000..3b83966
--- /dev/null
+++ b/version.h
@@ -0,0 +1,17 @@
+#include "git-version.h"
+/** Version text used by various commands if -V switch was given. */
+#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
+       " (" GIT_VERSION ": " CODENAME ")" "\n" \
+       "Copyright (C) 2011 Andre Noll\n" \
+       "This is free software with ABSOLUTELY NO WARRANTY." \
+       " See COPYING for details.\n" \
+       "Written by Andre Noll.\n" \
+       "Report bugs to <maan@systemlinux.org>.\n"
+
+/** Print out \p VERSION_TEXT and exit if version flag was given. */
+#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
+       if (_args_info_struct.version_given) { \
+               printf("%s", VERSION_TEXT(_prefix)); \
+               exit(EXIT_SUCCESS); \
+       }
+
diff --git a/write.c b/write.c
index b3824a081f594dee23617502caf65261717d77b9..571dc4ed8e4c0d35e253f277205975d5eac8758c 100644 (file)
--- a/write.c
+++ b/write.c
@@ -23,6 +23,7 @@
 #include "write_common.h"
 #include "fd.h"
 #include "error.h"
+#include "version.h"
 
 INIT_WRITE_ERRLISTS;