maint: start factoring bootstrap

Borrow ideas from gnulib/build-aux/bootstrap, in order to factor the
specifics of libvirt into bootstrap.conf, while allowing future
upgrades of bootstrap to happen with less effort.

* bootstrap (gnulib_tool): Update invocation to be closer to
gnulib's version.  Move libvirt specifics...
* bootstrap.conf: ...into new file.
This commit is contained in:
Eric Blake 2010-02-22 17:01:32 -07:00 committed by Jim Meyering
parent f1ef0e31d2
commit 1a51d05f8b
2 changed files with 203 additions and 54 deletions

133
bootstrap
View File

@ -20,6 +20,72 @@ Running without arguments will suffice in most cases.
"
}
# Configuration.
# List of gnulib modules needed.
gnulib_modules=
extract_package_name='
/^AC_INIT(/{
/.*,.*,.*, */{
s///
s/[][]//g
s/)$//
p
q
}
s/AC_INIT(\[*//
s/]*,.*//
s/^GNU //
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
s/[^A-Za-z0-9_]/-/g
p
}
'
package=`sed -n "$extract_package_name" configure.ac` || exit
gnulib_name=lib$package
build_aux=build-aux
source_base=lib
m4_base=m4
doc_base=doc
tests_base=tests
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras=
# Other locale categories that need message catalogs.
EXTRA_LOCALE_CATEGORIES=
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS='\\\
--flag=_:1:pass-c-format\\\
--flag=N_:1:pass-c-format\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
'
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
# if we were invoked as "sh bootstrap".
case "$0" in
*/*) test -r "$0.conf" && . "$0.conf" ;;
*) test -r "$0.conf" && . ./"$0.conf" ;;
esac
# Parse options.
for option
do
case $option in
@ -64,57 +130,16 @@ esac
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit
modules='
areadlink
base64
c-ctype
canonicalize-lgpl
close
connect
dirname-lgpl
getaddrinfo
gethostname
getpass
gettext
gitlog-to-changelog
gnumakefile
ignore-value
inet_pton
ioctl
maintainer-makefile
mkstemp
mktempd
perror
physmem
poll
posix-shell
recv
random_r
send
setsockopt
socket
stpcpy
strchrnul
strndup
strerror
strsep
sys_stat
time_r
useless-if-before-free
vasprintf
verify
vc-list-files
'
# Tell gnulib to:
# require LGPLv2+
# put *.m4 files in new gnulib/m4/ dir
# put *.[ch] files in new gnulib/lib/ dir.
$gnulib_tool \
--lgpl=2 \
--with-tests \
--m4-base=gnulib/m4 \
--source-base=gnulib/lib \
--tests-base=gnulib/tests \
--import $modules
gnulib_tool_options="\
--import\
--no-changelog\
--aux-dir $build_aux\
--doc-base $doc_base\
--lib $gnulib_name\
--m4-base $m4_base/\
--source-base $source_base/\
--tests-base $tests_base\
$gnulib_tool_option_extras\
"
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules

124
bootstrap.conf Normal file
View File

@ -0,0 +1,124 @@
# Bootstrap configuration.
# Copyright (C) 2010 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# gnulib modules used by this package.
gnulib_modules='
areadlink
base64
c-ctype
canonicalize-lgpl
close
connect
dirname-lgpl
getaddrinfo
gethostname
getpass
gettext
gitlog-to-changelog
gnumakefile
ignore-value
inet_pton
ioctl
maintainer-makefile
mkstemp
mktempd
perror
physmem
poll
posix-shell
recv
random_r
send
setsockopt
socket
stpcpy
strchrnul
strndup
strerror
strsep
sys_stat
time_r
useless-if-before-free
vasprintf
verify
vc-list-files
'
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--flag=virAsprintf:2:c-format\\\
--from-code=UTF-8\\\
'
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
# appears in configure.ac, exclude some unnecessary files.
# Without grep's -E option (not portable enough, pre-configure),
# the following test is ugly. Also, this depends on the existence
# of configure.ac, not the obsolescent-named configure.in. But if
# you're using this infrastructure, you should care about such things.
gettext_external=0
grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
gettext_external=1
grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
gettext_external=1
if test $gettext_external = 1; then
# Gettext supplies these files, but we don't need them since
# we don't have an intl subdirectory.
excluded_files='
m4/glibc2.m4
m4/intdiv0.m4
m4/lcmessage.m4
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
'
fi
# Tell gnulib to:
# require LGPLv2+
# put *.m4 files in new gnulib/m4/ dir
# put *.[ch] files in new gnulib/lib/ dir.
# import gnulib tests in new gnulib/tests/ dir.
gnulib_name=libgnu
m4_base=gnulib/m4
source_base=gnulib/lib
tests_base=gnulib/tests
gnulib_tool_option_extras="\
--lgpl=2\
--with-tests\
"
# Build prerequisites
buildreq="\
autoconf 2.59
automake 1.9.6
autopoint -
gettext -
git 1.6.4
gzip -
libtool -
perl 5.5
rsync -
tar -
"
# Automake requires that ChangeLog exist.
touch ChangeLog || exit 1