summary refs log tree commit diff
path: root/pkgs/development/interpreters/guile
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-25 20:36:43 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-13 11:36:29 -0400
commit0fcad047b9563f5b5ec4442d5337d8fc5f802397 (patch)
treee12d6c9a9d88f8d320dea41f979a47c957788a5d /pkgs/development/interpreters/guile
parentf2004e62870aa6b21dd52612295da973194c7c73 (diff)
downloadnixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar.gz
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar.bz2
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar.lz
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar.xz
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.tar.zst
nixpkgs-0fcad047b9563f5b5ec4442d5337d8fc5f802397.zip
Guile: Fix cross-compilation
(cherry picked from commit f79fa7794176c11530a3be3f05ffbc10f1e53003)
Diffstat (limited to 'pkgs/development/interpreters/guile')
-rw-r--r--pkgs/development/interpreters/guile/2.0.nix10
-rw-r--r--pkgs/development/interpreters/guile/default.nix10
-rw-r--r--pkgs/development/interpreters/guile/riscv.patch13
3 files changed, 23 insertions, 10 deletions
diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix
index 5746300fca0..ea8ff924064 100644
--- a/pkgs/development/interpreters/guile/2.0.nix
+++ b/pkgs/development/interpreters/guile/2.0.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
 , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
-, hostPlatform
+, hostPlatform, buildPackages
 }:
 
 # Do either a coverage analysis build or a standard build.
@@ -19,7 +19,9 @@
   outputs = [ "out" "dev" "info" ];
   setOutputFlags = false; # $dev gets into the library otherwise
 
-  nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++
+    stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile_2_0;
   buildInputs = [ readline libtool libunistring libffi ];
   propagatedBuildInputs = [ gmp boehmgc ]
 
@@ -29,9 +31,6 @@
     # see below.
     ++ [ libtool libunistring ];
 
-  # A native Guile 2.0 is needed to cross-build Guile.
-  selfNativeBuildInput = true;
-
   enableParallelBuilding = true;
 
   patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch
@@ -40,6 +39,7 @@
       url = "http://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4";
       sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v";
     })
+    ./riscv.patch
   ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index e10c5fbb568..fc7cd2b60ea 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
 , libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null
-, hostPlatform
+, hostPlatform, buildPackages
 }:
 
 # Do either a coverage analysis build or a standard build.
@@ -20,7 +20,9 @@
   outputs = [ "out" "dev" "info" ];
   setOutputFlags = false; # $dev gets into the library otherwise
 
-  nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++
+    stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile;
   buildInputs = [ readline libtool libunistring libffi ];
 
   propagatedBuildInputs = [ gmp boehmgc ]
@@ -30,13 +32,11 @@
     # see below.
     ++ [ libtool libunistring ];
 
-  # A native Guile 2.0 is needed to cross-build Guile.
-  selfNativeBuildInput = true;
-
   enableParallelBuilding = true;
 
   patches = [
     ./eai_system.patch
+    ./riscv.patch
   ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
diff --git a/pkgs/development/interpreters/guile/riscv.patch b/pkgs/development/interpreters/guile/riscv.patch
new file mode 100644
index 00000000000..b835e161383
--- /dev/null
+++ b/pkgs/development/interpreters/guile/riscv.patch
@@ -0,0 +1,13 @@
+diff --git a/module/system/base/target.scm b/module/system/base/target.scm
+index 95ab8d8c9..93616f4a3 100644
+--- a/module/system/base/target.scm
++++ b/module/system/base/target.scm
+@@ -86,6 +86,8 @@
+              (endianness big))
+             ((string=? "aarch64" cpu)
+              (endianness little))
++            ((string-match "riscv[1-9][0-9]*" cpu)
++             (endianness little))
+             (else
+              (error "unknown CPU endianness" cpu)))))
+