2022-11-27 09:42:12 +00:00
|
|
|
{ fetchurl
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
, gnum4
|
|
|
|
, texinfo
|
2023-11-16 04:20:00 +00:00
|
|
|
, texliveSmall
|
2022-11-27 09:42:12 +00:00
|
|
|
, automake
|
|
|
|
, autoconf
|
|
|
|
, libtool
|
|
|
|
, ghostscript
|
|
|
|
, ncurses
|
|
|
|
, enableX11 ? false, libX11
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "12.1";
|
2024-09-26 11:04:55 +00:00
|
|
|
bootstrapFromC = ! ((stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) || stdenv.hostPlatform.isx86_64);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
arch = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64 then
|
2021-08-08 23:34:03 +00:00
|
|
|
"-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 =
|
2024-09-26 11:04:55 +00:00
|
|
|
if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.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";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "12ra9bc93x8g07impbd8jr6djjzwpb9qvh9zhxvvrba3332zx3vh";
|
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";
|
2023-05-24 13:37:59 +00:00
|
|
|
sha256 = "035f92vni0vqmgj9hq2i7vwasz7crx52wll4823vhfkm1qdv5ywc";
|
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
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Needed with GCC 12
|
|
|
|
"-Wno-error=array-parameter"
|
|
|
|
"-Wno-error=use-after-free"
|
|
|
|
];
|
|
|
|
|
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
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper gnum4 texinfo (texliveSmall.withPackages (ps: with ps; [ epsf ps.texinfo ])) 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;
|
|
|
|
};
|
|
|
|
}
|