Merge commit 'upstream/3.1.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 8d2524ce78ca107074727cbd8780c26a203a107c
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 visibility base64 physmem fsusage"
43 GNULIB_MODULES="$GNULIB_MODULES mkdtemp getopt full-read full-write"
44 GNULIB_MODULES="$GNULIB_MODULES lseek ftruncate fseeko ftello regex"
45
46 ######################################################################
47 ## End modules                                                      ##
48 ######################################################################
49
50 # create a brand new gnulib directory
51
52 "${GNULIB_TOOL}" --import \
53         --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib \
54         --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl \
55         ${GNULIB_MODULES} || exit 1
56
57 ########################## DEVELOPERS! ###############################
58 ## Add your patch commands here, or use sed invoacations, etc.      ##
59 ## Please comment heavily!                                          ##
60 ######################################################################
61 PATCH_DIR="`pwd`/gnulib/regenerate"
62
63
64 # Patch Makefile.am to not error out on warnings
65 patch -p0 < "${PATCH_DIR}/no-error.patch" || exit 1
66 rm -f gnulib/Makefile.am.orig
67
68 # Add info to the makefile to ensure all this stuff gets put in
69 # the distribution tarball
70 (   echo ""
71     echo "# Make sure regenerate/* are in the distribution tarball"
72     echo "EXTRA_DIST += "`cd gnulib; find regenerate -name .svn -prune -o -type f -print | sort`
73 ) >> gnulib/Makefile.am
74
75 # remove .gitignore files, which ignore things we would like to see
76 rm -f config/gnulib/.gitignore
77 rm -f gnulib/.gitignore
78
79 ######################################################################
80 ## End patches                                                      ##
81 ######################################################################