summary refs log tree commit diff
path: root/pkgs/development/libraries/boost
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-02-20 21:09:26 -0800
committerAdam Joseph <adam@westernsemico.com>2022-04-12 15:21:43 -0700
commit1c5154846809853016a07d2bc8e48827de72e01c (patch)
treedcf55e250aa0b9609578ab5bead2e5ebf2448d0a /pkgs/development/libraries/boost
parent909ab02b84a7fba22a82b43d76b658da80d170e7 (diff)
downloadnixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar.gz
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar.bz2
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar.lz
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar.xz
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.tar.zst
nixpkgs-1c5154846809853016a07d2bc8e48827de72e01c.zip
boost: support for cross-compiling boost to a mips64 target
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/development/libraries/boost')
-rw-r--r--pkgs/development/libraries/boost/generic.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index 17698216b8d..12fbf13fa9a 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -84,7 +84,7 @@ let
     # TODO: make this unconditional
   ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "address-model=${toString stdenv.hostPlatform.parsed.cpu.bits}"
-    "architecture=${toString stdenv.hostPlatform.parsed.cpu.family}"
+    "architecture=${if stdenv.hostPlatform.isMips64 then "mips64" else toString stdenv.hostPlatform.parsed.cpu.family}"
     "binary-format=${toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
     "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}"
 
@@ -92,7 +92,8 @@ let
     # https://www.boost.org/doc/libs/1_66_0/libs/context/doc/html/context/architectures.html
     "abi=${if stdenv.hostPlatform.parsed.cpu.family == "arm" then "aapcs"
            else if stdenv.hostPlatform.isWindows then "ms"
-           else if stdenv.hostPlatform.isMips then "o32"
+           else if stdenv.hostPlatform.isMips32 then "o32"
+           else if stdenv.hostPlatform.isMips64n64 then "n64"
            else "sysv"}"
   ] ++ optional (link != "static") "runtime-link=${runtime-link}"
     ++ optional (variant == "release") "debug-symbols=off"
@@ -133,6 +134,13 @@ stdenv.mkDerivation {
       sha256 = "15d2a636hhsb1xdyp44x25dyqfcaws997vnp9kl1mhzvxjzz7hb0";
       stripLen = 1;
     })
+  ++ optional (versionAtLeast version "1.65" && versionOlder version "1.70") (fetchpatch {
+    # support for Mips64n64 appeared in boost-context 1.70; this patch won't apply to pre-1.65 cleanly
+    url = "https://github.com/boostorg/context/commit/e3f744a1862164062d579d1972272d67bdaa9c39.patch";
+    sha256 = "sha256-qjQy1b4jDsIRrI+UYtcguhvChrMbGWO0UlEzEJHYzRI=";
+    stripLen = 1;
+    extraPrefix = "libs/context/";
+  })
   ++ optional (and (versionAtLeast version "1.70") (!versionAtLeast version "1.73")) ./cmake-paths.patch
   ++ optional (versionAtLeast version "1.73") ./cmake-paths-173.patch
   ++ optional (version == "1.77.0") (fetchpatch {
@@ -150,6 +158,14 @@ stdenv.mkDerivation {
                  ++ optional ((versionOlder version "1.57") || version == "1.58") "x86_64-darwin"
                  ++ optionals (versionOlder version "1.73") lib.platforms.riscv;
     maintainers = with maintainers; [ hjones2199 ];
+
+    broken =
+      # boost-context lacks support for the N32 ABI on mips64.  The build
+      # will succeed, but packages depending on boost-context will fail with
+      # a very cryptic error message.
+      stdenv.hostPlatform.isMips64n32 ||
+      # the patch above does not apply cleanly to pre-1.65 boost
+      (stdenv.hostPlatform.isMips64n64 && (versionOlder version "1.65"));
   };
 
   preConfigure = optionalString useMpi ''