Imported Upstream version 3.2.0
[debian/amanda] / gnulib / regenerate / regenerate
1 #! /bin/bash
2
3 # Gnulib files in zmanda repo are from gnulib GIT.  To check out the
4 # same version as was used to generate the source in the repository,
5 # run the following in your git repository:
6 #
7 #   git checkout 09b8fa6cb737f6e091931c494cbd56d12b3ad08d
8
9 # get to the project root
10 cd `dirname $0`/../..
11 if [ ! -f configure.in ]
12 then
13     echo "Cannot navigate to project root"
14     exit 1
15 fi
16
17 # check that gnulib-tool is available before we do anything drastic
18 [ -z "${GNULIB_TOOL}" ] && GNULIB_TOOL=gnulib-tool
19 "${GNULIB_TOOL}" --version >/dev/null 2>/dev/null
20 if [ "$?" != 0 ]
21 then
22     echo "gnulib-tool not found; try using"
23     echo "  GNULIB_TOOL=/path/to/gnulib-tool ${0} ${@}"
24     exit 1
25 fi
26
27 # remove the files in gnulib and config/gnulib, but not directories
28 # (and, in particular, not the gnulib/regenerate directory)
29 shopt -s nullglob
30 for filename in gnulib/* config/gnulib/*
31 do
32     [ -d "${filename}" ] && continue
33     echo "Removing ${filename}"
34     rm "${filename}" || exit 1
35 done
36 shopt -u nullglob
37
38 ########################## DEVELOPERS! ###############################
39 ## Add your modules here, then see below if you need to patch them. ##
40 ######################################################################
41
42 GNULIB_MODULES="getaddrinfo lock base64 physmem fsusage"
43 GNULIB_MODULES="$GNULIB_MODULES mkdtemp getopt-gnu full-read full-write"
44 GNULIB_MODULES="$GNULIB_MODULES lseek ftruncate fseeko ftello regex environ"
45 GNULIB_MODULES="$GNULIB_MODULES inet_pton"
46
47 ######################################################################
48 ## End modules                                                      ##
49 ######################################################################
50
51 # create a brand new gnulib directory
52
53 "${GNULIB_TOOL}" --import \
54         --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib \
55         --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl \
56         ${GNULIB_MODULES} || exit 1
57
58 ########################## DEVELOPERS! ###############################
59 ## Add your patch commands here, or use sed invoacations, etc.      ##
60 ## Please comment heavily!                                          ##
61 ######################################################################
62 PATCH_DIR="`pwd`/gnulib/regenerate"
63
64
65 # Patch Makefile.am to not error out on warnings
66 patch -p0 < "${PATCH_DIR}/no-error.patch" || exit 1
67 rm -f gnulib/Makefile.am.orig
68
69 # Add info to the makefile to ensure all this stuff gets put in
70 # the distribution tarball
71 (   echo ""
72     echo "# Make sure regenerate/* are in the distribution tarball"
73     echo "EXTRA_DIST += "`cd gnulib; find regenerate -name .svn -prune -o -type f -print | sort`
74 ) >> gnulib/Makefile.am
75
76 # remove .gitignore files, which ignore things we would like to see
77 rm -f config/gnulib/.gitignore
78 rm -f gnulib/.gitignore
79
80 ######################################################################
81 ## End patches                                                      ##
82 ######################################################################