diff options
-rw-r--r-- | README-hacking | 9 | ||||
-rwxr-xr-x | bootstrap | 65 | ||||
-rw-r--r-- | bootstrap.conf | 12 | ||||
-rw-r--r-- | maint.mk | 122 |
4 files changed, 153 insertions, 55 deletions
diff --git a/README-hacking b/README-hacking index 563d214..96cdeb9 100644 --- a/README-hacking +++ b/README-hacking @@ -15,6 +15,7 @@ tools we depend upon, including: - Autoconf <http://www.gnu.org/software/autoconf/> - Bison <http://www.gnu.org/software/bison/> - Gettext <http://www.gnu.org/software/gettext/> +- Git <http://git.or.cz/> - Gperf <http://www.gnu.org/software/gperf/> - Gzip <http://www.gnu.org/software/gzip/> - Perl <http://www.cpan.org/> @@ -27,6 +28,14 @@ Valgrind supports your architecture. Only building the initial full source tree will be a bit painful. Later, a plain `git pull && make' should be sufficient. +* LZMA + +This package's build procedure uses LZMA to create a compressed +distribution tarball. Using this feature of Automake requires +version 1.10.1 or newer, as well as the lzma program itself. +Make sure you have the latest stable version of the LZMA Utils +from <http://tukaani.org/lzma/>. + * First GIT checkout You can get a copy of the source repository like this: @@ -49,7 +49,7 @@ Options: not to have been checked out. --skip-po Do not download po files. -If the file bootstrap.conf exists in the current working directory, its +If the file $0.conf exists in the same directory as this script, its contents are read as shell variables to configure the bootstrap. Running without arguments will suffice in most cases. @@ -146,7 +146,13 @@ copy=false vc_ignore=auto # Override the default configuration, if necessary. -test -r bootstrap.conf && . ./bootstrap.conf +# Make sure that bootstrap.conf is sourced from the current directory +# if we were invoked as "sh bootstrap". +case "$0" in + */*) test -r "$0.conf" && . "$0.conf" ;; + *) test -r "$0.conf" && . ./"$0.conf" ;; +esac + if test "$vc_ignore" = auto; then vc_ignore= @@ -218,27 +224,65 @@ fi echo "$0: Bootstrapping from checked-out $package sources..." +# See if we can use gnulib's git-merge-changelog merge driver. +if test -d .git && (git --version) >/dev/null 2>/dev/null ; then + if git config merge.merge-changelog.driver >/dev/null ; then + : + elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then + echo "initializing git-merge-changelog driver" + git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' + git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' + else + echo "consider installing git-merge-changelog from gnulib" + fi +fi + + cleanup_gnulib() { status=$? rm -fr gnulib exit $status } +git_modules_config () { + GIT_CONFIG_LOCAL=.gitmodules git config "$@" +} + # Get gnulib files. case ${GNULIB_SRCDIR--} in -) - if [ ! -d gnulib ]; then + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init || exit $? + git submodule update || exit $? + + elif [ ! -d gnulib ]; then echo "$0: getting gnulib files..." trap cleanup_gnulib 1 2 13 15 - git clone --depth 2 git://git.sv.gnu.org/gnulib || + git clone --help|grep depth > /dev/null && depth='--depth 2' || depth= + git clone $depth git://git.sv.gnu.org/gnulib || cleanup_gnulib trap - 1 2 13 15 fi GNULIB_SRCDIR=gnulib + ;; +*) + # Redirect the gnulib submodule to the directory on the command line + # if possible. + if test -d "$GNULIB_SRCDIR"/.git && \ + git_modules_config submodule.gnulib.url >/dev/null; then + git submodule init + GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd` + git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR + echo "$0: getting gnulib files..." + git submodule update || exit $? + GNULIB_SRCDIR=gnulib + fi + ;; esac gnulib_tool=$GNULIB_SRCDIR/gnulib-tool @@ -544,7 +588,6 @@ find "$m4_base" "$source_base" \ -depth \( -name '*.m4' -o -name '*.[ch]' \) \ -type l -xtype l -delete > /dev/null 2>&1 - # Reconfigure, getting other files. for command in \ @@ -555,8 +598,16 @@ for command in \ 'automake --add-missing --copy --force-missing'; do if test "$command" = libtool; then - grep '^[ ]*AM_PROG_LIBTOOL\>' configure.ac >/dev/null || - continue + use_libtool=0 + # We'd like to use grep -E, to see if any of LT_INIT, + # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, + # but that's not portable enough (e.g., for Solaris). + grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ + && use_libtool=1 + grep '^[ ]*LT_INIT' configure.ac >/dev/null \ + && use_libtool=1 + test $use_libtool = 0 \ + && continue command='libtoolize -c -f' fi echo "$0: $command ..." diff --git a/bootstrap.conf b/bootstrap.conf index 07fbc36..4d2ad60 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -2,10 +2,10 @@ # Copyright (C) 2006-2008 Free Software Foundation, Inc. -# This program is free software; you can redistribute it and/or modify +# This program 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. +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,9 +13,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # We don't need these modules, even though gnulib-tool mistakenly @@ -40,6 +38,7 @@ gnulib_modules=" $obsolete_gnulib_modules alloca alloca-opt + announce-gen atexit autobuild closeout @@ -79,6 +78,7 @@ gnulib_modules=" stat-macros stdbool strcase + strcasestr strcspn strdup strsep @@ -31,7 +31,7 @@ GIT = git VC = $(GIT) VC-tag = git tag -s -m '$(VERSION)' -VC_LIST = build-aux/vc-list-files +VC_LIST = $(srcdir)/build-aux/vc-list-files VC_LIST_EXCEPT = \ $(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi @@ -377,18 +377,18 @@ sc_program_name: fi # Require that the final line of each test-lib.sh-using test be this one: -# (exit $fail); exit $fail +# Exit $fail # Note: this test requires GNU grep's --label= option. sc_require_test_exit_idiom: @if test -f $(srcdir)/tests/test-lib.sh; then \ die=0; \ for i in $$(grep -l -F /../test-lib.sh $$($(VC_LIST) tests)); do \ - tail -n1 $$i | grep '^(exit \$$fail); exit \$$fail$$' > /dev/null \ + tail -n1 $$i | grep '^Exit \$$fail$$' > /dev/null \ && : || { die=1; echo $$i; } \ done; \ test $$die = 1 && \ { echo 1>&2 '$(ME): the final line in each of the above is not:'; \ - echo 1>&2 '(exit $$fail); exit $$fail'; \ + echo 1>&2 'Exit $$fail'; \ exit 1; } || :; \ fi @@ -455,6 +455,21 @@ sc_no_exec_perl_coreutils: exit 1; } || :; \ fi +# Make sure we don't use st_blocks. Use ST_NBLOCKS instead. +# This is a bit of a kludge, since it prevents use of the string +# even in comments, but for now it does the job with no false positives. +sc_prohibit_stat_st_blocks: + @grep -nE '[.>]st_blocks' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): do not use st_blocks; use ST_NBLOCKS' \ + 1>&2; exit 1; } || : + +# Make sure we don't define any S_IS* macros in src/*.c files. +# They're already defined via gnulib's sys/stat.h replacement. +sc_prohibit_S_IS_definition: + @grep -nE '^ *# *define *S_IS' $$($(VC_LIST_EXCEPT)) && \ + { echo '$(ME): do not define S_IS* macros; include <sys/stat.h>' \ + 1>&2; exit 1; } || : + NEWS_hash = \ $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \ $(srcdir)/NEWS | md5sum -) @@ -507,13 +522,19 @@ epoch_date = 1970-01-01 00:00:00.000000000 +0000 # Ensure that the c99-to-c89 patch applies cleanly. patch-check: rm -rf src-c89 $@.1 $@.2 - cp -a src src-c89 - (cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \ + cp -a $(srcdir)/src src-c89 + if test "x$(srcdir)" != x.; then \ + cp -a src/* src-c89; \ + dotfiles=`ls src/.[!.]* 2>/dev/null`; \ + test -z "$$dotfiles" || cp -a src/.[!.]* src-c89; \ + fi + (cd src-c89; patch -p1 -V never --fuzz=0) < $(srcdir)/src/c99-to-c89.diff \ > $@.1 2>&1 - if test "$(REGEN_PATCH)" = yes; then \ - diff -upr src src-c89 | sed 's,src-c89/,src/,' \ - | grep -vE '^(Only in|File )' \ - | perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/' \ + if test "$(REGEN_PATCH)" = yes; then \ + diff -upr $(srcdir)/src src-c89 | sed 's,$(srcdir)/src-c89/,src/,' \ + | grep -vE '^(Only in|File )' \ + | perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \ + -e 's/^ $$//' \ > new-diff || : ; fi grep -v '^patching file ' $@.1 > $@.2 || : msg=ok; test -s $@.2 && msg='fuzzy patch' || : ; \ @@ -544,8 +565,12 @@ check-AUTHORS: # Ensure that we use only the standard $(VAR) notation, # not @...@ in Makefile.am, now that we can rely on automake # to emit a definition for each substituted variable. +# We use perl rather than "grep -nE ..." to exempt a single +# use of an @...@-delimited variable name in src/Makefile.am. makefile-check: - @grep -nE '@[A-Z_0-9]+@' `find . -name Makefile.am` \ + @perl -ne '/\@[A-Z_0-9]+\@/ && !/^cu_install_program =/' \ + -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \ + $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$') \ && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : news-date-check: NEWS @@ -572,17 +597,21 @@ m4-check: && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \ exit 1; } || : +fix_po_file_diag = \ +'you have changed the set of files with translatable diagnostics;\n\ +apply the above patch\n' + # Verify that all source files using _() are listed in po/POTFILES.in. -# FIXME: don't hard-code file names below; use a more general mechanism. +po_file = po/POTFILES.in po-check: - @if test -f po/POTFILES.in; then \ - grep -E -v '^(#|$$)' po/POTFILES.in \ + @if test -f $(po_file); then \ + grep -E -v '^(#|$$)' $(po_file) \ | grep -v '^src/false\.c$$' | sort > $@-1; \ files=; \ for file in $$($(VC_LIST_EXCEPT)) lib/*.[ch]; do \ case $$file in \ - djgpp/* | man/*) continue;; \ - */c99-to-c89.diff) continue;; \ + *.?|*.??) ;; \ + *) continue;; \ esac; \ case $$file in \ *.[ch]) \ @@ -593,7 +622,8 @@ po-check: done; \ grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \ | sort -u > $@-2; \ - diff -u $@-1 $@-2 || exit 1; \ + diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \ + || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \ rm -f $@-1 $@-2; \ fi @@ -684,7 +714,9 @@ null_AM_MAKEFLAGS = \ AUTOHEADER=false \ MAKEINFO=false -built_programs = $$(cd src && MAKEFLAGS= $(MAKE) -s built_programs.list) +built_programs = \ + $$(cd src && echo '_spy:;@echo $$(bin_PROGRAMS)' \ + | MAKEFLAGS= $(MAKE) -s make -f Makefile -f - _spy) warn_cflags = -Dlint -O -Werror -Wall -Wformat -Wshadow -Wpointer-arith bin=bin-$$$$ @@ -724,6 +756,34 @@ define my-instcheck } endef +define coreutils-path-check + { \ + if test -f $(srcdir)/src/true.c; then \ + fail=1; \ + mkdir $(bin) \ + && ($(write_loser)) > $(bin)/loser \ + && chmod a+x $(bin)/loser \ + && for i in $(built_programs); do \ + case $$i in \ + rm|expr|basename|echo|sort|ls|tr);; \ + cat|dirname|mv|wc);; \ + *) ln $(bin)/loser $(bin)/$$i;; \ + esac; \ + done \ + && ln -sf ../src/true $(bin)/false \ + && PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \ + && { test -d gnulib-tests \ + && $(MAKE) -C gnulib-tests check \ + || :; } \ + && rm -rf $(bin) \ + && fail=0; \ + else \ + fail=0; \ + fi; \ + test $$fail = 1 && exit 1 || :; \ + } +endef + # Use -Wformat -Werror to detect format-string/arg-list mismatches. # Also, check for shadowing problems with -Wshadow, and for pointer # arithmetic problems with -Wpointer-arith. @@ -749,33 +809,11 @@ my-distcheck: $(DIST_ARCHIVES) $(local-check) && $(MAKE) dvi \ && $(install-transform-check) \ && $(my-instcheck) \ - && mkdir $(bin) \ - && ($(write_loser)) > $(bin)/loser \ - && chmod a+x $(bin)/loser \ - && for i in $(built_programs); do \ - case $$i in \ - rm|expr|basename|echo|sort|ls|tr);; \ - cat|dirname|mv|wc);; \ - *) ln $(bin)/loser $(bin)/$$i;; \ - esac; \ - done \ - && ln -sf ../src/true $(bin)/false \ - && PATH=`pwd`/$(bin):$$PATH $(MAKE) -C tests check \ - && { test -d gnulib-tests \ - && $(MAKE) -C gnulib-tests check \ - || :; } \ - && rm -rf $(bin) \ + && $(coreutils-path-check) \ && $(MAKE) distclean (cd $(t) && mv $(distdir) $(distdir).old \ && $(AMTAR) -zxf - ) < $(distdir).tar.gz diff -ur $(t)/$(distdir).old $(t)/$(distdir) - if test -f $(srcdir)/src/c99-to-c89.diff; then \ - cd $(t)/$(distdir) \ - && (cd src && patch -V never --fuzz=0 <c99-to-c89.diff) \ - && ./configure --disable-largefile \ - CFLAGS='-Werror -ansi -Wno-long-long' \ - && $(MAKE); \ - fi -rm -rf $(t) @echo "========================"; \ echo "$(distdir).tar.gz is ready for distribution"; \ @@ -855,4 +893,4 @@ alpha beta major: $(local-check) writable-files $(MAKE) update-NEWS-hash perl -pi -e '$$. == 3 and print "$(noteworthy)\n\n\n"' NEWS $(emit-commit-log) > .ci-msg - $(VC) commit -F .ci-msg + $(VC) commit -F .ci-msg -a |