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 ".".
37 configfile
="./import-gnulib.config"
40 tool
="${cvsdir}"/gnulib
/gnulib-tool
44 if [ -z "$gnulib_version" ]
46 echo "Error: There should be a gnulib_version setting in $configfile, but there is not." >&2
51 if ! [ -d "$cvsdir" ] ; then
52 if mkdir
"$cvsdir" ; then
53 echo "Created $cvsdir"
55 echo "Failed to create $cvsdir" >&2
60 # Decide if gnulib_version is probably a date or probably a tag.
61 if date -d yesterday
>/dev
/null
; then
62 # It looks like GNU date is available
63 if date -d "$gnulib_version" >/dev
/null
; then
65 cvs_sticky_option
="-D"
67 echo "Warning: assuming $gnulib_version is a CVS tag rather than a date" >&2
68 cvs_sticky_option
="-r"
71 # GNU date unavailable, assume the version is a date
72 cvs_sticky_option
="-D"
78 # Change directory unconditionally (rater than using checkout -d) so that
79 # cvs does not pick up defaults from ./CVS. Those defaults refer to our
80 # own CVS repository for our code, not to gnulib.
82 if test -d gnulib
/CVS
; then
85 root
="" # use previous
87 root
="-d :pserver:anonymous@cvs.sv.gnu.org:/sources/gnulib"
92 cvs
-q -z3 $root $cmd $cvs_sticky_option "$gnulib_version" $args
100 echo "$tool does not exist, did you specify the right directory?" >&2
108 echo "$tool is not executable" >&2
115 echo "Warning: directory gnulib already exists, removing it." >&2
121 if "$tool" --import --symlink --with-tests --dir=.
--lib=libgnulib
--source-base=gnulib
/lib
--m4-base=gnulib
/m4 $modules
125 echo "$tool failed, exiting." >&2
130 for file in $extra_files; do
132 */mdate-sh |
*/texinfo.tex
) dest
=doc
;;
135 cp -fp "${cvsdir}"/gnulib
/"$file" "$dest" ||
exit
141 cat > gnulib
/Makefile.am
<<EOF
142 # Copyright (C) 2004 Free Software Foundation, Inc.
144 # This file is free software, distributed under the terms of the GNU
145 # General Public License. As a special exception to the GNU General
146 # Public License, this file may be distributed as part of a program
147 # that contains a configuration script generated by Automake, under
148 # the same distribution terms as the rest of that program.
150 # This file was generated by $0 $@.
156 # Now regenerate things...
157 aclocal
-I m4 -I gnulib
/m4 &&
160 automake
--add-missing --copy &&