1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-05-11 16:47:02 +00:00

boost: finish 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.
- Replace flags missing on this branch, such as `isCrossWin`.
This commit is contained in:
Vladimír Čunát 2016-02-16 20:36:51 +01:00
parent fb74d901d7
commit 2b0d725854

View file

@ -4,8 +4,8 @@
, 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,11 +76,11 @@ let
"--user-config=user-config.jam" "--user-config=user-config.jam"
"toolset=gcc-cross" "toolset=gcc-cross"
"--without-python" "--without-python"
] ++ optionals stdenv.isCrossWin [ ] ++ optionals (stdenv.cross.libc == "msvcrt") [
"target-os=windows" "target-os=windows"
"threadapi=win32" "threadapi=win32"
"binary-format=pe" "binary-format=pe"
"address-model=${if stdenv.isCross64 then "64" else "32"}" "address-model=${if hasPrefix "x86_64-" stdenv.cross.config then "64" else "32"}"
"architecture=x86" "architecture=x86"
]; ];
crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
@ -114,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
@ -149,14 +151,15 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
buildInputs = [ icu expat zlib bzip2 python ] buildInputs = [ expat zlib bzip2 ]
++ 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;
@ -168,10 +171,6 @@ 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 = ''
@ -183,7 +182,7 @@ stdenv.mkDerivation {
buildPhase = builder crossB2Args; buildPhase = builder crossB2Args;
installPhase = installer crossB2Args; installPhase = installer crossB2Args;
postFixup = fixup; postFixup = fixup;
} // optionalAttrs stdenv.isCrossWin { } // optionalAttrs (stdenv.cross.libc == "msvcrt") {
patches = fetchurl { patches = fetchurl {
url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/" url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
+ "boost-mingw.patch"; + "boost-mingw.patch";