mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
7bb22f58b8
This makes it so we record (via a git submodule) a snapshot of whatever version of gnulib we're using, and none of gnulib sources are in the libvirt repository. The result is that we have as much reproducibility as when we version-controlled imported copies of the gnulib sources, but without the hassle of the manual process we used when syncing with upstream. Note that when you clone libvirt, you get only the libvirt repository, but when you first run ./bootstrap, it clones gnulib (at the SHA1 recorded via the submodule), creating the .gnulib/ hierarchy. Then, the bootstrap script runs gnulib-tool to populate gnulib/ with the files that make up the selected modules. Put the following in your ~/.gitconfig file. [alias] syncsub = submodule foreach git pull origin master The update procedure is simple: git syncsub ...build & test... git commit -m 'gnulib: sync submodule to latest' .gnulib * .gitmodules: New file. * .gnulib: Initialize. * bootstrap: Set up to use the new submodule. Stop using --no-vc-files. Don't remove .gitignore files. Don't use or create .cvsignore. Diagnose an invalid --gnulib-srcdir=DIR argument. * build-aux/vc-list-files: Delete file, now pulled from gnulib. * build-aux/useless-if-before-free: Likewise. * po/POTFILES.in: Remove gnulib/lib/gai_strerror.c, since it no longer contains translatable strings. * gnulib/*: Remove gnulib/ hierarchy.
118 lines
2.6 KiB
Bash
Executable File
118 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Run this after autogen.sh, to pull in all of the gnulib-related bits.
|
|
# It's important to run *after* autogen.sh, since it updates some of
|
|
# the same files autogen.sh does, yet those from gnulib are newer,
|
|
# and match the tests. So if a gnulib bug has been fixed since the
|
|
# snapshot taken for whatever gettext release you're using, yet you
|
|
# run "make check" against the wrong version, the corresponding unit
|
|
# test in gl-tests/ may well fail.
|
|
|
|
usage() {
|
|
echo >&2 "\
|
|
Usage: $0 [OPTION]...
|
|
Bootstrap this package from the checked-out sources.
|
|
|
|
Options:
|
|
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
|
|
sources reside. Use this if you already
|
|
have gnulib sources on your machine, and
|
|
do not want to waste your bandwidth downloading
|
|
them again.
|
|
|
|
If the file bootstrap.conf exists in the current working directory, its
|
|
contents are read as shell variables to configure the bootstrap.
|
|
|
|
Running without arguments will suffice in most cases.
|
|
"
|
|
}
|
|
|
|
for option
|
|
do
|
|
case $option in
|
|
--help)
|
|
usage
|
|
exit;;
|
|
--gnulib-srcdir=*)
|
|
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
|
*)
|
|
echo >&2 "$0: $option: unknown option"
|
|
exit 1;;
|
|
esac
|
|
done
|
|
|
|
# Get gnulib files.
|
|
|
|
case ${GNULIB_SRCDIR--} in
|
|
-)
|
|
echo "$0: getting gnulib files..."
|
|
git submodule init || exit $?
|
|
git submodule update || exit $?
|
|
GNULIB_SRCDIR=.gnulib
|
|
;;
|
|
*)
|
|
# Redirect the gnulib submodule to the directory on the command line
|
|
# if possible.
|
|
if test -d "$GNULIB_SRCDIR"/.git && \
|
|
git config --file .gitmodules submodule.gnulib.url >/dev/null; then
|
|
git submodule init
|
|
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
|
|
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
|
|
echo "$0: getting gnulib files..."
|
|
git submodule update || exit $?
|
|
GNULIB_SRCDIR=.gnulib
|
|
else
|
|
echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
|
|
exit 1
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
|
<$gnulib_tool || exit
|
|
|
|
modules='
|
|
c-ctype
|
|
close
|
|
connect
|
|
getaddrinfo
|
|
gethostname
|
|
getpass
|
|
gettext
|
|
inet_pton
|
|
ioctl
|
|
mkstemp
|
|
mktempd
|
|
perror
|
|
physmem
|
|
poll
|
|
posix-shell
|
|
recv
|
|
random_r
|
|
send
|
|
setsockopt
|
|
socket
|
|
stpcpy
|
|
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
|