5669916877d155590ea73614af595138a9ddc032
[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 03400ebfaa064922caf3767d6641d7e1cdc8cd1b
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
45 ######################################################################
46 ## End modules                                                      ##
47 ######################################################################
48
49 # create a brand new gnulib directory
50
51 "${GNULIB_TOOL}" --import \
52         --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib \
53         --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl \
54         ${GNULIB_MODULES} || exit 1
55
56 ########################## DEVELOPERS! ###############################
57 ## Add your patch commands here, or use sed invoacations, etc.      ##
58 ## Please comment heavily!                                          ##
59 ######################################################################
60 PATCH_DIR="`pwd`/gnulib/regenerate"
61
62
63 # Patch Makefile.am to not error out on warnings
64 patch -p0 < "${PATCH_DIR}/no-error.patch" || exit 1
65
66 # Add John's patches to getaddrinfo.c for use in cygwin
67 patch -p0 < "${PATCH_DIR}/getaddrinfo-cygwin.patch" || exit 1
68
69 # Add John's patches to eliminate restrict attributes.
70 patch -p0 < "${PATCH_DIR}/no-restrict.patch" || exit 1
71
72 # Add info to the makefile to ensure all this stuff gets put in
73 # the distribution tarball
74 (   echo ""
75     echo "# Make sure regenerate/* are in the distribution tarball"
76     echo "EXTRA_DIST += "`cd gnulib; find regenerate -name .svn -prune -o -type f -print | sort`
77 ) >> gnulib/Makefile.am
78
79 ######################################################################
80 ## End patches                                                      ##
81 ######################################################################