New method of checking out and configuring gnulib - define which version we need to use, and remember which version we used

This commit is contained in:
James Youngman 2007-02-28 23:57:54 +00:00
parent 43b374a6ce
commit a4b720fa02
16 changed files with 271 additions and 86 deletions

View File

@ -14,3 +14,4 @@ config.sub
config.rpath
config.guess
gnulib
gnulib-cvs

View File

@ -1,3 +1,27 @@
2007-02-28 James Youngman <jay@gnu.org>
* import-gnulib.config: New file. Specifies which version of
Gnulib we need to check out and build from.
* import-gnulib.sh: Use import-gnulib.config.
* README-CVS: Describe the new method of building from CVS.
* lib/gnulib-version.h, lib/gnulib-version.sh: New files; code for
reporting which version of Gnulib we built findutils from.
* lib/Makefile.am: Build gnulib-version.c out of
./gnulib-version.config by using lib/gnulib-version.sh.
* Makefile.am: Ship import-gnulib.config and import-gnulib.sh.
* .cvsignore: Ignore gnulib-cvs
* lib/.cvsignore: Ignore gnulib-version.c
* find/parser.c, locate/code.c, locate/locate.c, xargs/xargs.c:
Report which version of Gnulib we were built from.
2007-02-27 James Youngman <jay@gnu.org>
* import-gnulib.sh, find/defs.h, find/fstype.c, find/tree.c,

View File

@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS=gnits
# readme-alpha
EXTRA_DIST = COPYING ChangeLog TODO install-sh config.h.in stamp-h.in \
THANKS config.rpath
THANKS config.rpath import-gnulib.sh import-gnulib.config
SUBDIRS = gnulib lib find xargs locate doc po m4
ACLOCAL_AMFLAGS = -I gnulib/m4 -I m4
@ -54,3 +54,4 @@ findutils-check-testfiles:
distcount=`ls $(distdir)/*/testsuite/*/*.xe | wc -l` && srccount=`ls $(srcdir)/*/testsuite/*/*.xe | wc -l` && echo source $$srccount distributed $$distcount && test $$distcount -eq $$srccount
@echo ; echo Checking to see if we distributed the full set of .xi files
distcount=`ls $(distdir)/*/testsuite/inputs/*.xi | wc -l` && srccount=`ls $(srcdir)/*/testsuite/inputs/*.xi | wc -l` && echo source $$srccount distributed $$distcount && test $$distcount -eq $$srccount

8
NEWS
View File

@ -1,5 +1,13 @@
GNU findutils NEWS - User visible changes. -*- outline -*- (allout)*
* Major changes in release 4.2.31-CVS
Findutils has switched to a new way of building the code from gnulib.
There should be no functional difference; the change should not be
visible to those using the findutils binaries, except for changes to
the output of "find --version", which should now show the version of
Gnulib which was used.
* Major changes in release 4.2.30
** Bug Fixes

View File

