# HG changeset patch # User Bruce Korb # Date 1290027772 28800 # Node ID aa63a2324d1570ead9c857b84047567239804019 # Parent bd4da34974de1247a03029ddff3105eef340faa5 add script to make libposix distribution diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ allsnippets.tmp amsnippet.tmp testdir* +*.diff diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -2010-11-16 Bruce Korb +2010-11-17 Bruce Korb + + * 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 * tests/test-dprintf-posix2.c (main): call malloc & free before setrlimit under Linux. Avoid setrlimit/malloc interaction bug. diff --git a/libposix/.gitignore b/libposix/.gitignore --- a/libposix/.gitignore +++ b/libposix/.gitignore @@ -39,12 +39,10 @@ /m4 missing stamp-h1 -/tests/*.c -/tests/*.h -/tests/*.mk -/tests/*.sh -/tests/test-* unused-parameter.h warn-on-use.h /tests /tmp +_b* +_i* +/libposix*.tar.* diff --git a/libposix/bootstrap b/libposix/bootstrap --- a/libposix/bootstrap +++ b/libposix/bootstrap @@ -2,16 +2,23 @@ PATH=..:$PATH -mkdir tmp -mkdir tmp/modules +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 +{ echo alloca + posix-modules +} | sort -u > tmp/posix-list - posix_list=$(grep -v '^$' tmp/posix-list) +posix_list=`grep -v '^$' tmp/posix-list` - cat > tmp/modules/libposix <<- _EOF_ +cat > tmp/modules/libposix <<- _EOF_ Description: Wrap up all the posix modules into an installable libposix.la. diff --git a/libposix/configure.ac b/libposix/configure.ac --- a/libposix/configure.ac +++ b/libposix/configure.ac @@ -1,6 +1,7 @@ AC_INIT([GNU libposix], - m4_esyscmd([./git-version-gen .tarball-version]), - [bug-gnulib@gnu.org]) + m4_esyscmd([./git-version-gen .tarball-version | \ + sed 's/-dirty/-modified/']), + [bug-gnulib@gnu.org]) AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION]) diff --git a/libposix/lib/Makefile.am b/libposix/lib/Makefile.am --- a/libposix/lib/Makefile.am +++ b/libposix/lib/Makefile.am @@ -5,6 +5,7 @@ EXTRA_HEADERS = nodist_pkginclude_HEADERS = nobase_nodist_pkginclude_HEADERS = +pkginclude_HEADERS = version.h CLEANFILES = MOSTLYCLEANDIRS = @@ -14,3 +15,4 @@ include gnulib.mk libposix_la_LDFLAGS += -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) +libposix_la_SOURCES += version.c diff --git a/libposix/mk-tarball b/libposix/mk-tarball new file mode 100755 --- /dev/null +++ b/libposix/mk-tarball @@ -0,0 +1,117 @@ +#! /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 . + +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 + +: