Permalink
Browse files

maint: use a git submodule for gnulib

* .gitmodules: New file, to track gnulib.
* .gnulib: Submodule directory.
* Makefile.am (EXTRA_DIST): Don't list config.rpath or
gitlog-to-changelog.
* autogen.sh: Adapt to use the new submodule.
* cfg.mk: New file.
(SUBDIRS): Add gnulib/lib and gnulib/tests.
(dist-hook): Reflect new location of getlog-to-changelog.
* configure.ac: Set build-aux/ as AUX_DIR.
Invoke gl_EARLY and gl_INIT.
(AC_CONFIG_FILES): Add gnulib/lib/Makefile and gnulib/tests/Makefile.
  • Loading branch information...
1 parent 3572996 commit 480a489ee4c31cb2f9c9f45941645f05b5f74c67 Jim Meyering committed Aug 3, 2009
Showing with 264 additions and 839 deletions.
  1. +5 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +1 −0 .gnulib
  4. +3 −5 Makefile.am
  5. +11 −0 autogen.sh
  6. +82 −0 bootstrap
  7. +153 −0 cfg.mk
  8. +0 −548 config.rpath
  9. +6 −0 configure.ac
  10. +0 −175 gitlog-to-changelog
  11. +0 −111 mkinstalldirs
View
@@ -179,3 +179,8 @@ test-tool/libguestfs-test-tool.1
test-tool/libguestfs-test-tool
test-tool/libguestfs-test-tool-helper
v2v/virt-v2v.1
+/GNUmakefile
+/maint.mk
+/build-aux
+/gnulib
+.git-module-status
View
@@ -0,0 +1,3 @@
+[submodule "gnulib"]
+ path = .gnulib
+ url = git://git.sv.gnu.org/gnulib.git
Submodule .gnulib added at 756095
View
@@ -17,8 +17,8 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src daemon appliance fish po examples images \
- capitests regressions test-tool
+SUBDIRS = gnulib/lib src daemon appliance fish po examples images \
+ gnulib/tests capitests regressions test-tool
if HAVE_OCAML
SUBDIRS += ocaml
@@ -52,13 +52,11 @@ SUBDIRS += cat
endif
EXTRA_DIST = \
- config.rpath \
guestfs.pod guestfs-actions.pod guestfs-structs.pod \
guestfish.pod guestfish-actions.pod \
html/pod.css \
HACKING TODO \
libguestfs.pc libguestfs.pc.in \
- gitlog-to-changelog \
recipes/LICENSE \
recipes/README \
recipes/*.html \
@@ -153,7 +151,7 @@ website: $(HTMLFILES) $(TEXTFILES)
# Generate the ChangeLog automatically from the gitlog.
dist-hook:
- ./gitlog-to-changelog > ChangeLog
+ $(top_srcdir)/build-aux/gitlog-to-changelog > ChangeLog
cp ChangeLog $(distdir)/ChangeLog
# Update the list of translatable files in po/POTFILES.in.
View
@@ -21,6 +21,17 @@
set -e
set -v
+# Ensure that whenever we pull in a gnulib update or otherwise change to a
+# different version (i.e., when switching branches), we also rerun ./bootstrap.
+curr_status=.git-module-status
+t=$(git submodule status)
+if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
+ : # good, it's up to date
+else
+ echo running bootstrap...
+ ./bootstrap && echo "$t" > $curr_status
+fi
+
mkdir -p daemon/m4
autoreconf -i
View
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+usage() {
+ echo >&2 "\
+Usage: $0 [OPTION]...
+Bootstrap this package from the checked-out sources.
+
+Options:
+ --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
+ sources reside. Use this if you already
+ have gnulib sources on your machine, and
+ do not want to waste your bandwidth downloading
+ them again.
+
+If the file bootstrap.conf exists in the current working directory, its
+contents are read as shell variables to configure the bootstrap.
+
+Running without arguments will suffice in most cases.
+"
+}
+
+for option
+do
+ case $option in
+ --help)
+ usage
+ exit;;
+ --gnulib-srcdir=*)
+ GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
+ *)
+ echo >&2 "$0: $option: unknown option"
+ exit 1;;
+ esac
+done
+
+# Get gnulib files.
+
+case ${GNULIB_SRCDIR--} in
+-)
+ echo "$0: getting gnulib files..."
+ git submodule init || exit $?
+ git submodule update || exit $?
+ GNULIB_SRCDIR=.gnulib
+ ;;
+*)
+ # Redirect the gnulib submodule to the directory on the command line
+ # if possible.
+ if test -d "$GNULIB_SRCDIR"/.git && \
+ git config --file .gitmodules 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
+ else
+ echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
+ exit 1
+ fi
+ ;;
+esac
+
+gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
+<$gnulib_tool || exit
+
+modules='
+gitlog-to-changelog
+gnu-make
+gnumakefile
+maintainer-makefile
+manywarnings
+warnings
+vc-list-files
+'
+
+$gnulib_tool \
+ --avoid=dummy \
+ --with-tests \
+ --m4-base=gnulib/m4 \
+ --source-base=gnulib/lib \
+ --tests-base=gnulib/tests \
+ --import $modules
View
153 cfg.mk
@@ -0,0 +1,153 @@
+# Customize Makefile.maint. -*- makefile -*-
+# Copyright (C) 2003-2009 Free Software Foundation, Inc.
+
+# 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 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
+# 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Use alpha.gnu.org for alpha and beta releases.
+# Use ftp.gnu.org for major releases.
+gnu_ftp_host-alpha = alpha.gnu.org
+gnu_ftp_host-beta = alpha.gnu.org
+gnu_ftp_host-major = ftp.gnu.org
+gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
+
+url_dir_list = \
+ ftp://$(gnu_rel_host)/gnu/coreutils
+
+# Tests not to run as part of "make distcheck".
+local-checks-to-skip = \
+ sc_po_check \
+ changelog-check \
+ check-AUTHORS \
+ makefile-check \
+ makefile_path_separator_check \
+ patch-check \
+ sc_GPL_version \
+ sc_always_defined_macros \
+ sc_cast_of_alloca_return_value \
+ sc_dd_max_sym_length \
+ sc_error_exit_success \
+ sc_file_system \
+ sc_immutable_NEWS \
+ sc_makefile_path_separator_check \
+ sc_obsolete_symbols \
+ sc_prohibit_S_IS_definition \
+ sc_prohibit_atoi_atof \
+ sc_prohibit_jm_in_m4 \
+ sc_prohibit_quote_without_use \
+ sc_prohibit_quotearg_without_use \
+ sc_prohibit_stat_st_blocks \
+ sc_prohibit_strcmp_and_strncmp \
+ sc_prohibit_strcmp \
+ sc_root_tests \
+ sc_space_tab \
+ sc_sun_os_names \
+ sc_system_h_headers \
+ sc_tight_scope \
+ sc_two_space_separator_in_usage \
+ sc_error_message_uppercase \
+ sc_program_name \
+ sc_require_test_exit_idiom \
+ sc_makefile_check \
+ sc_useless_cpp_parens
+
+# Avoid uses of write(2). Either switch to streams (fwrite), or use
+# the safewrite wrapper.
+sc_avoid_write:
+ @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ grep '\<write *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$') && \
+ { echo "$(ME): the above files use write;" \
+ " consider using the safewrite wrapper instead" \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
+# Use STREQ rather than comparing strcmp == 0, or != 0.
+# Similarly, use STREQLEN or STRPREFIX rather than strncmp.
+sc_prohibit_strcmp_and_strncmp:
+ @grep -nE '! *strn?cmp *\(|\<strn?cmp *\([^)]+\) *==' \
+ $$($(VC_LIST_EXCEPT)) \
+ | grep -vE ':# *define STREQ(LEN)?\(' && \
+ { echo '$(ME): use STREQ(LEN) in place of the above uses of strcmp(strncmp)' \
+ 1>&2; exit 1; } || :
+
+# Use virAsprintf rather than a'sprintf since *strp is undefined on error.
+sc_prohibit_asprintf:
+ @re='\<[a]sprintf\>' \
+ msg='use virAsprintf, not a'sprintf \
+ $(_prohibit_regexp)
+
+# Prohibit the inclusion of <ctype.h>.
+sc_prohibit_ctype_h:
+ @grep -E '^# *include *<ctype\.h>' $$($(VC_LIST_EXCEPT)) && \
+ { echo "$(ME): don't use ctype.h; instead, use c-ctype.h" \
+ 1>&2; exit 1; } || :
+
+# Ensure that no C source file uses TABs for indentation.
+sc_TAB_in_indentation:
+ @grep -lE '^ * ' /dev/null \
+ $$($(VC_LIST_EXCEPT) \
+ | grep -E '\.[ch](\.in)?$$') && \
+ { echo '$(ME): found TAB(s) used for indentation in C sources;'\
+ 'use spaces' 1>&2; exit 1; } || :
+
+ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
+|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
+
+sc_avoid_ctype_macros:
+ @grep -E '\b($(ctype_re)) *\(' /dev/null \
+ $$($(VC_LIST_EXCEPT)) && \
+ { echo "$(ME): don't use ctype macros (use c-ctype.h)" \
+ 1>&2; exit 1; } || :
+
+sc_prohibit_virBufferAdd_with_string_literal:
+ @re='\<virBufferAdd *\([^,]+, *"[^"]' \
+ msg='use virBufferAddLit, not virBufferAdd, with a string literal' \
+ $(_prohibit_regexp)
+
+# Not only do they fail to deal well with ipv6, but the gethostby*
+# functions are also not thread-safe.
+sc_prohibit_gethostby:
+ @re='\<gethostby(addr|name2?) *\(' \
+ msg='use getaddrinfo, not gethostby*' \
+ $(_prohibit_regexp)
+
+# Disallow trailing blank lines.
+sc_prohibit_trailing_blank_lines:
+ @$(VC_LIST_EXCEPT) | xargs perl -ln -0777 -e \
+ '/\n\n+$$/ and print $$ARGV' > $@-t
+ @found=0; test -s $@-t && { found=1; cat $@-t 1>&2; \
+ echo '$(ME): found trailing blank line(s)' 1>&2; }; \
+ rm -f $@-t; \
+ test $$found = 0
+
+# We don't use this feature of maint.mk.
+prev_version_file = /dev/null
+
+ifeq (0,$(MAKELEVEL))
+ _curr_status = .git-module-status
+ # The sed filter accommodates those who check out on a commit from which
+ # no tag is reachable. In that case, git submodule status prints a "-"
+ # in column 1 and does not print a "git describe"-style string after the
+ # submodule name. Contrast these:
+ # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
+ # b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
+ _submodule_hash = sed 's/.//;s/ .*//'
+ _update_required := $(shell \
+ actual=$$(git submodule status | $(_submodule_hash)); \
+ stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
+ test "$$stamp" = "$$actual"; echo $$?)
+ ifeq (1,$(_update_required))
+ $(error gnulib update required; run ./autogen.sh first)
+ endif
+endif
Oops, something went wrong.

0 comments on commit 480a489

Please sign in to comment.