lol
1{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
2, libffi, gawk, makeWrapper, coverageAnalysis ? null, gnu ? null }:
3
4# Do either a coverage analysis build or a standard build.
5(if coverageAnalysis != null
6 then coverageAnalysis
7 else stdenv.mkDerivation)
8
9(rec {
10 name = "guile-2.0.11";
11
12 src = fetchurl {
13 url = "mirror://gnu/guile/${name}.tar.xz";
14 sha256 = "1qh3j7308qvsjgwf7h94yqgckpbgz2k3yqdkzsyhqcafvfka9l5f";
15 };
16
17 nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
18 buildInputs = [ readline libtool libunistring libffi ];
19 propagatedBuildInputs = [ gmp boehmgc ]
20
21 # XXX: These ones aren't normally needed here, but since
22 # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add
23 # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags,
24 # see below.
25 ++ [ libtool libunistring ];
26
27 # A native Guile 2.0 is needed to cross-build Guile.
28 selfNativeBuildInput = true;
29
30 # Guile 2.0.11 repeatable fails with 8-core parallel building because
31 # libguile/vm-i-system.i is not created in time
32 enableParallelBuilding = false;
33
34 patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch ] ++
35 (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
36
37 # Explicitly link against libgcc_s, to work around the infamous
38 # "libgcc_s.so.1 must be installed for pthread_cancel to work".
39
40 # don't have "libgcc_s.so.1" on darwin
41 LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
42
43 postInstall = ''
44 wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
45
46 # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for
47 # why `--with-libunistring-prefix' and similar options coming from
48 # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64.
49 sed -i "$out/lib/pkgconfig/guile-2.0.pc" \
50 -e 's|-lunistring|-L${libunistring}/lib -lunistring|g ;
51 s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ;
52 s|-lltdl|-L${libtool}/lib -lltdl|g'
53 '';
54
55 # make check doesn't work on darwin
56 doCheck = !stdenv.isDarwin;
57
58 setupHook = ./setup-hook-2.0.sh;
59
60 crossAttrs.preConfigure =
61 stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
62 # On GNU, libgc depends on libpthread, but the cross linker doesn't
63 # know where to find libpthread, which leads to erroneous test failures
64 # in `configure', where `-pthread' and `-lpthread' aren't explicitly
65 # passed. So it needs some help (XXX).
66 "export LDFLAGS=-Wl,-rpath-link=${gnu.libpthreadCross}/lib";
67
68
69 meta = {
70 description = "Embeddable Scheme implementation";
71 homepage = http://www.gnu.org/software/guile/;
72 license = stdenv.lib.licenses.lgpl3Plus;
73 maintainers = with stdenv.lib.maintainers; [ ludo lovek323 ];
74 platforms = stdenv.lib.platforms.all;
75
76 longDescription = ''
77 GNU Guile is an implementation of the Scheme programming language, with
78 support for many SRFIs, packaged for use in a wide variety of
79 environments. In addition to implementing the R5RS Scheme standard
80 and a large subset of R6RS, Guile includes a module system, full access
81 to POSIX system calls, networking support, multiple threads, dynamic
82 linking, a foreign function call interface, and powerful string
83 processing.
84 '';
85 };
86}
87
88//
89
90(stdenv.lib.optionalAttrs stdenv.isSunOS {
91 # TODO: Move me above.
92 configureFlags =
93 [
94 # Make sure the right <gmp.h> is found, and not the incompatible
95 # /usr/include/mp.h from OpenSolaris. See
96 # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html>
97 # for details.
98 "--with-libgmp-prefix=${gmp}"
99
100 # Same for these (?).
101 "--with-libreadline-prefix=${readline}"
102 "--with-libunistring-prefix=${libunistring}"
103
104 # See below.
105 "--without-threads"
106 ];
107})
108
109//
110
111(stdenv.lib.optionalAttrs (!stdenv.isLinux) {
112 # Work around <http://bugs.gnu.org/14201>.
113 SHELL = "/bin/sh";
114 CONFIG_SHELL = "/bin/sh";
115}))