Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Infrastructure and import of gnulib modules

We do not keep the gnulib sources in our own repo. Instead, autogen.sh now
calls out to bootstrap to pull in needed files from gnulib.

The bootstrap script was copied from libvirt.
  • Loading branch information...
commit 1999ccf08389fd24fd65a301d9d8673b27e8974e 1 parent 028369f
@lutter lutter authored
View
1  .hgignore
@@ -1,6 +1,7 @@
.*~$
^augeas\.(pc|spec)$
^build/
+^gnulib/
^config\.h(\.in)?$
^aclocal\.m4$
^autom4te\.cache/
View
6 Makefile.am
@@ -1,4 +1,6 @@
-SUBDIRS=src tests man
+SUBDIRS=gnulib/lib src gnulib/tests tests man
+
+ACLOCAL_AMFLAGS = -I gnulib/m4
lensdir=$(datadir)/augeas/lenses
lenstestdir=$(datadir)/augeas/lenses/tests
@@ -13,5 +15,3 @@ pkgconfig_DATA = augeas.pc
distclean-local:
-rm -rf $(top_builddir)/build
-
-
View
44 autogen.sh
@@ -1,7 +1,27 @@
-#!/bin/sh
+#!/bin/bash
# Run this to generate all the initial makefiles, etc.
+usage() {
+ echo >&2 "\
+Usage: $0 [OPTION]...
+Generate makefiles and other infrastructure needed for building
+
+
+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.
+ --help Print this message
+ any other option Pass to the 'configure' script verbatim
+
+Running without arguments will suffice in most cases.
+"
+}
+
BUILD_AUX=build/aux
+GNULIB_DIR=gnulib
set -e
srcdir=`dirname $0`
@@ -10,6 +30,21 @@ test -z "$srcdir" && srcdir=.
THEDIR=`pwd`
cd $srcdir
+# Split out options for bootstrap and for configure
+declare -a CF_ARGS
+for option
+do
+ case $option in
+ --help)
+ usage
+ exit;;
+ --gnulib-srcdir=*)
+ GNULIB_SRCDIR=$option;;
+ *)
+ CF_ARGS[${#CF_ARGS[@]}]=$option;;
+ esac
+done
+
#Check for OSX
case `uname -s` in
Darwin) LIBTOOLIZE=glibtoolize;;
@@ -39,7 +74,7 @@ if test "$DIE" -eq 1; then
exit 1
fi
-if test -z "$*"; then
+if test -z "${CF_ARGS[*]}"; then
echo "I am going to run ./configure with --enable-warnings - if you "
echo "wish to pass any extra arguments to it, please specify them on "
echo "the $0 command line."
@@ -48,7 +83,8 @@ fi
mkdir -p $BUILD_AUX
$LIBTOOLIZE --copy --force
-aclocal
+./bootstrap $GNULIB_SRCDIR
+aclocal -I gnulib/m4
autoheader
automake --add-missing
autoconf
@@ -60,7 +96,7 @@ if test x$OBJ_DIR != x; then
cd "$OBJ_DIR"
fi
-$srcdir/configure --enable-warnings "$@" && {
+$srcdir/configure --enable-warnings "${CF_ARGS[@]}" && {
echo
echo "Now type 'make' to compile augeas."
}
View
79 bootstrap
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+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=${option#--gnulib-srcdir=};;
+ *)
+ echo >&2 "$0: $option: unknown option"
+ exit 1;;
+ esac
+done
+
+cleanup_gnulib() {
+ st=$?
+ rm -fr .gnulib
+ exit $st
+}
+
+case ${GNULIB_SRCDIR--} in
+-)
+ if [ ! -d .gnulib ]; then
+ echo "$0: getting gnulib files..."
+
+ trap cleanup_gnulib 1 2 13 15
+
+ git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib ||
+ cleanup_gnulib
+
+ trap - 1 2 13 15
+ fi
+ GNULIB_SRCDIR=.gnulib
+esac
+
+gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
+<$gnulib_tool || exit
+
+modules='
+argz
+regex
+strndup
+'
+
+# 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 \
+ --aux-dir=build/aux \
+ --quiet \
+ --import $modules
View
22 configure.ac
@@ -7,6 +7,16 @@ AM_INIT_AUTOMAKE([-Wno-portability])
AC_GNU_SOURCE
AC_PROG_CC
+gl_EARLY
+
+
+dnl gl_INIT uses m4_foreach_w, yet that is not defined in autoconf-2.59.
+dnl In order to accommodate developers with such old tools, here's a
+dnl replacement definition.
+m4_ifndef([m4_foreach_w],
+ [m4_define([m4_foreach_w],
+ [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
+
AC_PROG_LIBTOOL
AC_PROG_YACC
AC_PROG_LEX
@@ -20,8 +30,12 @@ AC_SUBST(AUGEAS_CFLAGS)
AUGEAS_CHECK_READLINE
AC_CHECK_FUNCS([open_memstream])
-AC_OUTPUT(Makefile
- src/Makefile
- man/Makefile
- tests/Makefile
+gl_INIT
+
+AC_OUTPUT(Makefile \
+ gnulib/lib/Makefile \
+ gnulib/tests/Makefile \
+ src/Makefile \
+ man/Makefile \
+ tests/Makefile \
augeas.pc augeas.spec)
View
11 src/Makefile.am
@@ -1,5 +1,8 @@
-AM_CFLAGS = @AUGEAS_CFLAGS@ @WARN_CFLAGS@
+GNULIB= ../gnulib/lib/libgnu.la
+GNULIB_CFLAGS= -I $(top_srcdir)/gnulib/lib
+
+AM_CFLAGS = @AUGEAS_CFLAGS@ @WARN_CFLAGS@ $(GNULIB_CFLAGS)
AM_YFLAGS=-d -p spec_
@@ -18,13 +21,13 @@ libaugeas_la_SOURCES = augeas.h augeas.c \
syntax.c syntax.h parser.y builtin.c lens.c lens.h regexp.c \
transform.c get.c put.c list.h
libaugeas_la_LDFLAGS = -Wl,--version-script=$(srcdir)/augeas_sym.version
-libaugeas_la_LIBADD = liblexer.la libfa.la
+libaugeas_la_LIBADD = liblexer.la libfa.la $(GNULIB)
augtool_SOURCES = augtool.c
-augtool_LDADD = libaugeas.la $(READLINE_LIBS)
+augtool_LDADD = libaugeas.la $(READLINE_LIBS) $(GNULIB)
augparse_SOURCES = augparse.c
-augparse_LDADD = libaugeas.la
+augparse_LDADD = libaugeas.la $(GNULIB)
libfa_la_SOURCES = fa.c fa.h hash.c hash.h memory.c memory.h ref.h
View
1  src/augeas.c
@@ -28,6 +28,7 @@
#include <fnmatch.h>
#include <argz.h>
+#include <string.h>
/* We always have a toplevel entry for P_ROOT */
#define P_ROOT "augeas"
View
7 tests/Makefile.am
@@ -1,6 +1,9 @@
AUGTESTS=$(wildcard *.rb)
-AM_CFLAGS = $(AUGEAS_CFLAGS) $(WARN_CFLAGS)
+GNULIB= ../gnulib/lib/libgnu.la
+GNULIB_CFLAGS= -I $(top_srcdir)/gnulib/lib
+
+AM_CFLAGS = $(AUGEAS_CFLAGS) $(WARN_CFLAGS) $(GNULIB_CFLAGS)
valgrind: fatest
libtool --mode=execute valgrind --quiet --leak-check=full ./fatest
@@ -24,4 +27,4 @@ TESTS = $(check_SCRIPTS) $(check_PROGRAMS) augtest
INCLUDES = -I$(top_srcdir)/src
fatest_SOURCES = fatest.c cutest.c cutest.h
-fatest_LDADD = $(top_builddir)/src/libaugeas.la
+fatest_LDADD = $(top_builddir)/src/libaugeas.la $(GNULIB)
Please sign in to comment.
Something went wrong with that request. Please try again.