From ad033f7665c14133cd17225d97a8db79012ddcbe Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 11 Apr 2015 23:19:37 +0200 Subject: [PATCH 1/6] boost: Fix generation of crossB2Args. `concatMapStringsSep` actually needs a function to work on the list items, but it was probably a leftover from the refactor in af8654d. Signed-off-by: aszlig --- pkgs/development/libraries/boost/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 5b0c06bd6bb..65d188a86c5 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -77,7 +77,7 @@ let "toolset=gcc-cross" "--without-python" ]; - crossB2Args = concatMapStringsSep " " (genericB2Flags ++ crossB2Flags); + crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); builder = b2Args: '' ./b2 ${b2Args} From 2d760a28b3479bcbb39d512cf9930b46d17d5364 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 12 Apr 2015 10:32:18 +0200 Subject: [PATCH 2/6] boost: Supply some configure flags for mingw. Otherwise, Boost.Build is trying to compile against pthread and desperately searches for icu/iconv. Signed-off-by: aszlig --- pkgs/development/libraries/boost/generic.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 65d188a86c5..758d95309bb 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -76,6 +76,9 @@ let "--user-config=user-config.jam" "toolset=gcc-cross" "--without-python" + ] ++ optionals stdenv.isCrossWin [ + "target-os=windows" + "threadapi=win32" ]; crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); From 5f0f48c08b3c718d898b2f00b7b48a5bf6d3eb95 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 12 Apr 2015 10:34:06 +0200 Subject: [PATCH 3/6] boost: Reduce noise during cross compile. I guess the "set -x" was only left there for debugging, so I'm removing it because it let's the scrollback buffer explode ;-) Signed-off-by: aszlig --- pkgs/development/libraries/boost/generic.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 758d95309bb..51d3c911d67 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -173,7 +173,6 @@ stdenv.mkDerivation { # usual --build and --host added on cross building. preConfigure = '' export configureFlags="--without-icu ${concatStringsSep " " commonConfigureFlags}" - set -x cat << EOF > user-config.jam using gcc : cross : $crossConfig-g++ ; EOF From fb74d901d76d393be28b19651f5368b89db93d16 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 12 Apr 2015 12:01:07 +0200 Subject: [PATCH 4/6] boost: Add patch for mingw to use gas instead. The upstream sources only compile with masm, so we need to add a patch that translates the masm sources to GNU assembler. Unfortunately, this means, that "generic.nix" is no longer very much generic, but the versions we currently include work fine with the patch. Unfortunately, the boost build still doesn't finish, but we're getting there soon enough. The patch is from https://svn.boost.org/trac/boost/ticket/7262 and following the discussion it seems that the upstream authors are unwilling to add a gas version for the Windows platform. So in the long term we might need to find a better solution to that, like for example using Wine to run MASM. Signed-off-by: aszlig --- pkgs/development/libraries/boost/generic.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 51d3c911d67..561f65afa51 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -1,4 +1,4 @@ -{ stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames +{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames , toolset ? if stdenv.cc.isClang then "clang" else null , enableRelease ? true , enableDebug ? false @@ -79,6 +79,9 @@ let ] ++ optionals stdenv.isCrossWin [ "target-os=windows" "threadapi=win32" + "binary-format=pe" + "address-model=${if stdenv.isCross64 then "64" else "32"}" + "architecture=x86" ]; crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); @@ -180,5 +183,13 @@ stdenv.mkDerivation { buildPhase = builder crossB2Args; installPhase = installer crossB2Args; postFixup = fixup; + } // optionalAttrs stdenv.isCrossWin { + patches = fetchurl { + url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/" + + "boost-mingw.patch"; + sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj"; + }; + + patchFlags = "-p0"; }; } From 2b0d72585432832b96ed5cf117cf9035874dfce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 16 Feb 2016 20:36:51 +0100 Subject: [PATCH 5/6] 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`. --- pkgs/development/libraries/boost/generic.nix | 27 ++++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 561f65afa51..8835c58618a 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -4,8 +4,8 @@ , enableDebug ? false , enableSingleThreaded ? false , enableMultiThreaded ? true -, enableShared ? true -, enableStatic ? false +, enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now +, enableStatic ? !enableShared , enablePIC ? false , enableExceptions ? false , taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic)) @@ -76,11 +76,11 @@ let "--user-config=user-config.jam" "toolset=gcc-cross" "--without-python" - ] ++ optionals stdenv.isCrossWin [ + ] ++ optionals (stdenv.cross.libc == "msvcrt") [ "target-os=windows" "threadapi=win32" "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" ]; crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags); @@ -114,6 +114,8 @@ let find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ -exec sed '1i#line 1 "{}"' -i '{}' \; ) + '' + optionalString (stdenv.cross.libc or null == "msvcrt") '' + ${stdenv.cross.config}-ranlib "$lib"/lib/*.a ''; in @@ -149,14 +151,15 @@ stdenv.mkDerivation { 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; configureScript = "./bootstrap.sh"; - configureFlags = commonConfigureFlags ++ [ - "--with-icu=${icu.dev}" - "--with-python=${python.interpreter}" - ] ++ optional (toolset != null) "--with-toolset=${toolset}"; + configureFlags = commonConfigureFlags + ++ [ "--with-python=${python.interpreter}" ] + ++ optional (! stdenv ? cross) "--with-icu=${icu.dev}" + ++ optional (toolset != null) "--with-toolset=${toolset}"; buildPhase = builder nativeB2Args; @@ -168,10 +171,6 @@ stdenv.mkDerivation { setOutputFlags = false; 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 # usual --build and --host added on cross building. preConfigure = '' @@ -183,7 +182,7 @@ stdenv.mkDerivation { buildPhase = builder crossB2Args; installPhase = installer crossB2Args; postFixup = fixup; - } // optionalAttrs stdenv.isCrossWin { + } // optionalAttrs (stdenv.cross.libc == "msvcrt") { patches = fetchurl { url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/" + "boost-mingw.patch"; From 1bfc3a8965d54b88d132bf7368dac33919ba57e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 16 Feb 2016 20:44:54 +0100 Subject: [PATCH 6/6] boost: support libiconv, also on non-glibc platforms --- pkgs/development/libraries/boost/generic.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 8835c58618a..8e5579cb8ea 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames +{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv , toolset ? if stdenv.cc.isClang then "clang" else null , enableRelease ? true , enableDebug ? false @@ -151,7 +151,7 @@ stdenv.mkDerivation { enableParallelBuilding = true; - buildInputs = [ expat zlib bzip2 ] + buildInputs = [ expat zlib bzip2 libiconv ] ++ stdenv.lib.optionals (! stdenv ? cross) [ python icu ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;