1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 makeWrapper,
7 gmp,
8 gcc,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "mkcl";
13 version = "1.1.11";
14
15 src = fetchFromGitHub {
16 owner = "jcbeaudoin";
17 repo = "mkcl";
18 rev = "v${version}";
19 sha256 = "0i2bfkda20lfypis6i4m7srfz6miyf66d8knp693d6sms73m2l26";
20 };
21
22 patches = [
23 # "Array sys_siglist[] never was part of the public interface. Replace it with calls to psiginfo()."
24 (fetchpatch {
25 name = "sys_siglist.patch";
26 url = "https://github.com/jcbeaudoin/MKCL/commit/0777dd08254c88676f4f101117b10786b22111d6.patch";
27 sha256 = "1dnr1jzha77nrxs22mclrcqyqvxxn6q1sfn35qjs77fi3jcinjsc";
28 })
29
30 # Pull upstream fix for -fno-common toolchins like gcc-10
31 (fetchpatch {
32 name = "fno-common.patch";
33 url = "https://gitlab.common-lisp.net/mkcl/mkcl/-/commit/ef1981dbf4ceb1793cd6434e66e97b3db48b4ea0.patch";
34 sha256 = "00y6qanwvgb1r4haaqmvz7lbqa51l4wcnns1rwlfgvcvkpjc3dif";
35 })
36 ];
37
38 nativeBuildInputs = [ makeWrapper ];
39
40 propagatedBuildInputs = [ gmp ];
41
42 hardeningDisable = [ "format" ];
43
44 configureFlags = [
45 "GMP_CFLAGS=-I${lib.getDev gmp}/include"
46 "GMP_LDFLAGS=-L${gmp.out}/lib"
47 ];
48
49 # tinycc configure flags copied from the tinycc derivation.
50 postConfigure = ''
51 (
52 cd contrib/tinycc;
53 ./configure --cc=cc \
54 --elfinterp=$(< $NIX_CC/nix-support/dynamic-linker) \
55 --crtprefix=${lib.getLib stdenv.cc.libc}/lib \
56 --sysincludepaths=${lib.getDev stdenv.cc.libc}/include:{B}/include \
57 --libpaths=${lib.getLib stdenv.cc.libc}/lib
58 )
59 '';
60
61 postInstall = ''
62 wrapProgram $out/bin/mkcl --prefix PATH : "${gcc}/bin"
63 '';
64
65 enableParallelBuilding = true;
66
67 meta = with lib; {
68 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
69 description = "ANSI Common Lisp Implementation";
70 homepage = "https://common-lisp.net/project/mkcl/";
71 license = licenses.lgpl2Plus;
72 mainProgram = "mkcl";
73 teams = [ lib.teams.lisp ];
74 platforms = platforms.linux;
75 };
76}