@ -5,34 +5,35 @@ checked out of CVS, rather than from a released source distribution.
* CVS
* A C compiler, linker and software development libraries (the standard
C library)
* GNU Autoconf version 2.57 or later (earlier versions *may* work)
* GNU Automake version 1.7 or later (earlier versions *may* work)
* GNU Autoconf version 2.61 or later (earlier versions *may* work)
* GNU Automake version 1.9 or later (earlier versions *may* work)
* GNU m4 version 1.4 or later
* GNU gettext (unless you use configure --disable-nls)
2. Obtain a copy of Gnulib
To obtain a copy of the gnulib library, check it out via anonymous CVS
from the GNU CVS server. Make sure you check it out into a separate
directory, away from the findutils sources.
CVS_RSH=ssh
export CVS_RSH
cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/gnulib co gnulib
3. Generate a gnulib installation within the fileutils source tree
2. Generate a gnulib installation within the fileutils source tree
Change your working directory to the findutils source directory (that
is, the directory containing this file). Then run the following
command:-
sh import-gnulib.sh <name of the directory containing gnulib>
sh import-gnulib.sh
4. Generate the configure scripts and Makefile.in files.
This command will use CVS to check out the version of gnulib which is
intended to work with the findutils source you already have, as
configured by the file import-gnulib.config. The gnulib code itself
is left in the directory "gnulib-cvs". The "gnulib" directory
contains just the gnulib files that findutils needs during the build
process.
autoreconf -i
If you want to build findutils with a different version of gnulib,
just edit import-gnulib.config to change the version and then re-run
import-gnulib.sh. When specifying the version, you can specify
either the date or a CVS tag. If making any kind of release, please
use a fully identifying version (rather than just, say, "HEAD").
... or use the alternative method ...
The import-gnulib.sh script will also run Autoconf and Automake to
generate the "configure" script and "Makefile.in" files. Should you
need to do this manually, you can do it like this :-
aclocal -I m4 -I gnulib/m4 && \
autoheader && \
@ -40,6 +41,8 @@ checked out of CVS, rather than from a released source distribution.
automake --add-missing --copy
5. Run "configure" and "make" in the normal way. If you have GNU
libintl installed, you can just run "configure". Otherwise, run
"configure --disable-nls".
3. Run "configure" and "make" in the normal way.
If you have GNU libintl installed, you can just run "configure".
Otherwise, run "configure --disable-nls".

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([GNU findutils], 4.2.30, [bug-findutils@gnu.org])
AC_INIT([GNU findutils], 4.2.31-CVS, [bug-findutils@gnu.org])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([find/pred.c])

View File

@ -34,6 +34,7 @@
#include "nextelem.h"
#include "stdio-safer.h"
#include "regextype.h"
#include "gnulib-version.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@ -1687,6 +1688,7 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr)
fflush (stderr);
printf (_("GNU find version %s\n"), version_string);
printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
printf (_("Features enabled: "));
#if CACHE_IDS

40
import-gnulib.config Normal file
View File

@ -0,0 +1,40 @@
# What version of gnulib to use?
# To late: gnulib_version="2005-07-30"
# ?Too early gnulib_version="2005-07-10"
gnulib_version="2005-07-26"
# 4.2.29: At or after 2005-07-11 12:21:55 +0100 (lib/getcwd.h)
# 4.2.29: At or after 2005-07-11 12:21:55 +0100 (lib/time_r.h)
# 4.2.29: At or after 2005-07-15 22:01:41 +0100 (lib/quotearg.c)
# 4.2.29: At or after 2005-07-26 22:55:31 +0100 (m4/getopt.m4)
# 4.2.29: Before 2005-09-19 18:28:14 +0100 (lib/quotearg.c)
# 4.2.29: Before 2006-03-12 07:58:12 +0000 (lib/time_r.h)
destdir="gnulib"
# Random extra gnulib files needed for findutils.
extra_files='
build-aux/config.guess
build-aux/config.rpath
build-aux/config.sub
build-aux/depcomp
build-aux/install-sh
build-aux/mdate-sh
build-aux/missing
build-aux/texinfo.tex
'
# Modules needed for findutils.
# We need regex to ensure that we can build on platforms like
# Solaris which lack those functions.
modules="\
alloca argmatch dirname error fileblocks fnmatch-gnu \
getline getopt human idcache lstat malloc memcmp memset mktime \
modechange pathmax quotearg realloc regex rpmatch savedir stat stdio-safer \
stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \
getline stpcpy canonicalize mountlist closeout gettext stat-macros"

View File

