From 0fcad047b9563f5b5ec4442d5337d8fc5f802397 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 25 Feb 2018 20:36:43 -0500 Subject: [PATCH 1/5] Guile: Fix cross-compilation (cherry picked from commit f79fa7794176c11530a3be3f05ffbc10f1e53003) --- pkgs/development/interpreters/guile/2.0.nix | 10 +++++----- pkgs/development/interpreters/guile/default.nix | 10 +++++----- pkgs/development/interpreters/guile/riscv.patch | 13 +++++++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 pkgs/development/interpreters/guile/riscv.patch 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))))) + From 8415682658752910f9142165d483f861aa8d99be Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 5 Mar 2018 18:45:16 -0500 Subject: [PATCH 2/5] guile: Fix cross more, including 1.8 (cherry picked from commit 76bc1d3fae46f28dd28cad8bc998dba74d03285e) --- pkgs/development/interpreters/guile/1.8.nix | 37 +++++++++++-------- pkgs/development/interpreters/guile/2.0.nix | 17 +++++---- .../interpreters/guile/default.nix | 15 +++++--- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/pkgs/development/interpreters/guile/1.8.nix b/pkgs/development/interpreters/guile/1.8.nix index c50a5fbab07..6a2fdbdea43 100644 --- a/pkgs/development/interpreters/guile/1.8.nix +++ b/pkgs/development/interpreters/guile/1.8.nix @@ -1,25 +1,33 @@ -{ fetchurl, stdenv, libtool, readline, gmp -, gawk, makeWrapper }: +{ stdenv, buildPackages +, buildPlatform, hostPlatform +, fetchurl, makeWrapper, gawk, pkgconfig +, libtool, readline, gmp +}: stdenv.mkDerivation rec { name = "guile-1.8.8"; src = fetchurl { - url = "mirror://gnu/guile/" + name + ".tar.gz"; + url = "mirror://gnu/guile/${name}.tar.gz"; sha256 = "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"; }; - patches = [ ./cpp-4.5.patch ]; - outputs = [ "out" "dev" "info" ]; setOutputFlags = false; # $dev gets into the library otherwise # GCC 4.6 raises a number of set-but-unused warnings. configureFlags = [ "--disable-error-on-warning" ]; - nativeBuildInputs = [ makeWrapper gawk ]; - propagatedBuildInputs = [ readline gmp libtool ]; - selfNativeBuildInput = true; + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (hostPlatform != buildPlatform) + buildPackages.buildPackages.guile_1_8; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + buildInputs = [ readline libtool ]; + + propagatedBuildInputs = [ gmp ]; + + patches = [ ./cpp-4.5.patch ]; + postInstall = '' wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" @@ -46,17 +54,16 @@ stdenv.mkDerivation rec { setupHook = ./setup-hook.sh; meta = { - description = "GNU Guile, an embeddable Scheme interpreter"; + description = "Embeddable Scheme implementation"; + homepage = http://www.gnu.org/software/guile/; + license = stdenv.lib.licenses.lgpl2Plus; + maintainers = [ stdenv.lib.maintainers.ludo ]; + platforms = stdenv.lib.platforms.unix; + longDescription = '' GNU Guile is an interpreter for the Scheme programming language, packaged as a library that can be embedded into programs to make them extensible. It supports many SRFIs. ''; - - homepage = http://www.gnu.org/software/guile/; - license = stdenv.lib.licenses.lgpl2Plus; - - maintainers = [ stdenv.lib.maintainers.ludo ]; - platforms = stdenv.lib.platforms.unix; }; } diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix index ea8ff924064..afd90397e23 100644 --- a/pkgs/development/interpreters/guile/2.0.nix +++ b/pkgs/development/interpreters/guile/2.0.nix @@ -1,6 +1,8 @@ -{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring -, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null -, hostPlatform, buildPackages +{ stdenv, buildPackages +, buildPlatform, hostPlatform +, fetchpatch, fetchurl, makeWrapper, gawk, pkgconfig +, libffi, libtool, readline, gmp, boehmgc, libunistring +, coverageAnalysis ? null, gnu ? null }: # Do either a coverage analysis build or a standard build. @@ -19,12 +21,13 @@ outputs = [ "out" "dev" "info" ]; setOutputFlags = false; # $dev gets into the library otherwise - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++ - stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile_2_0; + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (hostPlatform != buildPlatform) + buildPackages.buildPackages.guile_2_0; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; buildInputs = [ readline libtool libunistring libffi ]; - propagatedBuildInputs = [ gmp boehmgc ] + propagatedBuildInputs = [ gmp boehmgc ] # XXX: These ones aren't normally needed here, but since # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index fc7cd2b60ea..dc6e18ae1af 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -1,6 +1,8 @@ -{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring -, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null -, hostPlatform, buildPackages +{ stdenv, buildPackages +, buildPlatform, hostPlatform +, fetchurl, makeWrapper, gawk, pkgconfig +, libffi, libtool, readline, gmp, boehmgc, libunistring +, coverageAnalysis ? null, gnu ? null }: # Do either a coverage analysis build or a standard build. @@ -20,9 +22,10 @@ outputs = [ "out" "dev" "info" ]; setOutputFlags = false; # $dev gets into the library otherwise - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ makeWrapper gawk pkgconfig ] ++ - stdenv.lib.optional stdenv.isCross buildPackages.buildPackages.guile; + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (hostPlatform != buildPlatform) + buildPackages.buildPackages.guile; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; buildInputs = [ readline libtool libunistring libffi ]; propagatedBuildInputs = [ gmp boehmgc ] From 9a4cc93522aeee59fafe01bcba65d1675675f9d6 Mon Sep 17 00:00:00 2001 From: Michael Alan Dorman Date: Wed, 21 Mar 2018 14:20:04 -0400 Subject: [PATCH 3/5] guile-1.8: Fix and clean up `libtool` propagation fixes Fixes #37548 (cherry picked from commit 2119041dbf4323ff3e92e605b70b75fc2c252741) --- pkgs/development/interpreters/guile/1.8.nix | 36 +++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/pkgs/development/interpreters/guile/1.8.nix b/pkgs/development/interpreters/guile/1.8.nix index 6a2fdbdea43..cf42c9a7b68 100644 --- a/pkgs/development/interpreters/guile/1.8.nix +++ b/pkgs/development/interpreters/guile/1.8.nix @@ -24,19 +24,19 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; buildInputs = [ readline libtool ]; - propagatedBuildInputs = [ gmp ]; + propagatedBuildInputs = [ + gmp + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add + # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, + # see below. + libtool + ]; + patches = [ ./cpp-4.5.patch ]; - - postInstall = '' - wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" - ''; - - preBuild = '' - sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c - ''; - # Guile needs patching to preset results for the configure tests # about pthreads, which work only in native builds. preConfigure = '' @@ -45,6 +45,22 @@ stdenv.mkDerivation rec { fi ''; + preBuild = '' + sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c + ''; + + + postInstall = '' + wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" + '' + # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for + # why `--with-libunistring-prefix' and similar options coming from + # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ + -e "s|-lltdl|-L${libtool.lib}/lib -lltdl|g" + ''; + # One test fails. # ERROR: file: "libtest-asmobs", message: "file not found" # This is fixed here: From d77dab3ecc3b7db3724368966ce791c378739a90 Mon Sep 17 00:00:00 2001 From: Michael Alan Dorman Date: Wed, 21 Mar 2018 14:20:04 -0400 Subject: [PATCH 4/5] guile: Fix and clean up `libtool` propagation fixes Fixes #37548 (cherry picked from commit 72984210ab06dc3a56a1c2b666f3528ec5dcaadf) --- pkgs/development/interpreters/guile/2.0.nix | 16 ++++++++++------ pkgs/development/interpreters/guile/default.nix | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix index afd90397e23..2c9aec5b695 100644 --- a/pkgs/development/interpreters/guile/2.0.nix +++ b/pkgs/development/interpreters/guile/2.0.nix @@ -27,12 +27,15 @@ nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; buildInputs = [ readline libtool libunistring libffi ]; - propagatedBuildInputs = [ gmp boehmgc ] - # XXX: These ones aren't normally needed here, but since - # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add + propagatedBuildInputs = [ + gmp boehmgc + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, # see below. - ++ [ libtool libunistring ]; + libtool libunistring + ]; enableParallelBuilding = true; @@ -70,11 +73,12 @@ postInstall = '' wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" - + '' # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for # why `--with-libunistring-prefix' and similar options coming from # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. - sed -i "$out/lib/pkgconfig/guile-2.0.pc" \ + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ; s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index dc6e18ae1af..3d5c51dc420 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -28,12 +28,15 @@ nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; buildInputs = [ readline libtool libunistring libffi ]; - propagatedBuildInputs = [ gmp boehmgc ] - # XXX: These ones aren't normally needed here, but since - # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add + propagatedBuildInputs = [ + gmp boehmgc + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, # see below. - ++ [ libtool libunistring ]; + libtool libunistring + ]; enableParallelBuilding = true; @@ -66,11 +69,12 @@ postInstall = '' wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" - + '' # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for # why `--with-libunistring-prefix' and similar options coming from # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. - sed -i "$out/lib/pkgconfig/guile-2.2.pc" \ + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ; s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; From 130a0cbde6feae6b51f35a007c78cc8a25a6c3c9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 10 May 2018 12:16:29 -0400 Subject: [PATCH 5/5] guile: Remove old crossAttrs We fixed the linker issue with propagated dependencies. (cherry picked from commit 515ca1a7c8ca1c57b472826ae2b5dd2965b8b4bf) --- pkgs/development/interpreters/guile/2.0.nix | 9 --------- pkgs/development/interpreters/guile/default.nix | 9 --------- 2 files changed, 18 deletions(-) diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix index 2c9aec5b695..3a11dc78c6c 100644 --- a/pkgs/development/interpreters/guile/2.0.nix +++ b/pkgs/development/interpreters/guile/2.0.nix @@ -92,15 +92,6 @@ setupHook = ./setup-hook-2.0.sh; - crossAttrs.preConfigure = - stdenv.lib.optionalString (hostPlatform.isHurd) - # On GNU, libgc depends on libpthread, but the cross linker doesn't - # know where to find libpthread, which leads to erroneous test failures - # in `configure', where `-pthread' and `-lpthread' aren't explicitly - # passed. So it needs some help (XXX). - "export LDFLAGS=-Wl,-rpath-link=${gnu.libpthreadCross}/lib"; - - meta = { description = "Embeddable Scheme implementation"; homepage = http://www.gnu.org/software/guile/; diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index 3d5c51dc420..748b3c5e200 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -88,15 +88,6 @@ setupHook = ./setup-hook-2.2.sh; - crossAttrs.preConfigure = - stdenv.lib.optionalString (hostPlatform.isHurd) - # On GNU, libgc depends on libpthread, but the cross linker doesn't - # know where to find libpthread, which leads to erroneous test failures - # in `configure', where `-pthread' and `-lpthread' aren't explicitly - # passed. So it needs some help (XXX). - "export LDFLAGS=-Wl,-rpath-link=${gnu.libpthreadCross}/lib"; - - meta = { description = "Embeddable Scheme implementation"; homepage = http://www.gnu.org/software/guile/;