diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-08 22:27:35 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-08 22:42:28 +0300 |
commit | e523423777dd75acc59cf7b9e7466527d774a9f9 (patch) | |
tree | 6d17e7553373fdfb6f32870902b75874c3f06aae | |
parent | 79f6b2c923d1c2366b68a431756bde6e4a04ae86 (diff) | |
download | grecs-e523423777dd75acc59cf7b9e7466527d774a9f9.tar.gz grecs-e523423777dd75acc59cf7b9e7466527d774a9f9.tar.bz2 |
Various fixes.
* .gitignore: Add gitid.h
* Makefile.am: Build gitid.h.
* am/grecs.m4: Remove GRECS_VEROK_AT.
* build-aux/getopt.m4 (print_version_hook): New variable.
(print_version): Call print_version_hook, if defined.
* src/Make.am (INCLUDES): Update.
* src/grecs.h (grecs_version_info) <id>: New member.
* src/version.c (grecs_version): Initialize id.
* tests/Makefile.am: Remove GRECS_VEROK_AT.
* tests/testsuite.at: Likewise.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 37 | ||||
-rw-r--r-- | am/grecs.m4 | 7 | ||||
-rw-r--r-- | build-aux/getopt.m4 | 4 | ||||
-rw-r--r-- | doc/GRECS_SETUP.3 | 4 | ||||
-rw-r--r-- | doc/grecs_asprintf.3 | 2 | ||||
-rw-r--r-- | doc/grecs_config.5 | 2 | ||||
-rw-r--r-- | doc/grecs_error.3 | 2 | ||||
-rw-r--r-- | doc/grecs_format_locus.3 | 2 | ||||
-rw-r--r-- | doc/grecs_format_node.3 | 2 | ||||
-rw-r--r-- | doc/grecs_format_node_path.3 | 2 | ||||
-rw-r--r-- | doc/grecs_format_value.3 | 2 | ||||
-rw-r--r-- | doc/grecs_include_path_setup.3 | 2 | ||||
-rw-r--r-- | doc/grecs_malloc.3 | 2 | ||||
-rw-r--r-- | doc/grecs_node_free.3 | 2 | ||||
-rw-r--r-- | doc/grecs_parse.3 | 2 | ||||
-rw-r--r-- | doc/grecs_stmt_path.5 | 2 | ||||
-rw-r--r-- | doc/grecs_strdup.3 | 2 | ||||
-rw-r--r-- | doc/grecs_tree_free.3 | 2 | ||||
-rw-r--r-- | doc/tmpl.3 | 2 | ||||
-rw-r--r-- | src/Make.am | 2 | ||||
-rw-r--r-- | src/grecs.h | 1 | ||||
-rw-r--r-- | src/version.c | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/testsuite.at | 1 | ||||
-rw-r--r-- | tests/verok.at | 63 |
26 files changed, 47 insertions, 111 deletions
@@ -26,3 +26,4 @@ core libtool m4 stamp-h1 +gitid.h diff --git a/Makefile.am b/Makefile.am index 72619ec..0eb4b0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,39 @@ -SUBDIRS=src @GRECS_TESTDIR@ @GRECS_DOCDIR@ -EXTRA_DIST=@GRECS_BUILD_AUX@ +# This file is part of Grecs +# Copyright (C) 2007, 2009-2011 Sergey Poznyakoff +# +# Grecs 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, or (at your option) +# any later version. +# +# Grecs 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 Grecs. If not, see <http://www.gnu.org/licenses/>. + ACLOCAL_AMFLAGS = -I am +SUBDIRS=. src @GRECS_TESTDIR@ @GRECS_DOCDIR@ +EXTRA_DIST=@GRECS_BUILD_AUX@ gitid.h + +noinst_HEADERS = gitid.h +BUILT_SOURCES = gitid.h + +.PHONY: gitid.h +gitid.h: + @if test -d .git; then \ + url=`git config --get remote.origin.url | sed 's|.*://||'`; \ + if test "$$url" = "git.gnu.org.ua/gitroot/grecs.git"; then \ + dirty=`git diff-index --name-only HEAD 2>/dev/null` || dirty=;\ + test -n "$$dirty" && dirty="-dirty"; \ + ID=`git log -1 --pretty='%H-%ct-%ae'`$$dirty;\ + echo "#define GRECS_GIT_ID \"$$ID\"" > gitid.tmp; \ + cmp gitid.tmp gitid.h >/dev/null 2>&1 || mv gitid.tmp gitid.h; \ + rm -f gitid.tmp; \ + fi; \ + fi; @GRECS_CHANGELOG@.PHONY: ChangeLog @GRECS_CHANGELOG@ChangeLog: diff --git a/am/grecs.m4 b/am/grecs.m4 index e4f8671..8202903 100644 --- a/am/grecs.m4 +++ b/am/grecs.m4 @@ -149,14 +149,7 @@ AC_DEFUN([GRECS_SETUP],[ ]) _GRECS_IF_OPTION_SET([git2chg],[GRECS_BUILD_AUX="$GRECS_BUILD_AUX build-aux/git2chg.awk"]) - # Make sure package versioning is compatible with version.at: - s=`echo $PACKAGE_VERSION | [sed 's/[0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]\)\?\([^a-zA-Z_0-9].*\)\?//'`] - if test -z "$s"; then - GRECS_VEROK_AT=verok.at - fi - AC_SUBST([GRECS_SRCDIR],$1) - AC_SUBST([GRECS_VEROK_AT]) AC_SUBST([GRECS_BUILD_AUX]) AC_SUBST([GRECS_INCLUDES]) AC_SUBST([GRECS_TESTDIR]) diff --git a/build-aux/getopt.m4 b/build-aux/getopt.m4 index b63baaf..83a1e35 100644 --- a/build-aux/getopt.m4 +++ b/build-aux/getopt.m4 @@ -700,6 +700,8 @@ char *program_author[] = { format_authors(_getopt_get_option(authors)) };>]) +void (*print_version_hook)(FILE *stream); + void print_version(const char *program_version, FILE *stream) { @@ -729,6 +731,8 @@ dnl directives between the lines. dnl ************************************************************************** fputs (_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n"), stream); + if (print_version_hook) + print_version_hook (stream); _getopt_if_option_set([<authors>],[< width = strlen (written_by); fputs (written_by, stream); diff --git a/doc/GRECS_SETUP.3 b/doc/GRECS_SETUP.3 index af0f8e0..c24399e 100644 --- a/doc/GRECS_SETUP.3 +++ b/doc/GRECS_SETUP.3 @@ -13,10 +13,8 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" -.TH GRECS_SETUP 3 "May 5, 2011" "GRECS" "Grecs User Reference" +.TH GRECS_SETUP 3 "May 8, 2011" "GRECS" "Grecs User Reference" .SH NAME GRECS_SETUP \- Initialize \fBgrecs\fR submodule. .SH SYNOPSIS diff --git a/doc/grecs_asprintf.3 b/doc/grecs_asprintf.3 index 73be7f0..daa7f83 100644 --- a/doc/grecs_asprintf.3 +++ b/doc/grecs_asprintf.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_ASPRINTF 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_config.5 b/doc/grecs_config.5 index 579875b..e4ad4f3 100644 --- a/doc/grecs_config.5 +++ b/doc/grecs_config.5 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_CONFIG 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_error.3 b/doc/grecs_error.3 index d747d9a..4f82dc5 100644 --- a/doc/grecs_error.3 +++ b/doc/grecs_error.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_ERROR 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_format_locus.3 b/doc/grecs_format_locus.3 index 90ffa03..a7743f1 100644 --- a/doc/grecs_format_locus.3 +++ b/doc/grecs_format_locus.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_FORMAT_LOCUS 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_format_node.3 b/doc/grecs_format_node.3 index 76cebec..095a494 100644 --- a/doc/grecs_format_node.3 +++ b/doc/grecs_format_node.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_FORMAT_NODE 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_format_node_path.3 b/doc/grecs_format_node_path.3 index 2f8cff6..bf119e7 100644 --- a/doc/grecs_format_node_path.3 +++ b/doc/grecs_format_node_path.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_FORMAT_NODE_PATH 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_format_value.3 b/doc/grecs_format_value.3 index 8a8af9f..e4b45fa 100644 --- a/doc/grecs_format_value.3 +++ b/doc/grecs_format_value.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_FORMAT_VALUE 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_include_path_setup.3 b/doc/grecs_include_path_setup.3 index d179773..a29173a 100644 --- a/doc/grecs_include_path_setup.3 +++ b/doc/grecs_include_path_setup.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_INCLUDE_PATH_SETUP 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_malloc.3 b/doc/grecs_malloc.3 index 1d52eca..7f01df8 100644 --- a/doc/grecs_malloc.3 +++ b/doc/grecs_malloc.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_MALLOC 3 "May 7, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_node_free.3 b/doc/grecs_node_free.3 index af453c0..c154300 100644 --- a/doc/grecs_node_free.3 +++ b/doc/grecs_node_free.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_NODE_FREE 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_parse.3 b/doc/grecs_parse.3 index c51ef95..2abc417 100644 --- a/doc/grecs_parse.3 +++ b/doc/grecs_parse.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_PARSE 3 "May 7, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_stmt_path.5 b/doc/grecs_stmt_path.5 index 52941d5..ffe146b 100644 --- a/doc/grecs_stmt_path.5 +++ b/doc/grecs_stmt_path.5 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_STMT_PATH 5 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_strdup.3 b/doc/grecs_strdup.3 index ae861e4..8bfdd5f 100644 --- a/doc/grecs_strdup.3 +++ b/doc/grecs_strdup.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_STRDUP 3 "May 7, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/doc/grecs_tree_free.3 b/doc/grecs_tree_free.3 index 527995a..d8f1fec 100644 --- a/doc/grecs_tree_free.3 +++ b/doc/grecs_tree_free.3 @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_XXX 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME @@ -13,8 +13,6 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. -.\" This file is part of SLB. -.\" Copyright (C) 2011 Sergey Poznyakoff .\" .TH GRECS_XXX 3 "May 4, 2011" "GRECS" "Grecs User Reference" .SH NAME diff --git a/src/Make.am b/src/Make.am index 50f9170..e415ada 100644 --- a/src/Make.am +++ b/src/Make.am @@ -35,7 +35,7 @@ noinst_HEADERS = yygrecs.h EXTRA_DIST=grecs-gram.h $(PP_SETUP_FILE) Make.am Make-inst.am Make-shared.am Make-static.am -INCLUDES = -I$(srcdir) @GRECS_INCLUDES@ +INCLUDES = -I$(srcdir) -I$(top_srcdir)/@GRECS_SUBDIR@ @GRECS_INCLUDES@ AM_YFLAGS = -dtv AM_LFLAGS = -d diff --git a/src/grecs.h b/src/grecs.h index 8f0ddc6..decde1d 100644 --- a/src/grecs.h +++ b/src/grecs.h @@ -43,6 +43,7 @@ struct grecs_version_info { const char *package; const char *version; + const char *id; int major; int minor; int patch; diff --git a/src/version.c b/src/version.c index 3e251d7..709e63e 100644 --- a/src/version.c +++ b/src/version.c @@ -20,8 +20,9 @@ #include <grecs.h> #include <string.h> #include <ctype.h> +#include "gitid.h" -const char *grecs_version_string; +const char *grecs_vcs_id = "$Id: " GRECS_GIT_ID " $"; struct grecs_version_info * grecs_version_split(const char *vstr) @@ -114,6 +115,7 @@ grecs_version(void) #ifdef GRECS_VERSION_SUFFIX pv->suffix = GRECS_VERSION_SUFFIX; #endif + pv->id = GRECS_GIT_ID; return pv; } diff --git a/tests/Makefile.am b/tests/Makefile.am index a8bf8d2..0bf7752 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -31,7 +31,6 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@GRECS_SUBDIR@/am echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ - echo 'm4_define([GRECS_VEROK_AT], [@GRECS_VEROK_AT@])'; \ echo 'm4_define([GRECS_DISTCK_AT], [@GRECS_DISTCK_AT@])'; \ } >$(srcdir)/package.m4 @@ -57,8 +56,7 @@ TESTSUITE_AT = \ reduce03.at\ set.at\ testsuite.at\ - @GRECS_DISTCK_AT@\ - @GRECS_VEROK_AT@ + @GRECS_DISTCK_AT@ TESTSUITE = $(srcdir)/testsuite M4=m4 diff --git a/tests/testsuite.at b/tests/testsuite.at index 221f536..f307cd8 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -67,6 +67,5 @@ m4_include([reduce03.at]) m4_include([join.at]) m4_include([vercmp.at]) -m4_if(GRECS_VEROK_AT,,,[m4_include(GRECS_VEROK_AT)]) # End of testsuite.at diff --git a/tests/verok.at b/tests/verok.at deleted file mode 100644 index d6064c7..0000000 --- a/tests/verok.at +++ /dev/null @@ -1,63 +0,0 @@ -# This file is part of grecs -*- Autotest -*- -# Copyright (C) 2007, 2009-2011 Sergey Poznyakoff -# -# Grecs 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, or (at your option) -# any later version. -# -# Grecs 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 Grecs. If not, see <http://www.gnu.org/licenses/>. - -AT_SETUP(grecs_version_ok) -AT_KEYWORDS(verok) - -dnl Split Package version into major, minor, patchlevel and suffix - -m4_define([V_MAJOR],[m4_bpatsubst(AT_PACKAGE_VERSION,[\..*])]) -m4_define([V_MINOR],[m4_bpatsubst(AT_PACKAGE_VERSION,[[0-9]+\.\([0-9]+\).*],\1)]) - -m4_define([V_PATCH_TMP],[m4_bpatsubst(AT_PACKAGE_VERSION,[[0-9]+\.[0-9]+\.\([0-9]+\).*],\1)]) -m4_define([V_PATCH],[m4_if(V_PATCH_TMP,AT_PACKAGE_VERSION,[0],V_PATCH_TMP)]) - -m4_pushdef([V_SUFFIX_TMP],[m4_bpatsubst(AT_PACKAGE_VERSION,[[0-9]+\.[0-9]+\(\.[0-9]+\)?])]) -m4_define([V_SUFFIX],[m4_if(V_SUFFIX_TMP,AT_PACKAGE_VERSION,,[ V_SUFFIX_TMP])]) - -dnl Join them back and see if the result matches version. -m4_define([V_OK], -[m4_if(V_MAJOR.V_MINOR[]m4_if(V_PATCH_TMP,AT_PACKAGE_VERSION,,V_PATCH_TMP)dnl -m4_if(V_SUFFIX_TMP,AT_PACKAGE_VERSION,,V_SUFFIX_TMP),AT_PACKAGE_VERSION, -[exit 0], -AT_SKIP_TEST)]) - -AT_CHECK([V_OK]) - -AT_CHECK([gcfver], -[0], -[package: AT_PACKAGE_NAME -version: AT_PACKAGE_VERSION -major: V_MAJOR -minor: V_MINOR -patch: V_PATCH -suffix:V_SUFFIX -]) - -AT_CHECK([gcfver AT_PACKAGE_VERSION], [0]) -AT_CHECK([gcfver "AT_PACKAGE_NAME AT_PACKAGE_VERSION"], [0]) -AT_CHECK([gcfver AT_PACKAGE_VERSION.[foo]], [1]) -AT_CHECK([gcfver "[foo] AT_PACKAGE_VERSION"], [1]) -AT_CHECK([gcfver V_MAJOR], [0]) -AT_CHECK([gcfver V_MAJOR.V_MINOR], [0]) -AT_CHECK([gcfver m4_eval(V_MAJOR+1)], [1]) -AT_CHECK([gcfver V_MAJOR.m4_eval(V_MINOR+1)], [1]) -m4_if(V_MAJOR,0,, - [AT_CHECK([gcfver m4_eval(V_MAJOR-1)],[0]) - AT_CHECK([gcfver m4_eval(V_MAJOR-1).m4_eval(V_MINOR+1)],[0]) - ]) - -AT_CLEANUP |