* 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.
This commit is contained in:
Eelco Dolstra 2006-04-25 10:45:53 +00:00
parent ef2d4a2da9
commit 03162f8f47
5 changed files with 58 additions and 14 deletions

View file

@ -160,22 +160,26 @@ fi
AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH], AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH],
[prefix of bzip2]), [prefix of bzip2]),
bzip2=$withval, bzip2=) bzip2=$withval, bzip2=)
AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2")
if test -z "$bzip2"; then if test -z "$bzip2"; then
AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, # Headers and libraries will be used from the temporary installation
[bzip2_lib="-lbz2"], [AC_MSG_ERROR([cannot find -lbz (bzip2)])]) # in externals/inst-bzip2.
AC_CHECK_HEADER(bzlib.h, bzip2_lib='-L${top_builddir}/externals/inst-bzip2/lib -lbz2'
[bzip2_include=""], [AC_MSG_ERROR([cannot find bzlib.h (bzip2)])]) bzip2_include='-I${top_builddir}/externals/inst-bzip2/include'
AC_PATH_PROG(bzip2_prog, bzip2, # The binary will be copied to $libexecdir.
[AC_MSG_ERROR([cannot find bzip2])]) bzip2_bin='${libexecdir}'
bzip2_bin=$(dirname $bzip2_prog) # But for testing, we have to use the temporary copy :-(
bzip2_bin_test='${top_builddir}/externals/inst-bzip2/bin'
else else
bzip2_lib="-L$bzip2/lib -lbz2" bzip2_lib="-L$bzip2/lib -lbz2"
bzip2_include="-I$bzip2/include" bzip2_include="-I$bzip2/include"
bzip2_bin="$bzip2/bin" bzip2_bin="$bzip2/bin"
bzip2_bin_test="$bzip2/bin"
fi fi
AC_SUBST(bzip2_lib) AC_SUBST(bzip2_lib)
AC_SUBST(bzip2_include) AC_SUBST(bzip2_include)
AC_SUBST(bzip2_bin) AC_SUBST(bzip2_bin)
AC_SUBST(bzip2_bin_test)
AC_CHECK_LIB(pthread, pthread_mutex_init) AC_CHECK_LIB(pthread, pthread_mutex_init)
@ -212,7 +216,7 @@ AC_SUBST(NIX_GROUP)
AC_DEFINE_UNQUOTED(NIX_GROUP, ["$NIX_GROUP"], [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. # and the Nix libraries are dynamic.
if test "$(uname)" = "Darwin"; then if test "$(uname)" = "Darwin"; then
LDFLAGS="-all_load $LDFLAGS" LDFLAGS="-all_load $LDFLAGS"

39
externals/Makefile.am vendored
View file

@ -64,10 +64,43 @@ build-aterm: have-aterm
endif 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: ext-clean:
$(RM) -f have-db build-db have-aterm build-aterm $(RM) -f have-db build-db have-aterm build-aterm
$(RM) -rf $(DB) $(ATERM) $(RM) -rf $(DB) $(ATERM) $(BZIP2)

View file

@ -13,6 +13,7 @@
-e "s^@curl\@^$(curl)^g" \ -e "s^@curl\@^$(curl)^g" \
-e "s^@bzip2\@^$(bzip2_bin)/bzip2^g" \ -e "s^@bzip2\@^$(bzip2_bin)/bzip2^g" \
-e "s^@bunzip2\@^$(bzip2_bin)/bunzip2^g" \ -e "s^@bunzip2\@^$(bzip2_bin)/bunzip2^g" \
-e "s^@bzip2_bin_test\@^$(bzip2_bin_test)^g" \
-e "s^@perl\@^$(perl)^g" \ -e "s^@perl\@^$(perl)^g" \
-e "s^@coreutils\@^$(coreutils)^g" \ -e "s^@coreutils\@^$(coreutils)^g" \
-e "s^@tar\@^$(tar)^g" \ -e "s^@tar\@^$(tar)^g" \

View file

@ -24,6 +24,10 @@ export NIX_BUILD_HOOK=
export PERL=perl export PERL=perl
export TOP=$(pwd)/.. export TOP=$(pwd)/..
export aterm_bin=@aterm_bin@ 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 dot=@dot@
export xmllint="@xmllint@" export xmllint="@xmllint@"
export xmlflags="@xmlflags@" export xmlflags="@xmlflags@"

View file

@ -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-prefetch-url $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-build $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 mkdir $NIX_BIN_DIR/nix
ln -s $TOP/scripts/download-using-manifests.pl $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/ ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/