Distribute the .xe files also.
[findutils.git] / import-gnulib.sh
blob3f31abf70651f0d3c31ebee0dfa548de01419d89
1 #! /bin/sh
3 # import-gnulib.sh -- imports a copy of gnulib into findutils
4 # Copyright (C) 2003,2004 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)
9 # any later version.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 # USA.
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
30 # it to be.
33 destdir="gnulib"
36 # Modules needed for findutils itself.
37 findutils_modules="\
38 alloca argmatch dirname error fileblocks fnmatch-gnu \
39 getline getopt human idcache lstat malloc memcmp memset mktime \
40 modechange pathmax quotearg realloc regex rpmatch savedir stat \
41 stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
42 xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \
43 getline stpcpy canonicalize mountlist closeout gettext"
45 # We need regex to ensure that we can build on platforms like
46 # Solaris which lack those functions.
48 modules="$findutils_modules $intl_modules"
49 export modules
51 if test $# -lt 1
52 then
53 echo "You need to specify the name of the directory containing gnulib" >&2
54 exit 1
57 if test -d "$1"
58 then
59 true
60 else
61 echo "$1 is not a directory" >&2
62 exit 1
65 if test -f "$1"/gnulib-tool
66 then
67 true
68 else
69 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
70 exit 1
73 if test -x "$1"/gnulib-tool
74 then
75 true
76 else
77 echo "$1/gnulib-tool is not executable" >&2
78 exit 1
82 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
84 if [ -d gnulib ]
85 then
86 echo "Warning: directory gnulib already exists." >&2
87 else
88 mkdir gnulib
92 if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
93 then
94 : OK
95 else
96 echo "gnulib-tool failed, exiting." >&2
97 exit 1
102 cat > gnulib/Makefile.am <<EOF
103 # Copyright (C) 2004 Free Software Foundation, Inc.
105 # This file is free software, distributed under the terms of the GNU
106 # General Public License. As a special exception to the GNU General
107 # Public License, this file may be distributed as part of a program
108 # that contains a configuration script generated by Automake, under
109 # the same distribution terms as the rest of that program.
111 # This file was generated by $0 $@.
113 SUBDIRS = lib m4
117 cat <<EOF
118 # Copyright (C) 2004 Free Software Foundation, Inc.
120 # This file is free software, distributed under the terms of the GNU
121 # General Public License. As a special exception to the GNU General
122 # Public License, this file may be distributed as part of a program
123 # that contains a configuration script generated by Automake, under
124 # the same distribution terms as the rest of that program.
126 # This file was generated by $0 $@.
129 printf "%s" "EXTRA_DIST = "
130 cd gnulib/m4
131 ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
132 echo
133 ) > gnulib/m4/Makefile.am
137 # We also need config.rpath, because configure calls it, but for
138 # some reason, "autoreconf -i" doesn't fetch it.
139 for f in config.rpath
141 (set -x; cp "$1"/config/"$f" . )
142 done