From b006a31d52b8f1cb01f3d722a6e3411dc8b98d64 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 18 Mar 2012 23:54:57 +0100 Subject: [PATCH] Drop the externals directory Nix now requires SQLite and bzip2 to be pre-installed. SQLite is detected using pkg-config. We required DBD::SQLite anyway, so depending on SQLite is not a big problem. The --with-bzip2, --with-openssl and --with-sqlite flags are gone. --- .gitignore | 7 ---- Makefile.am | 2 +- configure.ac | 80 ++++++++++--------------------------- doc/manual/installation.xml | 47 ++++++++++++++-------- externals/Makefile.am | 67 ------------------------------- release.nix | 17 ++------ src/bsdiff-4.3/Makefile.am | 6 +-- src/libstore/Makefile.am | 4 +- src/libutil/Makefile.am | 4 +- substitute.mk | 3 +- tests/common.sh.in | 5 --- tests/init.sh | 1 - 12 files changed, 64 insertions(+), 179 deletions(-) delete mode 100644 externals/Makefile.am diff --git a/.gitignore b/.gitignore index c929c8ece..d7f151507 100644 --- a/.gitignore +++ b/.gitignore @@ -43,13 +43,6 @@ Makefile.in /doc/manual/NEWS.html /doc/manual/NEWS.txt -# /externals/ -/externals/bzip2-* -/externals/build-bzip2 -/externals/inst-bzip2 -/externals/sqlite-* -/externals/build-sqlite - # /scripts/ /scripts/nix-profile.sh /scripts/nix-pull diff --git a/Makefile.am b/Makefile.am index b946b1e36..4bbd952b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = externals src perl scripts corepkgs doc misc tests +SUBDIRS = src perl scripts corepkgs doc misc tests EXTRA_DIST = substitute.mk nix.spec nix.spec.in bootstrap.sh \ nix.conf.example NEWS version diff --git a/configure.ac b/configure.ac index 29fdfdb36..0e460ff3e 100644 --- a/configure.ac +++ b/configure.ac @@ -167,14 +167,11 @@ AC_PATH_PROG(bison, bison, false) NEED_PROG(perl, perl) NEED_PROG(sed, sed) NEED_PROG(tar, tar) +NEED_PROG(bzip2, bzip2) AC_PATH_PROG(dot, dot) AC_PATH_PROG(dblatex, dblatex) AC_PATH_PROG(gzip, gzip) -AC_PATH_PROG(openssl_prog, openssl, openssl) # if not found, call openssl in $PATH -AC_SUBST(openssl_prog) -AC_DEFINE_UNQUOTED(OPENSSL_PATH, ["$openssl_prog"], [Path of the OpenSSL binary]) - # Test that Perl has the open/fork feature (Perl 5.8.0 and beyond). AC_MSG_CHECKING([whether Perl is recent enough]) @@ -224,63 +221,27 @@ AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH], AC_SUBST(storedir) -AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl=PATH], - [prefix of the OpenSSL library]), - openssl=$withval, openssl=) -AM_CONDITIONAL(HAVE_OPENSSL, test -n "$openssl") -if test -n "$openssl"; then - LDFLAGS="-L$openssl/lib -lcrypto $LDFLAGS" - CFLAGS="-I$openssl/include $CFLAGS" - CXXFLAGS="-I$openssl/include $CXXFLAGS" - AC_DEFINE(HAVE_OPENSSL, 1, [Whether to use OpenSSL.]) -fi +# Look for OpenSSL, an optional dependency. +AC_PATH_PROG(openssl_prog, openssl, openssl) # if not found, call openssl in $PATH +AC_SUBST(openssl_prog) +AC_DEFINE_UNQUOTED(OPENSSL_PATH, ["$openssl_prog"], [Path of the OpenSSL binary]) + +PKG_CHECK_MODULES([OPENSSL], [libcrypto], + [AC_DEFINE([HAVE_OPENSSL], [1], [Whether to use OpenSSL.]) + CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS" + have_openssl=1], []) +AM_CONDITIONAL(HAVE_OPENSSL, test "$have_openssl" = 1) -AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH], - [prefix of bzip2]), - bzip2=$withval, bzip2=) -AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2") -ATERM_VERSION=2.5 -AC_SUBST(ATERM_VERSION) -if test -z "$bzip2"; then - # 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}/nix' - # 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_bin_test="$bzip2/bin" -fi -AC_SUBST(bzip2_lib) -AC_SUBST(bzip2_include) -AC_SUBST(bzip2_bin) -AC_SUBST(bzip2_bin_test) +# Look for libbz2, a required dependency. +AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true], + [AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])]) +AC_CHECK_HEADERS([bzlib.h], [true], + [AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])]) -AC_ARG_WITH(sqlite, AC_HELP_STRING([--with-sqlite=PATH], - [prefix of SQLite]), - sqlite=$withval, sqlite=) -AM_CONDITIONAL(HAVE_SQLITE, test -n "$sqlite") -SQLITE_VERSION=3070900 -AC_SUBST(SQLITE_VERSION) -if test -z "$sqlite"; then - sqlite_lib='${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)/libsqlite3.la' - sqlite_include='-I${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)' - sqlite_bin='${top_builddir}/externals/sqlite-autoconf-$(SQLITE_VERSION)' -else - sqlite_lib="-L$sqlite/lib -lsqlite3" - sqlite_include="-I$sqlite/include" - sqlite_bin="$sqlite/bin" -fi -AC_SUBST(sqlite_lib) -AC_SUBST(sqlite_include) -AC_SUBST(sqlite_bin) +# Look for SQLite, a required dependency. +PKG_CHECK_MODULES([SQLITE3], [sqlite3], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"]) # Whether to use the Boehm garbage collector. @@ -329,8 +290,8 @@ AC_CHECK_FUNCS([setresuid setreuid lchown]) AC_CHECK_FUNCS([strsignal posix_fallocate nanosleep sysconf]) -# This is needed if ATerm or bzip2 are static libraries, -# and the Nix libraries are dynamic. +# This is needed if bzip2 is a static library, and the Nix libraries +# are dynamic. if test "$(uname)" = "Darwin"; then LDFLAGS="-all_load $LDFLAGS" fi @@ -343,7 +304,6 @@ AC_SUBST(dynlib_suffix) AM_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile - externals/Makefile src/Makefile src/bin2c/Makefile src/boost/Makefile diff --git a/doc/manual/installation.xml b/doc/manual/installation.xml index 755f53907..15c156dab 100644 --- a/doc/manual/installation.xml +++ b/doc/manual/installation.xml @@ -69,7 +69,36 @@ from source. Binary releases (e.g., RPMs) have no prerequisites. A fairly recent version of GCC/G++ is required. Version 2.95 -and higher should work. +and higher should work. Clang will also work. + +Nix requires Perl, version 5.8 or higher. + +Nix requires pkg-config to locate its +dependencies. If your distribution does not provide it, you can get +it from . + +Nix requires the bzip2 compressor program and the +libbz2 library. Thus you must have bzip2 +installed, including development headers and libraries. If your +distribution does not provide these, you can obtain bzip2 from . + +Nix requires the SQLite embedded database library. If your +distribution does not provide it, please install it from . + +Nix requires the Perl DBI and DBD::SQLite libraries, which are +available from CPAN +if your distribution does not provide them. + +Nix can optionally use the Boehm +garbage collector to reduce the evaluator’s memory consumption. +To enable it, install pkgconfig and the Boehm +garbage collector, and pass the flag to +configure. To build this manual and the man-pages you need the xmllint and xsltproc programs, @@ -96,22 +125,6 @@ ubiquitous 2.5.4a won't. Note that these are only required if you modify the parser or when you are building from the Subversion repository. -Nix uses the bzip2 compressor (including the bzip2 library). It -is included in the Nix source distribution. If you build from the -Subversion repository, you must download it yourself and place it in -the externals/ directory. See -externals/Makefile.am for the precise URLs of -this packages. Alternatively, if you already have it installed, you -can use configure's -options to point to their respective locations. - -Nix can optionally use the Boehm -garbage collector to reduce the evaluator’s memory consumption. -To enable it, install pkgconfig and the Boehm -garbage collector, and pass the flag to -configure. - diff --git a/externals/Makefile.am b/externals/Makefile.am deleted file mode 100644 index 80c1548bb..000000000 --- a/externals/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -# bzip2 - -BZIP2 = bzip2-1.0.6 - -$(BZIP2).tar.gz: - @echo "Nix requires bzip2 to build." - @echo "Please download version 1.0.6 from" - @echo " http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz" - @echo "and place it in the externals/ directory." - false - -$(BZIP2): $(BZIP2).tar.gz - gunzip < $(srcdir)/$(BZIP2).tar.gz | tar xvf - - -if HAVE_BZIP2 -build-bzip2: -else -build-bzip2: $(BZIP2) - (cd $(BZIP2) && \ - $(MAKE) CC="$(CC)" && \ - $(MAKE) install PREFIX=$(abs_builddir)/inst-bzip2) - touch build-bzip2 - -install-exec-local:: build-bzip2 - mkdir -p $(DESTDIR)${bzip2_bin} - $(INSTALL_PROGRAM) $(bzip2_bin_test)/bzip2 $(DESTDIR)${bzip2_bin} -endif - - -# SQLite - -SQLITE = sqlite-autoconf-$(SQLITE_VERSION) -SQLITE_TAR = sqlite-autoconf-$(SQLITE_VERSION).tar.gz - -$(SQLITE_TAR): - @echo "Nix requires the SQLite library to build." - @echo "Please download version $(SQLITE_VERSION) from" - @echo " http://www.sqlite.org/$(SQLITE_TAR)" - @echo "and place it in the externals/ directory." - false - -$(SQLITE): $(SQLITE_TAR) - gzip -d < $(srcdir)/$(SQLITE_TAR) | tar xvf - - -if HAVE_SQLITE -build-sqlite: -else -build-sqlite: $(SQLITE) - (cd $(SQLITE) && \ - CC="$(CC)" CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" ./configure --disable-static --prefix=$(pkglibdir)/dummy --libdir=${pkglibdir} $(SUB_CONFIGURE_FLAGS) && \ - $(MAKE) ) - touch build-sqlite - -install-exec-local:: build-sqlite - cd $(SQLITE) && $(MAKE) install - rm -rf "$(DESTDIR)/$(pkglibdir)/dummy" -endif - - -all: build-bzip2 build-sqlite - -EXTRA_DIST = $(BZIP2).tar.gz $(SQLITE_TAR) - -clean: - $(RM) -f build-bzip2 build-sqlite - $(RM) -rf $(BZIP2) $(SQLITE) - $(RM) -rf inst-bzip2 diff --git a/release.nix b/release.nix index 953211f0e..cc17bf552 100644 --- a/release.nix +++ b/release.nix @@ -20,7 +20,7 @@ let buildInputs = [ curl bison24 flex2535 perl libxml2 libxslt w3m bzip2 - tetex dblatex nukeReferences pkgconfig git + tetex dblatex nukeReferences pkgconfig sqlite git ]; configureFlags = '' @@ -33,17 +33,10 @@ let postUnpack = '' # Clean up when building from a working tree. - (cd $sourceRoot && (git ls-files -o | xargs rm -v)) + (cd $sourceRoot && (git ls-files -o | xargs -r rm -v)) ''; - # Include the Bzip2 tarball in the distribution. preConfigure = '' - stripHash ${bzip2.src} - cp -pv ${bzip2.src} externals/$strippedName - - stripHash ${sqlite.src} - cp -pv ${sqlite.src} externals/$strippedName - # TeX needs a writable font cache. export VARTEXFONTS=$TMPDIR/texfonts ''; @@ -78,11 +71,10 @@ let name = "nix"; src = tarball; - buildInputs = [ curl perl bzip2 openssl pkgconfig boehmgc ]; + buildInputs = [ curl perl bzip2 openssl pkgconfig sqlite boehmgc ]; configureFlags = '' --disable-init-state - --with-bzip2=${bzip2} --with-sqlite=${sqlite} --with-dbi=${perlPackages.DBI}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl --enable-gc @@ -98,14 +90,13 @@ let src = tarball; buildInputs = - [ curl perl bzip2 openssl + [ curl perl bzip2 openssl pkgconfig sqlite # These are for "make check" only: graphviz libxml2 libxslt ]; configureFlags = '' --disable-init-state - --with-bzip2=${bzip2} --with-sqlite=${sqlite} --with-dbi=${perlPackages.DBI}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl ''; diff --git a/src/bsdiff-4.3/Makefile.am b/src/bsdiff-4.3/Makefile.am index 57970bc55..62315333a 100644 --- a/src/bsdiff-4.3/Makefile.am +++ b/src/bsdiff-4.3/Makefile.am @@ -4,10 +4,10 @@ libexec_PROGRAMS = bsdiff bspatch bsdiff_SOURCES = bsdiff.c -bsdiff_LDADD = ${bzip2_lib} +bsdiff_LDADD = -lbz2 bspatch_SOURCES = bspatch.c -bspatch_LDADD = ${bzip2_lib} +bspatch_LDADD = -lbz2 -AM_CFLAGS = -O3 ${bzip2_include} ${bsddiff_compat_include} +AM_CFLAGS = -O3 ${bsddiff_compat_include} diff --git a/src/libstore/Makefile.am b/src/libstore/Makefile.am index 39a61233b..a9e5732e2 100644 --- a/src/libstore/Makefile.am +++ b/src/libstore/Makefile.am @@ -10,12 +10,12 @@ pkginclude_HEADERS = \ globals.hh references.hh pathlocks.hh \ worker-protocol.hh -libstore_la_LIBADD = ../libutil/libutil.la ../boost/format/libformat.la ${aterm_lib} ${sqlite_lib} +libstore_la_LIBADD = ../libutil/libutil.la ../boost/format/libformat.la @SQLITE3_LIBS@ EXTRA_DIST = schema.sql AM_CXXFLAGS = -Wall \ - ${sqlite_include} -I$(srcdir)/.. -I$(srcdir)/../libutil \ + -I$(srcdir)/.. -I$(srcdir)/../libutil \ -DNIX_STORE_DIR=\"$(storedir)\" \ -DNIX_DATA_DIR=\"$(datadir)\" \ -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \ diff --git a/src/libutil/Makefile.am b/src/libutil/Makefile.am index a326060cf..4a3523f3b 100644 --- a/src/libutil/Makefile.am +++ b/src/libutil/Makefile.am @@ -3,7 +3,7 @@ pkglib_LTLIBRARIES = libutil.la libutil_la_SOURCES = util.cc hash.cc serialise.cc \ archive.cc xml-writer.cc immutable.cc -libutil_la_LIBADD = ../boost/format/libformat.la ${aterm_lib} ${sqlite_lib} +libutil_la_LIBADD = ../boost/format/libformat.la pkginclude_HEADERS = util.hh hash.hh serialise.hh \ archive.hh xml-writer.hh types.hh immutable.hh @@ -11,6 +11,8 @@ pkginclude_HEADERS = util.hh hash.hh serialise.hh \ if !HAVE_OPENSSL libutil_la_SOURCES += \ md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h +else +libutil_la_LIBADD += @OPENSSL_LIBS@ endif AM_CXXFLAGS = -Wall -I$(srcdir)/.. diff --git a/substitute.mk b/substitute.mk index 96fc16bf5..3f2f367ff 100644 --- a/substitute.mk +++ b/substitute.mk @@ -14,8 +14,7 @@ -e "s^@system\@^$(system)^g" \ -e "s^@shell\@^$(bash)^g" \ -e "s^@curl\@^$(curl)^g" \ - -e "s^@bzip2\@^$(bzip2_bin)/bzip2^g" \ - -e "s^@bzip2_bin_test\@^$(bzip2_bin_test)^g" \ + -e "s^@bzip2\@^$(bzip2)^g" \ -e "s^@perl\@^$(perl)^g" \ -e "s^@perlFlags\@^$(perlFlags)^g" \ -e "s^@coreutils\@^$(coreutils)^g" \ diff --git a/tests/common.sh.in b/tests/common.sh.in index 5619580a7..316562f67 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -29,15 +29,10 @@ export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH export NIX_BUILD_HOOK= export PERL=perl export PERL5LIB=$TOP/perl/lib:$PERL5LIB -export NIX_BZIP2="@bzip2_bin_test@/bzip2" -if test "${NIX_BZIP2:0:1}" != "/"; then - NIX_BZIP2=`pwd`/${NIX_BZIP2} -fi export dot=@dot@ export xmllint="@xmllint@" export xmlflags="@xmlflags@" export xsltproc="@xsltproc@" -export sqlite3="@sqlite_bin@/bin/sqlite3" export SHELL="@shell@" export version=@version@ diff --git a/tests/init.sh b/tests/init.sh index 4296f43b6..777f95f77 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -28,7 +28,6 @@ ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-build $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-pull $NIX_BIN_DIR/ mkdir -p $NIX_BIN_DIR/nix/substituters -ln -s $NIX_BZIP2 $NIX_BIN_DIR/nix/ ln -s $TOP/scripts/copy-from-other-stores.pl $NIX_BIN_DIR/nix/substituters cat > "$NIX_CONF_DIR"/nix.conf <