nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 173 lines 5.0 kB view raw
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.0.13"; 27 28 src = fetchurl { 29 url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz"; 30 sha256 = "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p"; 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_0; 44 45 nativeBuildInputs = [ 46 makeWrapper 47 pkg-config 48 ]; 49 buildInputs = [ 50 readline 51 libtool 52 libunistring 53 libffi 54 ]; 55 propagatedBuildInputs = [ 56 boehmgc 57 gmp 58 59 # These ones aren't normally needed here, but `libguile*.la' has '-l' 60 # flags for them without corresponding '-L' flags. Adding them here will 61 # add the needed `-L' flags. As for why the `.la' file lacks the `-L' 62 # flags, see below. 63 libtool 64 libunistring 65 ]; 66 67 enableParallelBuilding = true; 68 69 patches = [ 70 # Small fixes to Clang compiler 71 ./clang.patch 72 # Self-explanatory 73 ./disable-gc-sensitive-tests.patch 74 # Read the header of the patch to more info 75 ./eai_system.patch 76 # RISC-V endianness 77 ./riscv.patch 78 # Fixes stability issues with 00-repl-server.test 79 (fetchpatch { 80 url = "https://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4"; 81 sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v"; 82 }) 83 ] 84 ++ (lib.optional (coverageAnalysis != null) ./gcov-file-name.patch) 85 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 86 ./filter-mkostemp-darwin.patch 87 (fetchpatch { 88 url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; 89 sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; 90 }) 91 ]; 92 93 configureFlags = [ 94 "--with-libreadline-prefix" 95 ] 96 ++ lib.optionals stdenv.hostPlatform.isSunOS [ 97 # Make sure the right <gmp.h> is found, and not the incompatible 98 # /usr/include/mp.h from OpenSolaris. See 99 # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html> 100 # for details. 101 "--with-libgmp-prefix=${lib.getDev gmp}" 102 103 # Same for these (?). 104 "--with-libreadline-prefix=${lib.getDev readline}" 105 "--with-libunistring-prefix=${libunistring}" 106 107 # See below. 108 "--without-threads" 109 ]; 110 111 env = { 112 NIX_CFLAGS_COMPILE = "-std=gnu17"; 113 } 114 // lib.optionalAttrs (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isMusl) { 115 # Explicitly link against libgcc_s, to work around the infamous 116 # "libgcc_s.so.1 must be installed for pthread_cancel to work". 117 # don't have "libgcc_s.so.1" on darwin 118 LDFLAGS = "-lgcc_s"; 119 }; 120 121 postInstall = '' 122 wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" 123 '' 124 # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for 125 # why `--with-libunistring-prefix' and similar options coming from 126 # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. 127 + '' 128 sed -i "$out/lib/pkgconfig/guile"-*.pc \ 129 -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; 130 s|^Cflags:\(.*\)$|Cflags: -I${libunistring.dev}/include \1|g ; 131 s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; 132 s|includedir=$out|includedir=$dev|g 133 " 134 ''; 135 136 # make check doesn't work on darwin 137 # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper. 138 doCheck = false; 139 doInstallCheck = doCheck; 140 141 setupHook = ./setup-hook-2.0.sh; 142 143 passthru = rec { 144 effectiveVersion = lib.versions.majorMinor version; 145 siteCcacheDir = "lib/guile/${effectiveVersion}/site-ccache"; 146 siteDir = "share/guile/site/${effectiveVersion}"; 147 }; 148 149 meta = { 150 homepage = "https://www.gnu.org/software/guile/"; 151 description = "Embeddable Scheme implementation"; 152 longDescription = '' 153 GNU Guile is an implementation of the Scheme programming language, with 154 support for many SRFIs, packaged for use in a wide variety of 155 environments. In addition to implementing the R5RS Scheme standard and 156 a large subset of R6RS, Guile includes a module system, full access to 157 POSIX system calls, networking support, multiple threads, dynamic 158 linking, a foreign function call interface, and powerful string 159 processing. 160 ''; 161 license = lib.licenses.lgpl3Plus; 162 maintainers = with lib.maintainers; [ ludo ]; 163 platforms = lib.platforms.all; 164 }; 165} 166 167// 168 169 (lib.optionalAttrs (!stdenv.hostPlatform.isLinux) { 170 # Work around <https://bugs.gnu.org/14201>. 171 SHELL = stdenv.shell; 172 CONFIG_SHELL = stdenv.shell; 173 })