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