Merge: boost fixes for mingw

- Dynamic linking won't work, it seems.
- When using a native python, the extension isn't built,
  so let's not depend on it.
This commit is contained in:
Vladimír Čunát 2016-04-23 10:52:51 +02:00
commit 0483bc0ee3
1 changed files with 26 additions and 14 deletions

View File

@ -1,11 +1,11 @@
{ stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames { stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
, toolset ? if stdenv.cc.isClang then "clang" else null , toolset ? if stdenv.cc.isClang then "clang" else null
, enableRelease ? true , enableRelease ? true
, enableDebug ? false , enableDebug ? false
, enableSingleThreaded ? false , enableSingleThreaded ? false
, enableMultiThreaded ? true , enableMultiThreaded ? true
, enableShared ? true , enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now
, enableStatic ? false , enableStatic ? !enableShared
, enablePIC ? false , enablePIC ? false
, enableExceptions ? false , enableExceptions ? false
, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic)) , taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
@ -76,8 +76,14 @@ let
"--user-config=user-config.jam" "--user-config=user-config.jam"
"toolset=gcc-cross" "toolset=gcc-cross"
"--without-python" "--without-python"
] ++ optionals (stdenv.cross.libc == "msvcrt") [
"target-os=windows"
"threadapi=win32"
"binary-format=pe"
"address-model=${if hasPrefix "x86_64-" stdenv.cross.config then "64" else "32"}"
"architecture=x86"
]; ];
crossB2Args = concatMapStringsSep " " (genericB2Flags ++ crossB2Flags); crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
builder = b2Args: '' builder = b2Args: ''
./b2 ${b2Args} ./b2 ${b2Args}
@ -108,6 +114,8 @@ let
find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
-exec sed '1i#line 1 "{}"' -i '{}' \; -exec sed '1i#line 1 "{}"' -i '{}' \;
) )
'' + optionalString (stdenv.cross.libc or null == "msvcrt") ''
${stdenv.cross.config}-ranlib "$lib"/lib/*.a
''; '';
in in
@ -143,14 +151,15 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ icu expat zlib bzip2 python ] buildInputs = [ expat zlib bzip2 libiconv ]
++ stdenv.lib.optionals (! stdenv ? cross) [ python icu ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
configureScript = "./bootstrap.sh"; configureScript = "./bootstrap.sh";
configureFlags = commonConfigureFlags ++ [ configureFlags = commonConfigureFlags
"--with-icu=${icu.dev}" ++ [ "--with-python=${python.interpreter}" ]
"--with-python=${python.interpreter}" ++ optional (! stdenv ? cross) "--with-icu=${icu.dev}"
] ++ optional (toolset != null) "--with-toolset=${toolset}"; ++ optional (toolset != null) "--with-toolset=${toolset}";
buildPhase = builder nativeB2Args; buildPhase = builder nativeB2Args;
@ -162,15 +171,10 @@ stdenv.mkDerivation {
setOutputFlags = false; setOutputFlags = false;
crossAttrs = rec { crossAttrs = rec {
buildInputs = [ expat.crossDrv zlib.crossDrv bzip2.crossDrv ];
# 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 # We want to substitute the contents of configureFlags, removing thus the
# usual --build and --host added on cross building. # usual --build and --host added on cross building.
preConfigure = '' preConfigure = ''
export configureFlags="--without-icu ${concatStringsSep " " commonConfigureFlags}" export configureFlags="--without-icu ${concatStringsSep " " commonConfigureFlags}"
set -x
cat << EOF > user-config.jam cat << EOF > user-config.jam
using gcc : cross : $crossConfig-g++ ; using gcc : cross : $crossConfig-g++ ;
EOF EOF
@ -178,5 +182,13 @@ stdenv.mkDerivation {
buildPhase = builder crossB2Args; buildPhase = builder crossB2Args;
installPhase = installer crossB2Args; installPhase = installer crossB2Args;
postFixup = fixup; postFixup = fixup;
} // optionalAttrs (stdenv.cross.libc == "msvcrt") {
patches = fetchurl {
url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
+ "boost-mingw.patch";
sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
};
patchFlags = "-p0";
}; };
} }