summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2021-11-14 14:31:09 +0000
committerRobert Scott <code@humanleg.org.uk>2021-11-14 22:25:09 +0000
commite4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422 (patch)
treed6d91ef5b958a19ce2e892dd76bd8c6445672a05
parentb3291561183882beec142b18497556a5f112d5e4 (diff)
downloadnixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar.gz
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar.bz2
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar.lz
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar.xz
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.tar.zst
nixpkgs-e4362cea6f3c3d8df03ae5e7a2e4f7a5fb8a8422.zip
monosat, python3Packages.monosat: fix for non-x86
-rw-r--r--pkgs/applications/science/logic/monosat/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/applications/science/logic/monosat/default.nix b/pkgs/applications/science/logic/monosat/default.nix
index 259cdcea443..b26c122064a 100644
--- a/pkgs/applications/science/logic/monosat/default.nix
+++ b/pkgs/applications/science/logic/monosat/default.nix
@@ -28,9 +28,18 @@ let
     })
   ];
 
+  # source behind __linux__ check assumes system is also x86 and
+  # tries to disable x86/x87-specific extended precision mode
+  # https://github.com/sambayless/monosat/issues/33
+  commonPostPatch = lib.optionalString (!(stdenv.isi686 || stdenv.isx86_64)) ''
+    substituteInPlace src/monosat/Main.cc \
+      --replace 'defined(__linux__)' '0'
+  '';
+
   core = stdenv.mkDerivation {
     name = "${pname}-${version}";
     inherit src patches;
+    postPatch = commonPostPatch;
     nativeBuildInputs = [ cmake ];
     buildInputs = [ zlib gmp jdk8 ];
 
@@ -66,7 +75,7 @@ let
 
     # After patching src, move to where the actually relevant source is. This could just be made
     # the sourceRoot if it weren't for the patch.
-    postPatch = ''
+    postPatch = commonPostPatch + ''
       cd src/monosat/api/python
     '' +
     # The relative paths here don't make sense for our Nix build