at master 3.5 kB view raw
1{ 2 fetchurl, 3 fetchDebianPatch, 4 lib, 5 stdenv, 6 makeWrapper, 7 gnum4, 8 texinfo, 9 texliveSmall, 10 automake, 11 autoconf, 12 libtool, 13 ghostscript, 14 ncurses, 15 enableX11 ? false, 16 libX11, 17}: 18 19let 20 version = "12.1"; 21 bootstrapFromC = 22 !((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isx86_64); 23 24 arch = 25 if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64 then "-aarch64le" else "-x86-64"; 26in 27stdenv.mkDerivation { 28 pname = "mit-scheme" + lib.optionalString enableX11 "-x11"; 29 inherit version; 30 31 # MIT/GNU Scheme is not bootstrappable, so it's recommended to compile from 32 # the platform-specific tarballs, which contain pre-built binaries. It 33 # leads to more efficient code than when building the tarball that contains 34 # generated C code instead of those binaries. 35 src = 36 if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64 then 37 fetchurl { 38 url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-aarch64le.tar.gz"; 39 sha256 = "12ra9bc93x8g07impbd8jr6djjzwpb9qvh9zhxvvrba3332zx3vh"; 40 } 41 else 42 fetchurl { 43 url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-x86-64.tar.gz"; 44 sha256 = "035f92vni0vqmgj9hq2i7vwasz7crx52wll4823vhfkm1qdv5ywc"; 45 }; 46 47 patches = [ 48 (fetchDebianPatch { 49 pname = "mit-scheme"; 50 version = "12.1"; 51 debianRevision = "4"; 52 patch = "0006-texi2any-_html-fix.patch"; 53 hash = "sha256-tTAK/xRGubQeiqe1Nbo+m3CYmscXxQ8HAlIl4kSZxk8="; 54 }) 55 ]; 56 57 buildInputs = [ ncurses ] ++ lib.optionals enableX11 [ libX11 ]; 58 59 configurePhase = '' 60 runHook preConfigure 61 (cd src && ./configure) 62 (cd doc && ./configure) 63 runHook postConfigure 64 ''; 65 66 env.NIX_CFLAGS_COMPILE = toString [ 67 # Needed with GCC 12 68 "-Wno-error=array-parameter" 69 "-Wno-error=use-after-free" 70 ]; 71 72 buildPhase = '' 73 runHook preBuild 74 cd src 75 76 ${if bootstrapFromC then "./etc/make-liarc.sh --prefix=$out" else "make compile-microcode"} 77 78 cd ../doc 79 80 make 81 82 cd .. 83 84 runHook postBuild 85 ''; 86 87 installPhase = '' 88 runHook preInstall 89 make prefix=$out install -C src 90 make prefix=$out install -C doc 91 runHook postInstall 92 ''; 93 94 postFixup = '' 95 wrapProgram $out/bin/mit-scheme${arch}-${version} --set MITSCHEME_LIBRARY_PATH \ 96 $out/lib/mit-scheme${arch}-${version} 97 ''; 98 99 nativeBuildInputs = [ 100 makeWrapper 101 gnum4 102 texinfo 103 (texliveSmall.withPackages ( 104 ps: with ps; [ 105 epsf 106 ps.texinfo 107 ] 108 )) 109 automake 110 ghostscript 111 autoconf 112 libtool 113 ]; 114 115 # XXX: The `check' target doesn't exist. 116 doCheck = false; 117 118 meta = with lib; { 119 description = "MIT/GNU Scheme, a native code Scheme compiler"; 120 121 longDescription = '' 122 MIT/GNU Scheme is an implementation of the Scheme programming 123 language, providing an interpreter, compiler, source-code debugger, 124 integrated Emacs-like editor, and a large runtime library. MIT/GNU 125 Scheme is best suited to programming large applications with a rapid 126 development cycle. 127 ''; 128 129 homepage = "https://www.gnu.org/software/mit-scheme/"; 130 131 license = licenses.gpl2Plus; 132 133 maintainers = [ ]; 134 135 # Build fails on Cygwin and Darwin: 136 # <http://article.gmane.org/gmane.lisp.scheme.mit-scheme.devel/489>. 137 platforms = platforms.gnu ++ platforms.linux ++ platforms.freebsd; 138 }; 139}