git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #42476 from obsidiansystems/boost-cross

Boost cross compilation fixes

commit49a16a290e68ebb1ef5acadf25cf149d0d530d05 authorMatthew Justin Bauer <mjbauer95@gmail.com> dateSat 23 Jun 2018, 23:19 (8 years ago) parent99e12fcf45211b
2 files changed+19−6
pkgs/build-support/cc-wrapper/default.nix+4 pkgs/development/libraries/boost/generic.nix+15−6
pkgs/build-support/cc-wrapper/default.nix+4
@@ -280,6 +280,10 @@ stdenv.mkDerivation {
280280 hardening_unsupported_flags+=" pic"
281281 ''
282282
283+ + optionalString targetPlatform.isMinGW ''
284+ hardening_unsupported_flags+=" stackprotector"
285+ ''
286+
283287 + ''
284288 substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
285289 substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
pkgs/development/libraries/boost/generic.nix+15−6
@@ -1,8 +1,7 @@
11{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
22, which
33, buildPackages, buildPlatform, hostPlatform
4−, toolset ? /**/ if stdenv.cc.isClang then "clang"
5− else if stdenv.cc.isGNU && hostPlatform != buildPlatform then "gcc-cross"
4+, toolset ? /**/ if stdenv.cc.isClang then "clang"
65 else null
76, enableRelease ? true
87, enableDebug ? false
@@ -58,16 +57,26 @@ let
5857 "link=${link}"
5958 "-sEXPAT_INCLUDE=${expat.dev}/include"
6059 "-sEXPAT_LIBPATH=${expat.out}/lib"
60+
61+ # TODO: make this unconditional
62+ ] ++ optionals (hostPlatform != buildPlatform) [
63+ "address-model=${toString hostPlatform.parsed.cpu.bits}"
64+ "architecture=${toString hostPlatform.parsed.cpu.family}"
65+ "binary-format=${toString hostPlatform.parsed.kernel.execFormat.name}"
66+ "target-os=${toString hostPlatform.parsed.kernel.name}"
67+
68+ # adapted from table in boost manual
69+ # https://www.boost.org/doc/libs/1_66_0/libs/context/doc/html/context/architectures.html
70+ "abi=${if hostPlatform.parsed.cpu.family == "arm" then "aapcs"
71+ else if hostPlatform.isWindows then "ms"
72+ else if hostPlatform.isMips then "o32"
73+ else "sysv"}"
6174 ] ++ optional (link != "static") "runtime-link=${runtime-link}"
6275 ++ optional (variant == "release") "debug-symbols=off"
6376 ++ optional (toolset != null) "toolset=${toolset}"
6477 ++ optional (mpi != null || hostPlatform != buildPlatform) "--user-config=user-config.jam"
6578 ++ optionals (hostPlatform.libc == "msvcrt") [
66− "target-os=windows"
6779 "threadapi=win32"
68− "binary-format=pe"
69− "address-model=${toString hostPlatform.parsed.cpu.bits}"
70− "architecture=x86"
7180 ]);
7281
7382in