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.
This commit is contained in:
Eelco Dolstra 2012-03-18 23:54:57 +01:00
parent 2e0322efd1
commit b006a31d52
12 changed files with 64 additions and 179 deletions

7
.gitignore vendored
View file

@ -43,13 +43,6 @@ Makefile.in
/doc/manual/NEWS.html /doc/manual/NEWS.html
/doc/manual/NEWS.txt /doc/manual/NEWS.txt
# /externals/
/externals/bzip2-*
/externals/build-bzip2
/externals/inst-bzip2
/externals/sqlite-*
/externals/build-sqlite
# /scripts/ # /scripts/
/scripts/nix-profile.sh /scripts/nix-profile.sh
/scripts/nix-pull /scripts/nix-pull

View file

@ -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 \ EXTRA_DIST = substitute.mk nix.spec nix.spec.in bootstrap.sh \
nix.conf.example NEWS version nix.conf.example NEWS version

View file

@ -167,14 +167,11 @@ AC_PATH_PROG(bison, bison, false)
NEED_PROG(perl, perl) NEED_PROG(perl, perl)
NEED_PROG(sed, sed) NEED_PROG(sed, sed)
NEED_PROG(tar, tar) NEED_PROG(tar, tar)
NEED_PROG(bzip2, bzip2)
AC_PATH_PROG(dot, dot) AC_PATH_PROG(dot, dot)
AC_PATH_PROG(dblatex, dblatex) AC_PATH_PROG(dblatex, dblatex)
AC_PATH_PROG(gzip, gzip) 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). # Test that Perl has the open/fork feature (Perl 5.8.0 and beyond).
AC_MSG_CHECKING([whether Perl is recent enough]) 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_SUBST(storedir)
AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl=PATH], # Look for OpenSSL, an optional dependency.
[prefix of the OpenSSL library]), AC_PATH_PROG(openssl_prog, openssl, openssl) # if not found, call openssl in $PATH
openssl=$withval, openssl=) AC_SUBST(openssl_prog)
AM_CONDITIONAL(HAVE_OPENSSL, test -n "$openssl") AC_DEFINE_UNQUOTED(OPENSSL_PATH, ["$openssl_prog"], [Path of the OpenSSL binary])
if test -n "$openssl"; then
LDFLAGS="-L$openssl/lib -lcrypto $LDFLAGS" PKG_CHECK_MODULES([OPENSSL], [libcrypto],
CFLAGS="-I$openssl/include $CFLAGS" [AC_DEFINE([HAVE_OPENSSL], [1], [Whether to use OpenSSL.])
CXXFLAGS="-I$openssl/include $CXXFLAGS" CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS"
AC_DEFINE(HAVE_OPENSSL, 1, [Whether to use OpenSSL.]) have_openssl=1], [])
fi AM_CONDITIONAL(HAVE_OPENSSL, test "$have_openssl" = 1)
AC_ARG_WITH(bzip2, AC_HELP_STRING([--with-bzip2=PATH], # Look for libbz2, a required dependency.
[prefix of bzip2]), AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
bzip2=$withval, bzip2=) [AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
AM_CONDITIONAL(HAVE_BZIP2, test -n "$bzip2") AC_CHECK_HEADERS([bzlib.h], [true],
ATERM_VERSION=2.5 [AC_MSG_ERROR([Nix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
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)
AC_ARG_WITH(sqlite, AC_HELP_STRING([--with-sqlite=PATH], # Look for SQLite, a required dependency.
[prefix of SQLite]), PKG_CHECK_MODULES([SQLITE3], [sqlite3], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"])
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)
# Whether to use the Boehm garbage collector. # 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]) AC_CHECK_FUNCS([strsignal posix_fallocate nanosleep sysconf])
# This is needed if ATerm or bzip2 are static libraries, # This is needed if bzip2 is a static library, and the Nix libraries
# and the Nix libraries are dynamic. # are dynamic.
if test "$(uname)" = "Darwin"; then if test "$(uname)" = "Darwin"; then
LDFLAGS="-all_load $LDFLAGS" LDFLAGS="-all_load $LDFLAGS"
fi fi
@ -343,7 +304,6 @@ AC_SUBST(dynlib_suffix)
AM_CONFIG_HEADER([config.h]) AM_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
externals/Makefile
src/Makefile src/Makefile
src/bin2c/Makefile src/bin2c/Makefile
src/boost/Makefile src/boost/Makefile

View file

@ -69,7 +69,36 @@ from source</emphasis>. Binary releases (e.g., RPMs) have no
prerequisites.</para> prerequisites.</para>
<para>A fairly recent version of GCC/G++ is required. Version 2.95 <para>A fairly recent version of GCC/G++ is required. Version 2.95
and higher should work.</para> and higher should work. Clang will also work.</para>
<para>Nix requires Perl, version 5.8 or higher.</para>
<para>Nix requires <command>pkg-config</command> to locate its
dependencies. If your distribution does not provide it, you can get
it from <link
xlink:href="http://www.freedesktop.org/wiki/Software/pkg-config"
/>.</para>
<para>Nix requires the bzip2 compressor program and the
<literal>libbz2</literal> library. Thus you must have bzip2
installed, including development headers and libraries. If your
distribution does not provide these, you can obtain bzip2 from <link
xlink:href="http://www.bzip.org/"/>.</para>
<para>Nix requires the SQLite embedded database library. If your
distribution does not provide it, please install it from <link
xlink:href="http://www.sqlite.org/" />.</para>
<para>Nix requires the Perl DBI and DBD::SQLite libraries, which are
available from <link xlink:href="http://search.cpan.org/">CPAN</link>
if your distribution does not provide them.</para>
<para>Nix can optionally use the <link
xlink:href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm
garbage collector</link> to reduce the evaluators memory consumption.
To enable it, install <literal>pkgconfig</literal> and the Boehm
garbage collector, and pass the flag <option>--enable-gc</option> to
<command>configure</command>.</para>
<para>To build this manual and the man-pages you need the <para>To build this manual and the man-pages you need the
<command>xmllint</command> and <command>xsltproc</command> programs, <command>xmllint</command> and <command>xsltproc</command> 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 modify the parser or when you are building from the Subversion
repository.</para> repository.</para>
<para>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 <filename>externals/</filename> directory. See
<filename>externals/Makefile.am</filename> for the precise URLs of
this packages. Alternatively, if you already have it installed, you
can use <command>configure</command>'s <option>--with-bzip2</option>
options to point to their respective locations.</para>
<para>Nix can optionally use the <link
xlink:href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm
garbage collector</link> to reduce the evaluators memory consumption.
To enable it, install <literal>pkgconfig</literal> and the Boehm
garbage collector, and pass the flag <option>--enable-gc</option> to
<command>configure</command>.</para>
</section> </section>

67
externals/Makefile.am vendored
View file

@ -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

View file

@ -20,7 +20,7 @@ let
buildInputs = buildInputs =
[ curl bison24 flex2535 perl libxml2 libxslt w3m bzip2 [ curl bison24 flex2535 perl libxml2 libxslt w3m bzip2
tetex dblatex nukeReferences pkgconfig git tetex dblatex nukeReferences pkgconfig sqlite git
]; ];
configureFlags = '' configureFlags = ''
@ -33,17 +33,10 @@ let
postUnpack = '' postUnpack = ''
# Clean up when building from a working tree. # 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 = '' 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. # TeX needs a writable font cache.
export VARTEXFONTS=$TMPDIR/texfonts export VARTEXFONTS=$TMPDIR/texfonts
''; '';
@ -78,11 +71,10 @@ let
name = "nix"; name = "nix";
src = tarball; src = tarball;
buildInputs = [ curl perl bzip2 openssl pkgconfig boehmgc ]; buildInputs = [ curl perl bzip2 openssl pkgconfig sqlite boehmgc ];
configureFlags = '' configureFlags = ''
--disable-init-state --disable-init-state
--with-bzip2=${bzip2} --with-sqlite=${sqlite}
--with-dbi=${perlPackages.DBI}/lib/perl5/site_perl --with-dbi=${perlPackages.DBI}/lib/perl5/site_perl
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
--enable-gc --enable-gc
@ -98,14 +90,13 @@ let
src = tarball; src = tarball;
buildInputs = buildInputs =
[ curl perl bzip2 openssl [ curl perl bzip2 openssl pkgconfig sqlite
# These are for "make check" only: # These are for "make check" only:
graphviz libxml2 libxslt graphviz libxml2 libxslt
]; ];
configureFlags = '' configureFlags = ''
--disable-init-state --disable-init-state
--with-bzip2=${bzip2} --with-sqlite=${sqlite}
--with-dbi=${perlPackages.DBI}/lib/perl5/site_perl --with-dbi=${perlPackages.DBI}/lib/perl5/site_perl
--with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl --with-dbd-sqlite=${perlPackages.DBDSQLite}/lib/perl5/site_perl
''; '';

View file

@ -4,10 +4,10 @@ libexec_PROGRAMS = bsdiff bspatch
bsdiff_SOURCES = bsdiff.c bsdiff_SOURCES = bsdiff.c
bsdiff_LDADD = ${bzip2_lib} bsdiff_LDADD = -lbz2
bspatch_SOURCES = bspatch.c 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}

View file

@ -10,12 +10,12 @@ pkginclude_HEADERS = \
globals.hh references.hh pathlocks.hh \ globals.hh references.hh pathlocks.hh \
worker-protocol.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 EXTRA_DIST = schema.sql
AM_CXXFLAGS = -Wall \ AM_CXXFLAGS = -Wall \
${sqlite_include} -I$(srcdir)/.. -I$(srcdir)/../libutil \ -I$(srcdir)/.. -I$(srcdir)/../libutil \
-DNIX_STORE_DIR=\"$(storedir)\" \ -DNIX_STORE_DIR=\"$(storedir)\" \
-DNIX_DATA_DIR=\"$(datadir)\" \ -DNIX_DATA_DIR=\"$(datadir)\" \
-DNIX_STATE_DIR=\"$(localstatedir)/nix\" \ -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \

View file

@ -3,7 +3,7 @@ pkglib_LTLIBRARIES = libutil.la
libutil_la_SOURCES = util.cc hash.cc serialise.cc \ libutil_la_SOURCES = util.cc hash.cc serialise.cc \
archive.cc xml-writer.cc immutable.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 \ pkginclude_HEADERS = util.hh hash.hh serialise.hh \
archive.hh xml-writer.hh types.hh immutable.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 if !HAVE_OPENSSL
libutil_la_SOURCES += \ libutil_la_SOURCES += \
md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h
else
libutil_la_LIBADD += @OPENSSL_LIBS@
endif endif
AM_CXXFLAGS = -Wall -I$(srcdir)/.. AM_CXXFLAGS = -Wall -I$(srcdir)/..

View file

@ -14,8 +14,7 @@
-e "s^@system\@^$(system)^g" \ -e "s^@system\@^$(system)^g" \
-e "s^@shell\@^$(bash)^g" \ -e "s^@shell\@^$(bash)^g" \
-e "s^@curl\@^$(curl)^g" \ -e "s^@curl\@^$(curl)^g" \
-e "s^@bzip2\@^$(bzip2_bin)/bzip2^g" \ -e "s^@bzip2\@^$(bzip2)^g" \
-e "s^@bzip2_bin_test\@^$(bzip2_bin_test)^g" \
-e "s^@perl\@^$(perl)^g" \ -e "s^@perl\@^$(perl)^g" \
-e "s^@perlFlags\@^$(perlFlags)^g" \ -e "s^@perlFlags\@^$(perlFlags)^g" \
-e "s^@coreutils\@^$(coreutils)^g" \ -e "s^@coreutils\@^$(coreutils)^g" \

View file

@ -29,15 +29,10 @@ export PATH=$NIX_BIN_DIR:$TOP/scripts:$PATH
export NIX_BUILD_HOOK= export NIX_BUILD_HOOK=
export PERL=perl export PERL=perl
export PERL5LIB=$TOP/perl/lib:$PERL5LIB 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 dot=@dot@
export xmllint="@xmllint@" export xmllint="@xmllint@"
export xmlflags="@xmlflags@" export xmlflags="@xmlflags@"
export xsltproc="@xsltproc@" export xsltproc="@xsltproc@"
export sqlite3="@sqlite_bin@/bin/sqlite3"
export SHELL="@shell@" export SHELL="@shell@"
export version=@version@ export version=@version@

View file

@ -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-build $NIX_BIN_DIR/
ln -s $TOP/scripts/nix-pull $NIX_BIN_DIR/ ln -s $TOP/scripts/nix-pull $NIX_BIN_DIR/
mkdir -p $NIX_BIN_DIR/nix/substituters 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 ln -s $TOP/scripts/copy-from-other-stores.pl $NIX_BIN_DIR/nix/substituters
cat > "$NIX_CONF_DIR"/nix.conf <<EOF cat > "$NIX_CONF_DIR"/nix.conf <<EOF