1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#! /bin/sh
#
# import-gnulib.sh -- imports a copy of gnulib into findutils
# Copyright (C) 2003,2004,2005 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.
#
##########################################################################
#
# 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
# 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.
#
# 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
destdir="gnulib"
# 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
then
echo "You need to specify the name of the directory containing gnulib" >&2
exit 1
fi
if test -d "$1"
then
true
else
echo "$1 is not a directory" >&2
exit 1
fi
if test -f "$1"/gnulib-tool
then
true
else
echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
exit 1
fi
if test -x "$1"/gnulib-tool
then
true
else
echo "$1/gnulib-tool is not executable" >&2
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
fi
if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
then
: OK
else
echo "gnulib-tool failed, exiting." >&2
exit 1
fi
cat > gnulib/Makefile.am <<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 $@.
#
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
|