Hi Gary, et al.,

This patch removes modules/libposix and libposix/configure.ac,
creating these files on the fly instead.  Since the module
file is now created by capturing the output of posix-modules,
I also removed the validation from the libposix/bootstrap
script.  I also augmented it to follow through with building
the distro with a "--distro" option.  In fact:

   cd libposix ; ./bootstrap --all

will just do it all.

With the previous test patches, "make check" passes.
The reason for recreating configure.ac, by the way, is that
I just found it a lot easier to capture the git-version-gen
output and insert the value with a here-doc instead of
messing with an unmodified ".in" file and using sed.
It wasn't a big enough file to make it worth the bother.

Regards, Bruce
>From f23b520342d11559b21db9911c1dd3ef7c6c41e2 Mon Sep 17 00:00:00 2001
From: Bruce Korb <bk...@gnu.org>
Date: Thu, 11 Nov 2010 08:48:17 -0800
Subject: [PATCH 3/3] Rewrite bootstrap to create the libposix module file and the
 configure.ac files on the fly.  Also, enable it to construct
 the distribution tarball in one go.

---
 .gitignore            |    1 +
 libposix/.gitignore   |    4 +
 libposix/bootstrap    |  183 +++++++++++++++++++++++++----
 libposix/configure.ac |   35 ------
 modules/libposix      |  318 -------------------------------------------------
 5 files changed, 167 insertions(+), 374 deletions(-)
 delete mode 100644 libposix/configure.ac
 delete mode 100644 modules/libposix

diff --git a/.gitignore b/.gitignore
index b95fb40..a9a9402 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 allsnippets.tmp
 amsnippet.tmp
 testdir*
+*.diff
diff --git a/libposix/.gitignore b/libposix/.gitignore
index b078d37..fe3cbd6 100644
--- a/libposix/.gitignore
+++ b/libposix/.gitignore
@@ -46,3 +46,7 @@ stamp-h1
 /tests/test-*
 unused-parameter.h
 warn-on-use.h
+/_*
+/configure.ac
+/tests
+/tmp
diff --git a/libposix/bootstrap b/libposix/bootstrap
index 987bd31..94f1eed 100755
--- a/libposix/bootstrap
+++ b/libposix/bootstrap
@@ -1,30 +1,171 @@
 #! /bin/sh
+# -*- Mode: Shell-script -*-
 
