lol
1{ lib
2, stdenv
3, fetchurl
4, buildPackages
5, gawk
6, gmp
7, libtool
8, makeWrapper
9, pkg-config
10, pkgsBuildBuild
11, readline
12}:
13
14stdenv.mkDerivation rec {
15 pname = "guile";
16 version = "1.8.8";
17
18 src = fetchurl {
19 url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
20 sha256 = "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3";
21 };
22
23 outputs = [ "out" "dev" "info" ];
24 setOutputFlags = false; # $dev gets into the library otherwise
25
26 # GCC 4.6 raises a number of set-but-unused warnings.
27 configureFlags = [
28 "--disable-error-on-warning"
29 ]
30 # Guile needs patching to preset results for the configure tests about
31 # pthreads, which work only in native builds.
32 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
33 "--with-threads=no";
34
35 depsBuildBuild = [
36 buildPackages.stdenv.cc
37 ]
38 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
39 pkgsBuildBuild.guile_1_8;
40 nativeBuildInputs = [
41 makeWrapper
42 pkg-config
43 ];
44 buildInputs = [
45 libtool
46 readline
47 ];
48 propagatedBuildInputs = [
49 gmp
50
51 # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l'
52 # flags for them without corresponding '-L' flags. Adding them here will add
53 # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags,
54 # see below.
55 libtool
56 ];
57
58 patches = [
59 # Fix doc snarfing with GCC 4.5.
60 ./cpp-4.5.patch
61 # Self explanatory
62 ./CVE-2016-8605.patch
63 ];
64
65 preBuild = ''
66 sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c
67 '';
68
69 postInstall = ''
70 wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
71 ''
72 # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for
73 # why `--with-libunistring-prefix' and similar options coming from
74 # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64.
75 + ''
76 sed -i "$out/lib/pkgconfig/guile"-*.pc \
77 -e "s|-lltdl|-L${libtool.lib}/lib -lltdl|g"
78 '';
79
80 # One test fails.
81 # ERROR: file: "libtest-asmobs", message: "file not found"
82 # This is fixed here:
83 # <https://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=a0aa1e5b69d6ef0311aeea8e4b9a94eae18a1aaf>.
84 doCheck = false;
85 doInstallCheck = doCheck;
86
87 setupHook = ./setup-hook-1.8.sh;
88
89 meta = with lib; {
90 homepage = "https://www.gnu.org/software/guile/";
91 description = "Embeddable Scheme implementation";
92 longDescription = ''
93 GNU Guile is an implementation of the Scheme programming language, with
94 support for many SRFIs, packaged for use in a wide variety of
95 environments. In addition to implementing the R5RS Scheme standard and a
96 large subset of R6RS, Guile includes a module system, full access to POSIX
97 system calls, networking support, multiple threads, dynamic linking, a
98 foreign function call interface, and powerful string processing.
99 '';
100 license = licenses.lgpl3Plus;
101 maintainers = with maintainers; [ ludo ];
102 platforms = platforms.all;
103 };
104}