nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ fetchurl, lib, stdenv, makeWrapper, gnum4, texinfo, texLive, automake,
2 autoconf, libtool, ghostscript, ncurses,
3 enableX11 ? false, xlibsWrapper }:
4
5let
6 version = "11.2";
7 bootstrapFromC = ! ((stdenv.isLinux && stdenv.isAarch64) || stdenv.isx86_64);
8
9 arch = if stdenv.isLinux && stdenv.isAarch64 then
10 "-aarch64le"
11 else
12 "-x86-64";
13in
14stdenv.mkDerivation {
15 pname = "mit-scheme" + lib.optionalString enableX11 "-x11";
16 inherit version;
17
18 # MIT/GNU Scheme is not bootstrappable, so it's recommended to compile from
19 # the platform-specific tarballs, which contain pre-built binaries. It
20 # leads to more efficient code than when building the tarball that contains
21 # generated C code instead of those binaries.
22 src =
23 if stdenv.isLinux && stdenv.isAarch64
24 then fetchurl {
25 url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-aarch64le.tar.gz";
26 sha256 = "11maixldk20wqb5js5p4imq221zz9nf27649v9pqkdf8fv7rnrs9";
27 } else fetchurl {
28 url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-x86-64.tar.gz";
29 sha256 = "17822hs9y07vcviv2af17p3va7qh79dird49nj50bwi9rz64ia3w";
30 };
31
32 buildInputs = [ ncurses ] ++ lib.optional enableX11 xlibsWrapper;
33
34 configurePhase = ''
35 runHook preConfigure
36 (cd src && ./configure)
37 (cd doc && ./configure)
38 runHook postConfigure
39 '';
40
41 buildPhase = ''
42 runHook preBuild
43 cd src
44
45 ${if bootstrapFromC
46 then "./etc/make-liarc.sh --prefix=$out"
47 else "make compile-microcode"}
48
49 cd ../doc
50
51 make
52
53 cd ..
54
55 runHook postBuild
56 '';
57
58
59 installPhase = ''
60 runHook preInstall
61 make prefix=$out install -C src
62 make prefix=$out install -C doc
63 runHook postInstall
64 '';
65
66 postFixup = ''
67 wrapProgram $out/bin/mit-scheme${arch}-${version} --set MITSCHEME_LIBRARY_PATH \
68 $out/lib/mit-scheme${arch}-${version}
69 '';
70
71 nativeBuildInputs = [ makeWrapper gnum4 texinfo texLive automake ghostscript autoconf libtool ];
72
73 # XXX: The `check' target doesn't exist.
74 doCheck = false;
75
76 meta = with lib; {
77 description = "MIT/GNU Scheme, a native code Scheme compiler";
78
79 longDescription =
80 '' MIT/GNU Scheme is an implementation of the Scheme programming
81 language, providing an interpreter, compiler, source-code debugger,
82 integrated Emacs-like editor, and a large runtime library. MIT/GNU
83 Scheme is best suited to programming large applications with a rapid
84 development cycle.
85 '';
86
87 homepage = "https://www.gnu.org/software/mit-scheme/";
88
89 license = licenses.gpl2Plus;
90
91 maintainers = [ ];
92
93 # Build fails on Cygwin and Darwin:
94 # <http://article.gmane.org/gmane.lisp.scheme.mit-scheme.devel/489>.
95 platforms = platforms.gnu ++ platforms.linux ++ platforms.freebsd;
96 };
97}