-PATH=..:$PATH
+die() {
+    echo "mk-libposix-module.sh error:  $*" >&2
+    trap '' EXIT
+    test ${#clean_list} -gt 1 && \
+        echo '*NOT*:  rm -rf' ${clean_list}
+    kill -TERM $progpid
+    exit 1
+}
 
-# Bootstrap for autotools.
-gnulib-tool --import --lib=libposix --makefile-name=gnulib.mk \
-  --macro-prefix=LIBPOSIX --libtool --no-changelog --symlink \
-  --with-tests --with-c++-tests --with-longrunning-tests \
-  git-version-gen libposix
+do_or_die() {
+    "$@" || die "FAILED: $*"
+}
 
+clean_list=''
+cleanup() {
+    trap '' EXIT
+    test ${#clean_list} -gt 1 && \
+        rm -rf ${clean_list}
+    return 0
+}
 
-# No need to maintain a Makefile.am just to include gnulib.mk.
-mv tests/gnulib.mk tests/Makefile.am
+init() {
+    progpid=$$
+    progdir=`dirname $0`
+    prognam=`basename $0`
+    glibdir=`cd ${progdir} >/dev/null && cd .. && pwd`
 
+    cd ${progdir}
+    PATH=$glibdir:$PATH
 
-# Sanity check the module list for synchronisation issues.
-{
-    sed_noblanks='/^$/d'
-    posix-modules |sed -e "$sed_noblanks" -e 's|$| posix-modules|'
-    gnulib-tool --extract-dependencies libposix \
-        |sed -e "$sed_noblanks" -e 's|$| libposix|'
-} | awk '_[$1] {delete _[$1]; next}
-               {_[$1]=$2}
-         END   {for (k in _)
-                  printf ("bootstrap: warning: `%s'\'' only appears in %s\n", k, _[k])}' \
-  | sort
+    case "X$1" in
+    X--all )
+        set -- --clean --distro
+        ;;
+    esac
 
+    case "X$1" in
+    X--clean* )
+        git clean -f -d -x .
+        shift
+        test $# -eq 0 && exit 0
+        ;;
+    esac
 
-# Run autotools.
-autoreconf --force --install --verbose --symlink
+    trap die EXIT
+    case "X$1" in
+    X--dist* )
+        do_distro=true
+        ;;
+
+    * ) do_distro=false
+        ;;
+    esac
+}
+
+mk_module() {
+    do_or_die mkdir tmp
+    clean_list=tmp
+    do_or_die mkdir tmp/modules
+    (   echo alloca
+        posix-modules
+    ) | sort -u > tmp/posix-list
+
+    posix_list=$(grep -v '^$' tmp/posix-list)
+
+    cat > tmp/modules/libposix <<- _EOF_
+	Description:
+	Wrap up all the posix modules into an installable libposix.la.
+
+	Files:
+
+	Depends-on:
+	${posix_list}
+
+	configure.ac:
+
+	Makefile.am:
+	lib_LTLIBRARIES = libposix.la
+
+	Include:
+
+	License:
+	LGPL
+
+	Maintainer:
+	Bruce Korb
+	Gary V. Vaughan
+	_EOF_
+}
+
+run_glt() {
+    v=$(${glibdir}/build-aux/git-version-gen ./.tarball-version | \
+        sed 's/-dirty/-modified/')
+
+    # AC_USE_SYSTEM_EXTENSIONS
+    # this should be AC_REQUIRED by gnulib modules that need it,
+    # but either a couple of modules have forgotten it, or else
+    # AC_REQUIRE is emitting macro expansions out of order
+    #
+    # AC_CONFIG_MACRO_DIR
+    # we can't use AC_CONFIG_AUX_DIR here, because the heuristics
+    # for finding install-sh in the generated configure script
+    # consider this directory to be a subproject of gnulib proper,
+    # and will only look for install-sh in . and .. :(
+    # AC_CONFIG_AUX_DIR([build-aux])
+    #
+    cat > configure.ac <<- _EOF_
+	AC_INIT([GNU libposix],[${v}],[bug-gnu...@gnu.org])
+	AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])
+	AC_USE_SYSTEM_EXTENSIONS
+	AC_CONFIG_MACRO_DIR([m4])
+	AC_CONFIG_HEADER([config.h])
+	AC_CONFIG_FILES([Makefile lib/Makefile tests/Makefile])
+	AM_INIT_AUTOMAKE([foreign])
+	LT_INIT
+	AC_SUBST([LTV_CURRENT], 0)
+	AC_SUBST([LTV_REVISION], 0)
+	AC_SUBST([LTV_AGE], 0)
+	AC_PROG_CC
+	LIBPOSIX_EARLY
+	AM_PROG_CC_C_O
+	LIBPOSIX_INIT
+	AC_OUTPUT
+	_EOF_
+
+    opts='
+	--local-dir=tmp
+	--import
+	--lib=libposix
+	--makefile-name=gnulib.mk
+	--macro-prefix=LIBPOSIX
+	--libtool
+	--no-changelog
+	--symlink
+	--with-tests
+	--with-c++-tests
+	--with-longrunning-tests'
+
+    do_or_die gnulib-tool ${opts} libposix
+
+    # No need to maintain a Makefile.am just to include gnulib.mk.
+    mv tests/gnulib.mk tests/Makefile.am
+}
+
+run_reconf() {
+    # Run autotools.
+    do_or_die autoreconf --force --install --verbose --symlink
+}
+
+mk_distro() {
+    mkdir _build _install
+    dd=$PWD/_install
+    cd _build
+    do_or_die ../configure --prefix=/usr/local
+    do_or_die make
+    do_or_die make dist
+    do_or_die make install DESTDIR=${dd}
+    do_or_die make check
+}
+
+PS4='>${FUNCNAME:-bs}> ' ; set -x
+
+init ${1+"$@"}
+mk_module
+run_glt
+run_reconf
+${do_distro} && mk_distro
+cleanup
diff --git a/libposix/configure.ac b/libposix/configure.ac
deleted file mode 100644
index c68fa48..0000000
--- a/libposix/configure.ac
+++ /dev/null
@@ -1,35 +0,0 @@
-AC_INIT([GNU libposix],
-        m4_esyscmd([./git-version-gen .tarball-version]),
-        [bug-gnu...@gnu.org])
-
-AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])
-
-dnl this should be AC_REQUIRED by gnulib modules that need it,
-dnl but either a couple of modules have forgotten it, or else
-dnl AC_REQUIRE is emitting macro expansions out of order
-AC_USE_SYSTEM_EXTENSIONS
-
-dnl we can't use AC_CONFIG_AUX_DIR here, because the heuristics
-dnl for finding install-sh in the generated configure script
-dnl consider this directory to be a subproject of gnulib proper,
-dnl and will only look for install-sh in . and .. :(
-dnl AC_CONFIG_AUX_DIR([build-aux])
-
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_HEADER([config.h])
-AC_CONFIG_FILES([Makefile lib/Makefile tests/Makefile])
-
-AM_INIT_AUTOMAKE([foreign])
-LT_INIT
-
-# libtool interface versioning for libposix.la
-AC_SUBST([LTV_CURRENT], 0)
-AC_SUBST([LTV_REVISION], 0)
-AC_SUBST([LTV_AGE], 0)
-
-AC_PROG_CC
-LIBPOSIX_EARLY
-AM_PROG_CC_C_O
-LIBPOSIX_INIT
-
-AC_OUTPUT
diff --git a/modules/libposix b/modules/libposix
deleted file mode 100644
index f43874d..0000000
--- a/modules/libposix
+++ /dev/null
@@ -1,318 +0,0 @@
-Description:
-Wrap up all the posix modules into an installable libposix.la.
-
-Files:
-
-Depends-on:
-_Exit
-accept
-acos
-acosl
-alloca
-alphasort
-arpa_inet
-asin
-asinl
-atan
-atan2
-atanl
-atexit
-atoll
-bind
-btowc
-calloc-posix
-canonicalize-lgpl
-cbrt
-ceil
-ceilf
-ceill
-chown
-close
-connect
-copysign
-cos
-cosh
-cosl
-ctype
-dirent
-dirfd
-dprintf
-dprintf-posix
-dup2
-duplocale
-environ
-erf
-erfc
-errno
-exp
-expl
-extensions
-fabs
-faccessat
-fchdir
-fclose
-fcntl
-fcntl-h
-fdopendir
-fflush
-float
-floor
-floorf
-floorl
-fmod
-fnmatch
-fnmatch-posix
-fopen
-fprintf-posix
-free
-freopen
-frexp
-frexpl
-fseek
-fseeko
-fsync
-ftell
-ftello
-futimens
-getaddrinfo
-getcwd
-getdelim
-getgroups
-gethostname
-getline
-getlogin
-getlogin_r
-getopt-posix
-getpeername
-getsockname
-getsockopt
-getsubopt
-gettimeofday
-glob
-grantpt
-hypot
-iconv
-iconv_open
-iconv_open-utf
-imaxabs
-imaxdiv
-inet_ntop
-inet_pton
-inttypes
-ioctl
-isblank
-isfinite
-isinf
-isnan
-j0
-j1
-jn
-langinfo
-lchown
-ldexp
-ldexpl
-lgamma
-link
-linkat
-listen
-locale
-log
-log10
-log1p
-logb
-logl
-lseek
-lstat
-malloc-posix
-math
-mbrlen
-mbrtowc
-mbsinit
-mbsnrtowcs
-mbsrtowcs
-memchr
-memcmp
-memcpy
-memmove
-memset
-mkdir
-mkdtemp
-mkfifo
-mkfifoat
-mknod
-mkstemp
-mktime
-modf
-nanosleep
-netdb
-netinet_in
-nextafter
-nl_langinfo
-open
-openat
-perror
-poll
-poll-h
-popen
-posix_spawn
-posix_spawn_file_actions_addclose
-posix_spawn_file_actions_adddup2
-posix_spawn_file_actions_addopen
-posix_spawn_file_actions_destroy
-posix_spawn_file_actions_init
-posix_spawnattr_destroy
-posix_spawnattr_getflags
-posix_spawnattr_getpgroup
-posix_spawnattr_getschedparam
-posix_spawnattr_getschedpolicy
-posix_spawnattr_getsigdefault
-posix_spawnattr_getsigmask
-posix_spawnattr_init
-posix_spawnattr_setflags
-posix_spawnattr_setpgroup
-posix_spawnattr_setschedparam
-posix_spawnattr_setschedpolicy
-posix_spawnattr_setsigdefault
-posix_spawnattr_setsigmask
-posix_spawnp
-pow
-pread
-printf-posix
-progname
-ptsname
-pwrite
-raise
-readlink
-readlinkat
-realloc-posix
-recv
-recvfrom
-regex
-remainder
-remove
-rename
-renameat
-rint
-rmdir
-round
-roundf
-roundl
-scandir
-sched
-search
-select
-send
-sendto
-setenv
-setsockopt
-shutdown
-sigaction
-signal
-signbit
-sigpipe
-sigprocmask
-sin
-sinh
-sinl
-sleep
-snprintf
-snprintf-posix
-socket
-spawn
-sprintf-posix
-sqrt
-sqrtl
-stat
-stdarg
-stdbool
-stddef
-stdint
-stdio
-stdlib
-stpcpy
-stpncpy
-strcase
-strcspn
-strdup-posix
-strerror
-string
-strncat
-strndup
-strnlen
-strpbrk
-strptime
-strsignal
-strstr
-strstr-simple
-strtod
-strtoimax
-strtok_r
-strtol
-strtoll
-strtoul
-strtoull
-strtoumax
-symlink
-symlinkat
-sys_select
-sys_socket
-sys_stat
-sys_time
-sys_times
-sys_utsname
-sys_wait
-system-posix
-tan
-tanh
-tanl
-tcgetsid
-termios
-time
-time_r
-times
-tmpfile
-trunc
-truncf
-truncl
-tsearch
-ttyname_r
-tzset
-uname
-unistd
-unlink
-unlockpt
-unsetenv
-utimensat
-vdprintf
-vdprintf-posix
-vfprintf-posix
-vprintf-posix
-vsnprintf
-vsnprintf-posix
-vsprintf-posix
-waitpid
-wchar
-wcrtomb
-wcsnrtombs
-wcsrtombs
-wctob
-wctype
-wcwidth
-write
-y0
-y1
-yn
-
-configure.ac:
-
-Makefile.am:
-lib_LTLIBRARIES = libposix.la
-
-Include:
-
-License:
-LGPL
-
-Maintainer:
-Bruce Korb
-Gary V. Vaughan
-- 
1.7.1

Reply via email to