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