Below are two patches. The first probably ought to be applied to the main branch and someone should go tell glibc about it. Personally, I don't want to deal with Mr. Glibc.
The libposix project now installs the following files on my x86-64 openSuSE 11.3 platform: $ find * -type f usr/local/lib/libposix.a usr/local/lib/libposix.so.0.0.0 usr/local/lib/libposix.la usr/local/include/libposix/dirent.h usr/local/include/libposix/version.h usr/local/include/libposix/langinfo.h usr/local/include/libposix/netdb.h usr/local/include/libposix/sys/socket.h usr/local/include/libposix/sys/ioctl.h usr/local/include/libposix/sys/select.h usr/local/include/libposix/sys/wait.h usr/local/include/libposix/sys/times.h usr/local/include/libposix/sys/time.h usr/local/include/libposix/sys/utsname.h usr/local/include/libposix/sys/stat.h usr/local/include/libposix/c++defs.h usr/local/include/libposix/iconv_open-osf.h usr/local/include/libposix/poll.h usr/local/include/libposix/arg-nonnull.h usr/local/include/libposix/string.h usr/local/include/libposix/inttypes.h usr/local/include/libposix/iconv_open-solaris.h usr/local/include/libposix/alloca.h usr/local/include/libposix/math.h usr/local/include/libposix/arpa/inet.h usr/local/include/libposix/warn-on-use.h usr/local/include/libposix/glob.h usr/local/include/libposix/strings.h usr/local/include/libposix/unitypes.h usr/local/include/libposix/iconv.h usr/local/include/libposix/wctype.h usr/local/include/libposix/stdlib.h usr/local/include/libposix/time.h usr/local/include/libposix/iconv_open-irix.h usr/local/include/libposix/signal.h usr/local/include/libposix/ctype.h usr/local/include/libposix/spawn.h usr/local/include/libposix/fcntl.h usr/local/include/libposix/locale.h usr/local/include/libposix/iconv_open-aix.h usr/local/include/libposix/search.h usr/local/include/libposix/unused-parameter.h usr/local/include/libposix/termios.h usr/local/include/libposix/unistd.h usr/local/include/libposix/wchar.h usr/local/include/libposix/iconv_open-hpux.h usr/local/include/libposix/stdio.h usr/local/libexec/libposix/pt_chown There is still some work to do. >From cdbc611a5ef23702ae7478fe099d8b6dde4e817e Mon Sep 17 00:00:00 2001 From: Bruce Korb <bk...@gnu.org> Date: Wed, 17 Nov 2010 12:57:10 -0800 Subject: [PATCH 1/2] Do an early malloc/free under Linux to bypass setrlimit bug --- ChangeLog | 6 ++++++ tests/test-dprintf-posix2.c | 2 ++ tests/test-fprintf-posix3.c | 2 ++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47d9c85..1a26057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-11-16 Bruce Korb <bk...@gnu.org> + * tests/test-dprintf-posix2.c (main): call malloc & free before + setrlimit under Linux. Avoid setrlimit/malloc interaction bug. + * tests/test-fprintf-posix3.c: ditto + +2010-11-16 Bruce Korb <bk...@gnu.org> + * libposix/bootstrap: generate libposix module file on the fly. * modules/libposix: remove * modules/*: Use pkginclude_HEADERS instead of plain "include". diff --git a/tests/test-dprintf-posix2.c b/tests/test-dprintf-posix2.c index fd54070..2e1afe6 100644 --- a/tests/test-dprintf-posix2.c +++ b/tests/test-dprintf-posix2.c @@ -64,6 +64,8 @@ main (int argc, char *argv[]) #endif /* On Linux systems, malloc() is limited by RLIMIT_AS. */ #ifdef RLIMIT_AS + free (malloc (0x88)); + if (getrlimit (RLIMIT_AS, &limit) < 0) return 77; if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > MAX_ALLOC_TOTAL) diff --git a/tests/test-fprintf-posix3.c b/tests/test-fprintf-posix3.c index 6c0d5f2..d590a91 100644 --- a/tests/test-fprintf-posix3.c +++ b/tests/test-fprintf-posix3.c @@ -63,6 +63,8 @@ main (int argc, char *argv[]) #endif /* On Linux systems, malloc() is limited by RLIMIT_AS. */ #ifdef RLIMIT_AS + free (malloc (0x88)); + if (getrlimit (RLIMIT_AS, &limit) < 0) return 77; if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > MAX_ALLOC_TOTAL) -- 1.7.1 >From e3a220aadc8abc56c5987a98cd52d8987af91bd1 Mon Sep 17 00:00:00 2001 From: Bruce Korb <bk...@gnu.org> Date: Wed, 17 Nov 2010 13:02:52 -0800 Subject: [PATCH 2/2] add script to make libposix distribution --- .gitignore | 1 + ChangeLog | 11 ++++- libposix/.gitignore | 8 +-- libposix/bootstrap | 27 +++++++---- libposix/configure.ac | 5 +- libposix/lib/Makefile.am | 2 + libposix/mk-tarball | 117 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 153 insertions(+), 18 deletions(-) create mode 100755 libposix/mk-tarball 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/ChangeLog b/ChangeLog index 1a26057..ea219fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -2010-11-16 Bruce Korb <bk...@gnu.org> +2010-11-17 Bruce Korb <bk...@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 <bk...@gnu.org> * 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 index 404d178..871206d 100644 --- a/libposix/.gitignore +++ b/libposix/.gitignore @@ -39,12 +39,10 @@ ltmain.sh /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 index 10c37a9..4bce30f 100755 --- a/libposix/bootstrap +++ b/libposix/bootstrap @@ -2,16 +2,23 @@ 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. diff --git a/libposix/configure.ac b/libposix/configure.ac index c68fa48..455b857 100644 --- a/libposix/configure.ac +++ b/libposix/configure.ac @@ -1,6 +1,7 @@ AC_INIT([GNU libposix], - m4_esyscmd([./git-version-gen .tarball-version]), - [bug-gnu...@gnu.org]) + m4_esyscmd([./git-version-gen .tarball-version | \ + sed 's/-dirty/-modified/']), + [bug-gnu...@gnu.org]) AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION]) diff --git a/libposix/lib/Makefile.am b/libposix/lib/Makefile.am index 0a31f4e..3a7621b 100644 --- a/libposix/lib/Makefile.am +++ b/libposix/lib/Makefile.am @@ -5,6 +5,7 @@ EXTRA_DIST = EXTRA_HEADERS = nodist_pkginclude_HEADERS = nobase_nodist_pkginclude_HEADERS = +pkginclude_HEADERS = version.h CLEANFILES = MOSTLYCLEANDIRS = @@ -14,3 +15,4 @@ MAINTAINERCLEANFILES = 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 index 0000000..ed724a4 --- /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 <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 + +: -- 1.7.1