Add some newly-untracked files to .gitignore
[libguestfs.git] / bootstrap
1 #!/bin/sh
2
3 usage() {
4   echo >&2 "\
5 Usage: $0 [OPTION]...
6 Bootstrap this package from the checked-out sources.
7
8 Options:
9  --gnulib-srcdir=DIRNAME  Specify the local directory where gnulib
10                           sources reside.  Use this if you already
11                           have gnulib sources on your machine, and
12                           do not want to waste your bandwidth downloading
13                           them again.
14
15 If the file bootstrap.conf exists in the current working directory, its
16 contents are read as shell variables to configure the bootstrap.
17
18 Running without arguments will suffice in most cases.
19 "
20 }
21
22 for option
23 do
24   case $option in
25   --help)
26     usage
27     exit;;
28   --gnulib-srcdir=*)
29     GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
30   *)
31     echo >&2 "$0: $option: unknown option"
32     exit 1;;
33   esac
34 done
35
36 # Get gnulib files.
37
38 case ${GNULIB_SRCDIR--} in
39 -)
40   echo "$0: getting gnulib files..."
41   git submodule init || exit $?
42   git submodule update || exit $?
43   GNULIB_SRCDIR=.gnulib
44   ;;
45 *)
46   # Redirect the gnulib submodule to the directory on the command line
47   # if possible.
48   if test -d "$GNULIB_SRCDIR"/.git && \
49         git config --file .gitmodules submodule.gnulib.url >/dev/null; then
50     git submodule init
51     GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
52     git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
53     echo "$0: getting gnulib files..."
54     git submodule update || exit $?
55     GNULIB_SRCDIR=.gnulib
56   else
57     echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
58     exit 1
59   fi
60   ;;
61 esac
62
63 ls po/*.po 2>/dev/null | sed 's|.*/||; s|\.po$||' > po/LINGUAS
64
65 # Create gettext configuration.
66 echo "$0: Creating po/Makevars from po/Makevars.template ..."
67 rm -f po/Makevars
68 sed '
69   /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
70   /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
71   /^XGETTEXT_OPTIONS *=/{
72     s/$/ \\/
73     a\
74         '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
75   }
76 ' po/Makevars.template >po/Makevars
77
78 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
79 <$gnulib_tool || exit
80
81 modules='
82 gitlog-to-changelog
83 gnu-make
84 gnumakefile
85 maintainer-makefile
86 manywarnings
87 warnings
88 vc-list-files
89 '
90
91 $gnulib_tool                    \
92   --avoid=dummy                 \
93   --with-tests                  \
94   --m4-base=gnulib/m4           \
95   --source-base=gnulib/lib      \
96   --tests-base=gnulib/tests     \
97   --import $modules