Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 boehmgc, 7 buildPackages, 8 coverageAnalysis ? null, 9 gawk, 10 gmp, 11 libffi, 12 libtool, 13 libunistring, 14 makeWrapper, 15 pkg-config, 16 pkgsBuildBuild, 17 readline, 18}: 19 20let 21 # Do either a coverage analysis build or a standard build. 22 builder = if coverageAnalysis != null then coverageAnalysis else stdenv.mkDerivation; 23in 24builder rec { 25 pname = "guile"; 26 version = "2.2.7"; 27 28 src = fetchurl { 29 url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz"; 30 sha256 = "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"; 31 }; 32 33 outputs = [ 34 "out" 35 "dev" 36 "info" 37 ]; 38 setOutputFlags = false; # $dev gets into the library otherwise 39 40 depsBuildBuild = [ 41 buildPackages.stdenv.cc 42 ] 43 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) pkgsBuildBuild.guile_2_2; 44 nativeBuildInputs = [ 45 makeWrapper 46 pkg-config 47 ]; 48 buildInputs = [ 49 libffi 50 libtool 51 libunistring 52 readline 53 ]; 54 propagatedBuildInputs = [ 55 boehmgc 56 gmp 57 58 # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' 59 # flags for them without corresponding '-L' flags. Adding them here will add 60 # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, 61 # see below. 62 libtool 63 libunistring 64 ]; 65 66 # According to Bernhard M. Wiedemann <bwiedemann suse de> on 67 # #reproducible-builds on irc.oftc.net, (2020-01-29): they had to 68 # build Guile without parallel builds to make it reproducible. 69 # 70 # re: https://issues.guix.gnu.org/issue/20272 71 # re: https://build.opensuse.org/request/show/732638 72 enableParallelBuilding = false; 73 74 patches = [ 75 # Read the header of the patch to more info 76 ./eai_system.patch 77 ] 78 ++ lib.optional (coverageAnalysis != null) ./gcov-file-name.patch 79 ++ lib.optional stdenv.hostPlatform.isDarwin (fetchpatch { 80 url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; 81 sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; 82 }); 83 84 # Explicitly link against libgcc_s, to work around the infamous 85 # "libgcc_s.so.1 must be installed for pthread_cancel to work". 86 87 # don't have "libgcc_s.so.1" on clang 88 LDFLAGS = lib.optionalString (stdenv.cc.isGNU && !stdenv.hostPlatform.isStatic) "-lgcc_s"; 89 90 configureFlags = [ 91 "--with-libreadline-prefix=${lib.getDev readline}" 92 ] 93 ++ lib.optionals stdenv.hostPlatform.isSunOS [ 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=${lib.getDev gmp}" 99 100 # Same for these (?). 101 "--with-libunistring-prefix=${libunistring}" 102 103 # See below. 104 "--without-threads" 105 ]; 106 107 postInstall = '' 108 wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" 109 '' 110 # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for 111 # why `--with-libunistring-prefix' and similar options coming from 112 # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. 113 + '' 114 sed -i "$out/lib/pkgconfig/guile"-*.pc \ 115 -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; 116 s|^Cflags:\(.*\)$|Cflags: -I${libunistring.dev}/include \1|g ; 117 s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; 118 s|includedir=$out|includedir=$dev|g 119 " 120 ''; 121 122 # make check doesn't work on darwin 123 # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper. 124 doCheck = false; 125 doInstallCheck = doCheck; 126 127 setupHook = ./setup-hook-2.2.sh; 128 129 passthru = rec { 130 effectiveVersion = lib.versions.majorMinor version; 131 siteCcacheDir = "lib/guile/${effectiveVersion}/site-ccache"; 132 siteDir = "share/guile/site/${effectiveVersion}"; 133 }; 134 135 meta = with lib; { 136 homepage = "https://www.gnu.org/software/guile/"; 137 description = "Embeddable Scheme implementation"; 138 longDescription = '' 139 GNU Guile is an implementation of the Scheme programming language, with 140 support for many SRFIs, packaged for use in a wide variety of 141 environments. In addition to implementing the R5RS Scheme standard and a 142 large subset of R6RS, Guile includes a module system, full access to POSIX 143 system calls, networking support, multiple threads, dynamic linking, a 144 foreign function call interface, and powerful string processing. 145 ''; 146 license = licenses.lgpl3Plus; 147 maintainers = with maintainers; [ ludo ]; 148 platforms = platforms.all; 149 }; 150}