@@ -1,10 +1,11 @@
11{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
2+, buildPlatform, hostPlatform
23, toolset ? if stdenv.cc.isClang then "clang" else null
34, enableRelease ? true
45, enableDebug ? false
56, enableSingleThreaded ? false
67, enableMultiThreaded ? true
7−, enableShared ? !(stdenv.cross.libc or null == "msvcrt") # problems for now
8+, enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now
89, enableStatic ? !enableShared
910, enablePIC ? false
1011, enableExceptions ? false
@@ -76,11 +77,11 @@ let
7677 "--user-config=user-config.jam"
7778 "toolset=gcc-cross"
7879 "--without-python"
79− ] ++ optionals (stdenv.cross.libc == "msvcrt") [
80+ ] ++ optionals (hostPlatform.libc == "msvcrt") [
8081 "target-os=windows"
8182 "threadapi=win32"
8283 "binary-format=pe"
83− "address-model=${if hasPrefix "x86_64-" stdenv.cross.config then "64" else "32"}"
84+ "address-model=${toString hostPlatform.parsed.cpu.bits}"
8485 "architecture=x86"
8586 ];
8687 crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
@@ -110,8 +111,8 @@ let
110111 find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
111112 -exec sed '1i#line 1 "{}"' -i '{}' \;
112113 )
113− '' + optionalString (stdenv.cross.libc or null == "msvcrt") ''
114− ${stdenv.cross.config}-ranlib "$out/lib/"*.a
114+ '' + optionalString (hostPlatform.libc == "msvcrt") ''
115+ ${stdenv.cc.prefix}ranlib "$out/lib/"*.a
115116 '';
116117
117118in
@@ -147,13 +148,13 @@ stdenv.mkDerivation {
147148 enableParallelBuilding = true;
148149
149150 buildInputs = [ expat zlib bzip2 libiconv ]
150− ++ stdenv.lib.optionals (! stdenv ? cross) [ python icu ]
151+ ++ stdenv.lib.optionals (hostPlatform == buildPlatform) [ python icu ]
151152 ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
152153
153154 configureScript = "./bootstrap.sh";
154155 configureFlags = commonConfigureFlags
155156 ++ [ "--with-python=${python.interpreter}" ]
156− ++ optional (! stdenv ? cross) "--with-icu=${icu.dev}"
157+ ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}"
157158 ++ optional (toolset != null) "--with-toolset=${toolset}";
158159
159160 buildPhase = builder nativeB2Args;
@@ -177,7 +178,7 @@ stdenv.mkDerivation {
177178 buildPhase = builder crossB2Args;
178179 installPhase = installer crossB2Args;
179180 postFixup = fixup;
180− } // optionalAttrs (stdenv.cross.libc == "msvcrt") {
181+ } // optionalAttrs (hostPlatform.libc == "msvcrt") {
181182 patches = fetchurl {
182183 url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
183184 + "boost-mingw.patch";