diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-04-25T10·45+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-04-25T10·45+0000 |
commit | 03162f8f477fb7634edbf53ad4e9dfca433dd9d9 (patch) | |
tree | 88aaf58b6111f8a0cb8422c97697605e1f3dc4de | |
parent | ef2d4a2da9c14c15985bdd27c02d2d30093a3e56 (diff) |
* Unless --with-bzip2 is specified, use a copy of bzip2 in the
externals directory. This is in particular useful because though most systems have bzip2/bunzip2, they don't always have libbz2, which we need for bsdiff/bspatch.
-rw-r--r-- | configure.ac | 26 | ||||
-rw-r--r-- | externals/Makefile.am | 39 | ||||
-rw-r--r-- | substitute.mk | 1 | ||||
-rw-r--r-- | tests/common.sh.in | 4 | ||||
-rw-r--r-- | tests/init.sh | 2 |
5 files changed, 58 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index f6e548729cd3..11ce58e6d2a0 100644 --- a/configure.ac +++ b/configure.ac @@ -160,22 +160,26 @@ fi AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH], [prefix of bzip2]), bzip2=$withval, bzip2=) +AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2") if test -z "$bzip2"; then - AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, - [bzip2_lib="-lbz2"], [AC_MSG_ERROR([cannot find -lbz (bzip2)])]) - AC_CHECK_HEADER(bzlib.h, - [bzip2_include=""], [AC_MSG_ERROR([cannot find bzlib.h (bzip2)])]) - AC_PATH_PROG(bzip2_prog, bzip2, - [AC_MSG_ERROR([cannot find bzip2])]) - bzip2_bin=$(dirname $bzip2_prog) + # Headers and libraries will be used from the temporary installation + # in externals/inst-bzip2. + bzip2_lib='-L${top_builddir}/externals/inst-bzip2/lib -lbz2' + bzip2_include='-I${top_builddir}/externals/inst-bzip2/include' + # The binary will be copied to $libexecdir. + bzip2_bin='${libexecdir}' + # But for testing, we have to use the temporary copy :-( + bzip2_bin_test='${top_builddir}/externals/inst-bzip2/bin' else - bzip2_lib="-L$bzip2/lib -lbz2" - bzip2_include="-I$bzip2/include" - bzip2_bin="$bzip2/bin" + bzip2_lib="-L$bzip2/lib -lbz2" + bzip2_include="-I$bzip2/include" + bzip2_bin="$bzip2/bin" + bzip2_bin_test="$bzip2/bin" fi AC_SUBST(bzip2_lib) AC_SUBST(bzip2_include) AC_SUBST(bzip2_bin) +AC_SUBST(bzip2_bin_test) AC_CHECK_LIB(pthread, pthread_mutex_init) @@ -212,7 +216,7 @@ AC_SUBST(NIX_GROUP) AC_DEFINE_UNQUOTED(NIX_GROUP, ["$NIX_GROUP"], [Nix group]) -# This is needed if either ATerm or Berkeley DB are static libraries, +# This is needed if ATerm, Berkeley DB or bzip2 are static libraries, # and the Nix libraries are dynamic. if test "$(uname)" = "Darwin"; then LDFLAGS="-all_load $LDFLAGS" diff --git a/externals/Makefile.am b/externals/Makefile.am index dcddaa5d139d..7fa9e6f6426b 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -64,10 +64,43 @@ build-aterm: have-aterm endif -all: build-db build-aterm +# bzip2 -EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz +BZIP2 = bzip2-1.0.3 + +$(BZIP2).tar.gz: + @echo "Nix requires bzip2 to build." + @echo "Please download version 1.0.3 from" + @echo " http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz" + @echo "and place it in the externals/ directory." + false + +$(BZIP2): $(BZIP2).tar.gz + gunzip < $(BZIP2).tar.gz | tar xvf - + +have-bzip2: + $(MAKE) $(BZIP2) + touch have-bzip2 + +if HAVE_BZIP2 +build-bzip2: +else +build-bzip2: have-bzip2 + (pfx=`pwd` && \ + cd $(BZIP2) && \ + $(MAKE) && \ + $(MAKE) install PREFIX=$$pfx/inst-bzip2) + touch build-bzip2 + +install: + cp $(bzip2_bin_test)/bzip2 $(bzip2_bin_test)/bunzip2 ${bzip2_bin} +endif + + +all: build-db build-aterm build-bzip2 + +EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz $(BZIp2).tar.gz ext-clean: $(RM) -f have-db build-db have-aterm build-aterm - $(RM) -rf $(DB) $(ATERM) + $(RM) -rf $(DB) $(ATERM) $(BZIP2) diff --git a/substitute.mk b/substitute.mk index 9e3123a14f99..18e4585d7566 100644 --- a/substitute.mk +++ b/substitute.mk @@ -13,6 +13,7 @@ -e "s^@curl\@^$(curl)^g" \ -e "s^@bzip2\@^$(bzip2_bin)/bzip2^g" \ -e "s^@bunzip2\@^$(bzip2_bin)/bunzip2^g" \ + -e "s^@bzip2_bin_test\@^$(bzip2_bin_test)^g" \ -e "s^@perl\@^$(perl)^g" \ -e "s^@coreutils\@^$(coreutils)^g" \ -e "s^@tar\@^$(tar)^g" \ diff --git a/tests/common.sh.in b/tests/common.sh.in index 0f55d6cf896e..07250ad6ede2 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -24,6 +24,10 @@ export NIX_BUILD_HOOK= export PERL=perl export TOP=$(pwd)/.. export aterm_bin=@aterm_bin@ +export bzip2_bin_test="@bzip2_bin_test@" +if test "${bzip2_bin_test:0:1}" != "/"; then + bzip2_bin_test=`pwd`/${bzip2_bin_test} +fi export dot=@dot@ export xmllint="@xmllint@" export xmlflags="@xmlflags@" diff --git a/tests/init.sh b/tests/init.sh index 11e0632a4842..d49d57cede25 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -24,6 +24,8 @@ ln -s $nixhash $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-build $NIX_BIN_DIR/ +ln -s $bzip2_bin_test/bzip2 $NIX_BIN_DIR/ +ln -s $bzip2_bin_test/bunzip2 $NIX_BIN_DIR/ mkdir $NIX_BIN_DIR/nix ln -s $TOP/scripts/download-using-manifests.pl $NIX_BIN_DIR/nix/ ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/ |