2010-05-07 10:32:46 +01:00
|
|
|
{ stdenv, fetchurl, icu, expat, zlib, bzip2, python
|
|
|
|
, enableRelease ? true
|
|
|
|
, enableDebug ? false
|
|
|
|
, enableSingleThreaded ? false
|
|
|
|
, enableMultiThreaded ? true
|
|
|
|
, enableShared ? true
|
|
|
|
, enableStatic ? false
|
|
|
|
, enablePIC ? false
|
2011-08-07 01:38:11 +01:00
|
|
|
, enableExceptions ? false
|
2010-05-07 10:32:46 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
variant = stdenv.lib.concatStringsSep ","
|
|
|
|
(stdenv.lib.optional enableRelease "release" ++
|
|
|
|
stdenv.lib.optional enableDebug "debug");
|
|
|
|
|
|
|
|
threading = stdenv.lib.concatStringsSep ","
|
|
|
|
(stdenv.lib.optional enableSingleThreaded "single" ++
|
|
|
|
stdenv.lib.optional enableMultiThreaded "multi");
|
|
|
|
|
|
|
|
link = stdenv.lib.concatStringsSep ","
|
|
|
|
(stdenv.lib.optional enableShared "shared" ++
|
|
|
|
stdenv.lib.optional enableStatic "static");
|
|
|
|
|
|
|
|
# To avoid library name collisions
|
|
|
|
finalLayout = if ((enableRelease && enableDebug) ||
|
|
|
|
(enableSingleThreaded && enableMultiThreaded) ||
|
|
|
|
(enableShared && enableStatic)) then
|
|
|
|
"tagged" else "system";
|
|
|
|
|
2011-08-07 01:38:11 +01:00
|
|
|
cflags = if (enablePIC && enableExceptions) then
|
|
|
|
"cflags=-fPIC -fexceptions cxxflags=-fPIC linkflags=-fPIC"
|
|
|
|
else if (enablePIC) then
|
|
|
|
"cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC"
|
|
|
|
else if (enableExceptions) then
|
|
|
|
"cflags=-fexceptions"
|
|
|
|
else
|
|
|
|
"";
|
2010-05-07 10:32:46 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2011-07-12 15:24:01 +01:00
|
|
|
name = "boost-1.47.0";
|
2010-05-07 10:32:46 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://boost.org/";
|
|
|
|
description = "Boost C++ Library Collection";
|
|
|
|
license = "boost-license";
|
|
|
|
|
|
|
|
maintainers = [ stdenv.lib.maintainers.simons ];
|
|
|
|
};
|
|
|
|
|
|
|
|
src = fetchurl {
|
2011-07-12 15:24:01 +01:00
|
|
|
url = "mirror://sourceforge/boost/boost_1_47_0.tar.bz2";
|
|
|
|
sha256 = "815a5d9faac4dbd523fbcf3fe1065e443c0bbf43427c44aa423422c6ec4c2e31";
|
2010-05-07 10:32:46 +01:00
|
|
|
};
|
|
|
|
|
2011-07-21 00:11:16 +01:00
|
|
|
# See <http://svn.boost.org/trac/boost/ticket/4688>.
|
|
|
|
patches = [ ./boost_filesystem.patch ];
|
|
|
|
|
2010-09-14 15:47:16 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2010-05-07 10:32:46 +01:00
|
|
|
buildInputs = [icu expat zlib bzip2 python];
|
|
|
|
|
|
|
|
configureScript = "./bootstrap.sh";
|
|
|
|
configureFlags = "--with-icu=${icu} --with-python=${python}/bin/python";
|
|
|
|
|
2011-07-12 15:24:01 +01:00
|
|
|
buildPhase = "./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${finalLayout} variant=${variant} threading=${threading} link=${link} ${cflags} install";
|
2010-05-07 10:32:46 +01:00
|
|
|
|
|
|
|
installPhase = ":";
|
2010-09-15 10:56:06 +01:00
|
|
|
|
|
|
|
crossAttrs = rec {
|
|
|
|
buildInputs = [ expat.hostDrv zlib.hostDrv bzip2.hostDrv ];
|
|
|
|
# all buildInputs set previously fell into propagatedBuildInputs, as usual, so we have to
|
|
|
|
# override them.
|
|
|
|
propagatedBuildInputs = buildInputs;
|
|
|
|
# We want to substitute the contents of configureFlags, removing thus the
|
|
|
|
# usual --build and --host added on cross building.
|
|
|
|
preConfigure = ''
|
|
|
|
export configureFlags="--prefix=$out --without-icu"
|
|
|
|
'';
|
|
|
|
buildPhase = ''
|
|
|
|
set -x
|
|
|
|
cat << EOF > user-config.jam
|
|
|
|
using gcc : cross : $crossConfig-g++ ;
|
|
|
|
EOF
|
2011-07-12 15:24:01 +01:00
|
|
|
./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat.hostDrv}/include -sEXPAT_LIBPATH=${expat.hostDrv}/lib --layout=${finalLayout} --user-config=user-config.jam toolset=gcc-cross variant=${variant} threading=${threading} link=${link} ${cflags} --without-python install
|
2010-09-15 10:56:06 +01:00
|
|
|
'';
|
|
|
|
};
|
2010-05-07 10:32:46 +01:00
|
|
|
}
|