2022-11-27 09:42:12 +00:00
|
|
|
{ fetchurl
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
, gnum4
|
|
|
|
, texinfo
|
|
|
|
, texLive
|
|
|
|
, automake
|
|
|
|
, autoconf
|
|
|
|
, libtool
|
|
|
|
, ghostscript
|
|
|
|
, ncurses
|
|
|
|
, enableX11 ? false, libX11
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2021-08-08 23:34:03 +00:00
|
|
|
version = "11.2";
|
|
|
|
bootstrapFromC = ! ((stdenv.isLinux && stdenv.isAarch64) || stdenv.isx86_64);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
arch = if stdenv.isLinux && stdenv.isAarch64 then
|
|
|
|
"-aarch64le"
|
|
|
|
else
|
|
|
|
"-x86-64";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2022-03-10 19:12:11 +00:00
|
|
|
pname = "mit-scheme" + lib.optionalString enableX11 "-x11";
|
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# MIT/GNU Scheme is not bootstrappable, so it's recommended to compile from
|
|
|
|
# the platform-specific tarballs, which contain pre-built binaries. It
|
|
|
|
# leads to more efficient code than when building the tarball that contains
|
|
|
|
# generated C code instead of those binaries.
|
|
|
|
src =
|
2021-08-08 23:34:03 +00:00
|
|
|
if stdenv.isLinux && stdenv.isAarch64
|
2020-04-24 23:36:52 +00:00
|
|
|
then fetchurl {
|
2021-08-08 23:34:03 +00:00
|
|
|
url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-aarch64le.tar.gz";
|
|
|
|
sha256 = "11maixldk20wqb5js5p4imq221zz9nf27649v9pqkdf8fv7rnrs9";
|
2020-09-25 04:45:31 +00:00
|
|
|
} else fetchurl {
|
2020-04-24 23:36:52 +00:00
|
|
|
url = "mirror://gnu/mit-scheme/stable.pkg/${version}/mit-scheme-${version}-x86-64.tar.gz";
|
2021-08-08 23:34:03 +00:00
|
|
|
sha256 = "17822hs9y07vcviv2af17p3va7qh79dird49nj50bwi9rz64ia3w";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
buildInputs = [ ncurses ] ++ lib.optionals enableX11 [ libX11 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
(cd src && ./configure)
|
|
|
|
(cd doc && ./configure)
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
cd src
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
${if bootstrapFromC
|
|
|
|
then "./etc/make-liarc.sh --prefix=$out"
|
|
|
|
else "make compile-microcode"}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
cd ../doc
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
make
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
make prefix=$out install -C src
|
|
|
|
make prefix=$out install -C doc
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/mit-scheme${arch}-${version} --set MITSCHEME_LIBRARY_PATH \
|
|
|
|
$out/lib/mit-scheme${arch}-${version}
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper gnum4 texinfo texLive automake ghostscript autoconf libtool ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# XXX: The `check' target doesn't exist.
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "MIT/GNU Scheme, a native code Scheme compiler";
|
|
|
|
|
|
|
|
longDescription =
|
|
|
|
'' MIT/GNU Scheme is an implementation of the Scheme programming
|
|
|
|
language, providing an interpreter, compiler, source-code debugger,
|
|
|
|
integrated Emacs-like editor, and a large runtime library. MIT/GNU
|
|
|
|
Scheme is best suited to programming large applications with a rapid
|
|
|
|
development cycle.
|
|
|
|
'';
|
|
|
|
|
|
|
|
homepage = "https://www.gnu.org/software/mit-scheme/";
|
|
|
|
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
|
|
|
|
maintainers = [ ];
|
|
|
|
|
|
|
|
# Build fails on Cygwin and Darwin:
|
|
|
|
# <http://article.gmane.org/gmane.lisp.scheme.mit-scheme.devel/489>.
|
|
|
|
platforms = platforms.gnu ++ platforms.linux ++ platforms.freebsd;
|
|
|
|
};
|
|
|
|
}
|