Skip to content

Commit

Permalink
Drop the externals directory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edolstra committed Mar 18, 2012
1 parent 2e0322e commit b006a31
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 181 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -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

Expand Down
84 changes: 22 additions & 62 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)


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 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/.])])


# Look for SQLite, a required dependency.
PKG_CHECK_MODULES([SQLITE3], [sqlite3], [CXXFLAGS="$SQLITE3_CFLAGS $CXXFLAGS"])


# Whether to use the Boehm garbage collector.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
47 changes: 30 additions & 17 deletions doc/manual/installation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,36 @@ from source</emphasis>. Binary releases (e.g., RPMs) have no
prerequisites.</para>

<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 evaluator’s 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
<command>xmllint</command> and <command>xsltproc</command> programs,
Expand All @@ -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.</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 evaluator’s 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>


Expand Down
67 changes: 0 additions & 67 deletions externals/Makefile.am

This file was deleted.

17 changes: 4 additions & 13 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -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
'';
Expand Down Expand Up @@ -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
Expand All @@ -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
'';
Expand Down
6 changes: 3 additions & 3 deletions src/bsdiff-4.3/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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}
4 changes: 2 additions & 2 deletions src/libstore/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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\" \
Expand Down
4 changes: 3 additions & 1 deletion src/libutil/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ 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

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)/..
3 changes: 1 addition & 2 deletions substitute.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
5 changes: 0 additions & 5 deletions tests/common.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
Expand Down
Loading

0 comments on commit b006a31

Please sign in to comment.