@ -1,7 +1,7 @@
#! /bin/sh
#
# import-gnulib.sh -- imports a copy of gnulib into findutils
# Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.
# Copyright (C) 2003,2004,2005,2006 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
@ -20,53 +20,79 @@
#
##########################################################################
#
# This script is intended to populate the "gnulib" directory
# This script is intended to populate the "gnulib" directory
# with a subset of the gnulib code, as provided by "gnulib-tool".
#
# To use it, run this script, speficying the location of the
# gnulib code as the only argument. Some sanity-checking is done
# To use it, run this script, speficying the location of the
# gnulib code as the only argument. Some sanity-checking is done
# before we commit to modifying things. The gnulib code is placed
# in the "gnulib" subdirectory, which is where the buid files expect
# it to be.
#
# in the "gnulib" subdirectory, which is where the buid files expect
# it to be.
#
# If CDPATH is set, it will sometimes print the name of the directory
# to which you have moved. Unsetting CDPATH prevents this, as does
# If CDPATH is set, it will sometimes print the name of the directory
# to which you have moved. Unsetting CDPATH prevents this, as does
# prefixing it with ".".
unset CDPATH
configfile="./import-gnulib.config"
cvsdir="gnulib-cvs"
destdir="gnulib"
source $configfile
# Modules needed for findutils itself.
findutils_modules="\
alloca argmatch dirname error fileblocks fnmatch-gnu \
getline getopt human idcache lstat malloc memcmp memset mktime \
modechange pathmax quotearg realloc regex rpmatch savedir stat stdio-safer \
stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \
getline stpcpy canonicalize mountlist closeout gettext stat-macros"
# We need regex to ensure that we can build on platforms like
# Solaris which lack those functions.
modules="$findutils_modules $intl_modules"
export modules
if test $# -lt 1
if [ -z "$gnulib_version" ]
then
echo "You need to specify the name of the directory containing gnulib" >&2
echo "Error: There should be a gnulib_version setting in $configfile, but there is not." >&2
exit 1
fi
if test -d "$1"
then
true
if ! [ -d "$cvsdir" ] ; then
if mkdir "$cvsdir" ; then
echo "Created $cvsdir"
else
echo "Failed to create $cvsdir" >&2
exit 1
fi
fi
# Decide if gnulib_version is probably a date or probably a tag.
if date -d yesterday >/dev/null ; then
# It looks like GNU date is available
if date -d "$gnulib_version" >/dev/null ; then
# Looks like a date.
cvs_sticky_option="-D"
else
echo "Warning: assuming $gnulib_version is a CVS tag rather than a date" >&2
cvs_sticky_option="-r"
fi
else
echo "$1 is not a directory" >&2
exit 1
# GNU date unavailable, assume the version is a date
cvs_sticky_option="-D"
fi
(
# Change directory unconditionally (rater than using checkout -d) so that
# cvs does not pick up defaults from ./CVS. Those defaults refer to our
# own CVS repository for our code, not to gnulib.
cd $cvsdir
if test -d gnulib/CVS ; then
cd gnulib
cmd=update
root="" # use previous
else
root="-d :pserver:anonymous@cvs.sv.gnu.org:/sources/gnulib"
cmd=checkout
args=gnulib
fi
set -x
cvs -q -z3 $root $cmd $cvs_sticky_option "$gnulib_version" $args
set +x
)
set x $cvsdir/gnulib ; shift
if test -f "$1"/gnulib-tool
then
true
@ -83,17 +109,15 @@ else
exit 1
fi
# exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
if [ -d gnulib ]
then
echo "Warning: directory gnulib already exists." >&2
else
mkdir gnulib
echo "Warning: directory gnulib already exists, removing it." >&2
rm -rf gnulib
fi
mkdir gnulib
printf "Running gnulib-tool..."
if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
then
: OK
@ -101,6 +125,19 @@ else
echo "gnulib-tool failed, exiting." >&2
exit 1
fi
echo done
## for file in $extra_files; do
## bn="$(basename $file)"
## case "$file" in
## */mdate-sh | */texinfo.tex) dest=doc; destfile=doc/"$bn";;
## *) dest=.; destfile="$bn";;
## esac
## cmp "$file" "$destfile" || cp -fpv "$1"/"$file" "$dest" || exit 1
## done
@ -119,21 +156,9 @@ SUBDIRS = lib
EOF
## (
## cat <<EOF
## # Copyright (C) 2004 Free Software Foundation, Inc.
## #
## # This file is free software, distributed under the terms of the GNU
## # General Public License. As a special exception to the GNU General
## # Public License, this file may be distributed as part of a program
## # that contains a configuration script generated by Automake, under
## # the same distribution terms as the rest of that program.
## #
## # This file was generated by $0 $@.
## #
## EOF
## printf "%s" "EXTRA_DIST = "
## cd ./gnulib/m4
## ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
## echo
## ) > gnulib/m4/Makefile.am
# Now regenerate things...
aclocal -I m4 -I gnulib/m4 &&
autoheader &&
autoconf &&
automake --add-missing --copy &&
echo Done.

View File

@ -1,2 +1,3 @@
Makefile
Makefile.in
gnulib-version.c

View File

@ -13,15 +13,16 @@ noinst_PROGRAMS = regexprops
regexprops_SOURCES = regexprops.c regextype.c
endif
libfind_a_SOURCES =
EXTRA_DIST = modetype.h wait.h extendbuf.h savedirinfo.h buildcmd.h
BUILT_SOURCES =
libfind_a_SOURCES = gnulib-version.c
EXTRA_DIST = modetype.h wait.h extendbuf.h savedirinfo.h buildcmd.h \
gnulib-version.h gnulib-version.sh gnulib-version.c
BUILT_SOURCES = gnulib-version.c
SUFFIXES =
MOSTLYCLEANFILES =
CLEANFILES =
MOSTLYCLEANFILES =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
IMPORT_GNULIB_CONFIG = $(top_srcdir)/import-gnulib.config
INCLUDES = -I../gnulib/lib -I$(top_srcdir)/gnulib/lib
LDADD = ../gnulib/lib/libgnulib.a @INTLLIBS@
@ -38,3 +39,6 @@ libfind_a_DEPENDENCIES = @FINDLIBOBJS@
# libfind_a_OBJECTS += @FINDLIBOBJS@
# libfind_la_OBJECTS += @LTFINDLIBOBJS@
$(srcdir)/gnulib-version.c: $(srcdir)/gnulib-version.sh $(IMPORT_GNULIB_CONFIG)
sh $(srcdir)/gnulib-version.sh $(top_srcdir) $(srcdir) $(IMPORT_GNULIB_CONFIG)

21
lib/gnulib-version.h Normal file
View File

@ -0,0 +1,21 @@
/* gnulib-version.h
Copyright (C) 2007 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 2, 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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
*/
extern const char * const gnulib_version;

50
lib/gnulib-version.sh Normal file
View File

@ -0,0 +1,50 @@
#! /bin/sh
#
# gnulib-version.sh -- creates gnulib-version.c (from ../import-gnulib.config)
# Copyright (C) 2007 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 2, 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
topsrcdir="$1"
srcdir="$2"
configfile="$3"
outfile="${srcdir}"/gnulib-version.c
source $configfile
if [ -z "$gnulib_version" ]
then
echo "Error: There should be a gnulib_version setting in $configfile, but there is not." >&2
exit 1
fi
cat > "${outfile}".new <<EOF
/* This file is automatically generated by $0 and simply records which version of gnulib we used. */
const char * const gnulib_version = "$gnulib_version";
EOF
if test -f "$outfile" ; then
if diff "${outfile}".new "${outfile}" > /dev/null
then
# nothing to do
rm "${outfile}".new
exit 0
fi
fi
mv "${outfile}".new "${outfile}"

View File

@ -77,6 +77,7 @@
#include "locatedb.h"
#include <getline.h>
#include "closeout.h"
#include "gnulib-version.h"
char *xmalloc PARAMS((size_t));
@ -163,6 +164,7 @@ main (int argc, char **argv)
else if (0 == strcmp(argv[1], "--version"))
{
printf (_("GNU findutils version %s\n"), version_string);
printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
return 0;
}

View File

@ -135,7 +135,7 @@ extern int errno;
#include "quotearg.h"
#include "printquoted.h"
#include "regextype.h"
#include "gnulib-version.h"
/* Note that this evaluates C many times. */
#ifdef _LIBC
@ -1229,6 +1229,7 @@ main (int argc, char **argv)
case 'v':
printf (_("GNU locate version %s\n"), version_string);
printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
return 0;
case 'w':

View File

@ -168,6 +168,7 @@ typedef int boolean;
#include <xalloc.h>
#include "closeout.h"
#include "gnulib-version.h"
void error PARAMS ((int status, int errnum, char *message,...));
@ -572,6 +573,7 @@ main (int argc, char **argv)
case 'v':
printf (_("GNU xargs version %s\n"), version_string);
printf (_("Built using GNU gnulib version %s\n"), gnulib_version);
return 0;
default: