2019-02-26 12:45:54 +01:00
|
|
|
{ stdenv, fetchurl, bootstrap_cmds, coreutils, glibc, m4, runtimeShell }:
|
2014-11-27 23:48:07 +01:00
|
|
|
|
2015-09-27 22:40:05 +02:00
|
|
|
let
|
|
|
|
options = rec {
|
2018-02-28 09:24:21 +01:00
|
|
|
/* TODO: there are also FreeBSD and Windows versions */
|
2015-09-27 22:40:05 +02:00
|
|
|
x86_64-linux = {
|
|
|
|
arch = "linuxx86";
|
2017-12-01 20:31:47 +01:00
|
|
|
sha256 = "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q";
|
2015-09-27 22:40:05 +02:00
|
|
|
runtime = "lx86cl64";
|
|
|
|
kernel = "linuxx8664";
|
|
|
|
};
|
|
|
|
i686-linux = {
|
|
|
|
arch = "linuxx86";
|
|
|
|
sha256 = x86_64-linux.sha256;
|
|
|
|
runtime = "lx86cl";
|
|
|
|
kernel = "linuxx8632";
|
|
|
|
};
|
|
|
|
armv7l-linux = {
|
|
|
|
arch = "linuxarm";
|
2017-12-01 20:31:47 +01:00
|
|
|
sha256 = "0p0l1dzsygb6i1xxgbipjpxkn46xhq3jm41a34ga1qqp4x8lkr62";
|
2015-09-27 22:40:05 +02:00
|
|
|
runtime = "armcl";
|
|
|
|
kernel = "linuxarm";
|
|
|
|
};
|
2018-02-28 09:24:21 +01:00
|
|
|
x86_64-darwin = {
|
|
|
|
arch = "darwinx86";
|
|
|
|
sha256 = "5adbea3d8b4a2e29af30d141f781c6613844f468c0ccfa11bae908c3e9641939";
|
|
|
|
runtime = "dx86cl64";
|
|
|
|
kernel = "darwinx8664";
|
|
|
|
};
|
2015-09-27 22:40:05 +02:00
|
|
|
armv6l-linux = armv7l-linux;
|
|
|
|
};
|
2019-08-13 23:52:01 +02:00
|
|
|
cfg = options.${stdenv.hostPlatform.system} or (throw "missing source url for platform ${stdenv.hostPlatform.system}");
|
2015-09-27 22:40:05 +02:00
|
|
|
in
|
2015-10-01 11:20:24 +02:00
|
|
|
|
2014-11-27 23:48:07 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "ccl";
|
2017-12-01 20:31:47 +01:00
|
|
|
version = "1.11.5";
|
2014-11-27 23:48:07 +01:00
|
|
|
|
2017-12-01 20:31:47 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/Clozure/ccl/releases/download/v${version}/ccl-${version}-${cfg.arch}.tar.gz";
|
2015-09-27 22:40:05 +02:00
|
|
|
sha256 = cfg.sha256;
|
2010-02-24 10:04:29 +01:00
|
|
|
};
|
|
|
|
|
2018-03-14 23:02:52 +01:00
|
|
|
buildInputs = if stdenv.isDarwin then [ bootstrap_cmds m4 ] else [ glibc m4 ];
|
2014-11-27 23:48:07 +01:00
|
|
|
|
2015-09-27 22:40:05 +02:00
|
|
|
CCL_RUNTIME = cfg.runtime;
|
|
|
|
CCL_KERNEL = cfg.kernel;
|
2014-11-27 23:48:07 +01:00
|
|
|
|
2018-02-28 09:24:21 +01:00
|
|
|
postPatch = if stdenv.isDarwin then ''
|
|
|
|
substituteInPlace lisp-kernel/${CCL_KERNEL}/Makefile \
|
|
|
|
--replace "M4 = gm4" "M4 = m4" \
|
|
|
|
--replace "dtrace" "/usr/sbin/dtrace" \
|
|
|
|
--replace "/bin/rm" "${coreutils}/bin/rm" \
|
|
|
|
--replace "/bin/echo" "${coreutils}/bin/echo"
|
|
|
|
|
|
|
|
substituteInPlace lisp-kernel/m4macros.m4 \
|
|
|
|
--replace "/bin/pwd" "${coreutils}/bin/pwd"
|
|
|
|
'' else ''
|
2014-11-29 07:14:53 +01:00
|
|
|
substituteInPlace lisp-kernel/${CCL_KERNEL}/Makefile \
|
|
|
|
--replace "/bin/rm" "${coreutils}/bin/rm" \
|
|
|
|
--replace "/bin/echo" "${coreutils}/bin/echo"
|
|
|
|
|
|
|
|
substituteInPlace lisp-kernel/m4macros.m4 \
|
|
|
|
--replace "/bin/pwd" "${coreutils}/bin/pwd"
|
|
|
|
'';
|
2010-02-24 10:04:29 +01:00
|
|
|
|
2014-11-29 07:14:53 +01:00
|
|
|
buildPhase = ''
|
2014-11-27 23:48:07 +01:00
|
|
|
make -C lisp-kernel/${CCL_KERNEL} clean
|
|
|
|
make -C lisp-kernel/${CCL_KERNEL} all
|
|
|
|
|
|
|
|
./${CCL_RUNTIME} -n -b -e '(ccl:rebuild-ccl :full t)' -e '(ccl:quit)'
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/share"
|
2014-11-27 23:48:07 +01:00
|
|
|
cp -r . "$out/share/ccl-installation"
|
2010-02-24 10:04:29 +01:00
|
|
|
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/bin"
|
2019-02-26 12:45:54 +01:00
|
|
|
echo -e '#!${runtimeShell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}"
|
2014-11-27 23:48:07 +01:00
|
|
|
chmod a+x "$out"/bin/"${CCL_RUNTIME}"
|
2017-06-28 20:33:58 +02:00
|
|
|
ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl
|
2014-11-27 23:48:07 +01:00
|
|
|
'';
|
|
|
|
|
2018-05-29 16:11:13 +02:00
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2015-10-01 11:20:24 +02:00
|
|
|
meta = with stdenv.lib; {
|
2010-02-24 10:04:29 +01:00
|
|
|
description = "Clozure Common Lisp";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://ccl.clozure.com/";
|
2015-11-24 23:26:26 +01:00
|
|
|
maintainers = with maintainers; [ raskin muflax tohl ];
|
2015-10-01 11:20:24 +02:00
|
|
|
platforms = attrNames options;
|
|
|
|
license = licenses.lgpl21;
|
2010-02-24 10:04:29 +01:00
|
|
|
};
|
|
|
|
}
|