3 # import-gnulib.sh -- imports a copy of gnulib into findutils
4 # Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 ##########################################################################
23 # This script is intended to populate the "gnulib" directory
24 # with a subset of the gnulib code, as provided by "gnulib-tool".
26 # To use it, run this script, speficying the location of the
27 # gnulib code as the only argument. Some sanity-checking is done
28 # before we commit to modifying things. The gnulib code is placed
29 # in the "gnulib" subdirectory, which is where the buid files expect
33 # If CDPATH is set, it will sometimes print the name of the directory
34 # to which you have moved. Unsetting CDPATH prevents this, as does
35 # prefixing it with ".".
41 # Random extra gnulib files needed for findutils.
42 # The source path is relative to gnulib, the destination to .
44 build-aux/config.guess
45 build-aux/config.rpath
54 # Modules needed for findutils.
56 alloca argmatch dirname error fileblocks fnmatch-gnu fopen-safer fts \
57 getline getopt human idcache lstat malloc memcmp memset mktime \
58 modechange pathmax quotearg realloc regex rpmatch savedir \
59 stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
60 xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno human filemode \
61 getline stpcpy canonicalize mountlist closeout gettext stat-macros"
63 # We need regex to ensure that we can build on platforms like
64 # Solaris which lack those functions.
66 modules
="$findutils_modules"
71 echo "You need to specify the name of the directory containing gnulib" >&2
79 echo "$1 is not a directory" >&2
83 if test -f "$1"/gnulib-tool
87 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
91 if test -x "$1"/gnulib-tool
95 echo "$1/gnulib-tool is not executable" >&2
100 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
104 echo "Warning: directory gnulib already exists." >&2
110 if "$1"/gnulib-tool
--import --dir=.
--lib=libgnulib
--source-base=gnulib
/lib
--m4-base=gnulib
/m4 $modules
114 echo "gnulib-tool failed, exiting." >&2
119 for file in $findutils_files; do
121 */mdate-sh |
*/texinfo.tex
) dest
=doc
;;
124 cp -fp "$1"/$file $dest ||
exit
129 cat > gnulib
/Makefile.am
<<EOF
130 # Copyright (C) 2004 Free Software Foundation, Inc.
132 # This file is free software, distributed under the terms of the GNU
133 # General Public License. As a special exception to the GNU General
134 # Public License, this file may be distributed as part of a program
135 # that contains a configuration script generated by Automake, under
136 # the same distribution terms as the rest of that program.
138 # This file was generated by $0 $@.
146 ## # Copyright (C) 2004 Free Software Foundation, Inc.
148 ## # This file is free software, distributed under the terms of the GNU
149 ## # General Public License. As a special exception to the GNU General
150 ## # Public License, this file may be distributed as part of a program
151 ## # that contains a configuration script generated by Automake, under
152 ## # the same distribution terms as the rest of that program.
154 ## # This file was generated by $0 $@.
157 ## printf "%s" "EXTRA_DIST = "
159 ## ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
161 ## ) > gnulib/m4/Makefile.am