-2010-11-16 Bruce Korb <bkorb@gnu.org>
+2010-11-17 Bruce Korb <bkorb@gnu.org>
+
+ * libposix/mk-tarball: script to make a libposix distribution
+ tarball.
+ * libposix/bootstrap: cleanup and ensure the mkdir's are invoked
+ only when needed.
+ * libposix/configure.ac (m4_esyscmd): fix git version suffix
+ * libposix/lib/Makefile.am (HEADERS): include version info
+
+2010-11-17 Bruce Korb <bkorb@gnu.org>
* tests/test-dprintf-posix2.c (main): call malloc & free before
setrlimit under Linux. Avoid setrlimit/malloc interaction bug.
PATH=..:$PATH
-mkdir tmp
-mkdir tmp/modules
-
- { echo alloca
- posix-modules
- } | sort -u > tmp/posix-list
-
- posix_list=$(grep -v '^$' tmp/posix-list)
-
- cat > tmp/modules/libposix <<- _EOF_
+if test -d tmp
+then
+ if test -d tmp/modules
+ then rm -f tmp/modules/* >/dev/null 2>&1
+ else mkdir tmp/modules
+ fi
+else
+ mkdir tmp tmp/modules
+fi
+
+{ 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.
--- /dev/null
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+
+# Copyright (C) 2002-2010 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/>.
+
+case "$0" in
+*/* ) progdir=`echo "$0" | sed 's@/[^/]*$@@'`
+ cd ${progdir}
+ progdir=`pwd`
+ prognam=`echo "$0" | sed 's@.*/@@'`
+ ;;
+
+* ) progdir=`pwd`
+ prognam="$0"
+ ;;
+esac
+
+# kill the patriarch process. If we are not the patriarch,
+# then exit 1 too.
+#
+func_die()
+{
+ echo "${prognam} failure: $*" >&2
+ kill -${SIGTERM} ${progpid}
+ exit 1
+}
+
+func_init()
+{
+ progpid=$$
+ glibdir=`cd .. >/dev/null ; pwd`
+ SIGTERM=15
+
+ git --version >/dev/null 2>&1 \
+ || func_die "git is not operational"
+
+ case "$*" in
+ *'--clean'* )
+ git clean -f -x -d .
+ ;;
+ esac
+}
+
+func_mkver()
+{
+ {
+ echo '/*'
+ sed '1,/^$/d;s/^#/ */;/http:\/\/www\.gnu\.org/q' ${prognam}
+ echo ' */'
+
+ gv=`../build-aux/git-version-gen .tarball-version | \
+ sed 's/-dirty/-modified/'`
+ sedcmd='/^2[01][0-9][0-9]-[0-1][0-9]-[0-3][0-9] /{
+ s/ .*//
+ s/-/./gp
+ q
+ }'
+ dv=`sed -n "${sedcmd}" ${glibdir}/ChangeLog`
+ cat <<-_EOF_
+ #ifndef LIBPOSIX_GIT_VERSION
+ #define LIBPOSIX_GIT_VERSION "$gv"
+ #define LIBPOSIX_VERSION "$dv"
+
+ extern char const libposix_git_version[];
+ extern char const libposix_version[];
+ #endif /* LIBPOSIX_GIT_VERSION */
+ _EOF_
+ } > lib/version.h
+
+ {
+ sed -n '1,/^ \*\/$/p' lib/version.h
+
+ cat <<-_EOF_
+ #include "version.h"
+
+ char const libposix_git_version[] = LIBPOSIX_GIT_VERSION;
+ char const libposix_version[] = LIBPOSIX_VERSION;
+ _EOF_
+
+ } > lib/version.c
+}
+
+func_bootstrap()
+{
+ /bin/sh ./bootstrap \
+ || func_die bootstrap failure
+}
+
+func_mkdistro()
+{
+ mkdir _b || die mkdir _b
+ cd _b
+ ../configure || die configure
+ make || die make
+ make distcheck || die make distcheck
+ mv libposix*.tar.gz .. || die cannot move tarball
+}
+
+func_init ${1+"$@"}
+func_mkver
+func_bootstrap
+func_mkdistro
+
+: