1 # there are the following linking sets:
2 # - boot (not installed): without modules, only used when building clisp
3 # - base (default): contains readline and i18n, regexp and syscalls modules
5 # - full: contains base plus modules in withModules
28 , threadSupport ? (stdenv.hostPlatform.isx86 && ! stdenv.hostPlatform.isDarwin)
29 , x11Support ? (stdenv.hostPlatform.isx86 && ! stdenv.hostPlatform.isDarwin)
36 ++ lib.optionals stdenv.hostPlatform.isLinux [ "bindings/glibc" "zlib" ]
37 ++ lib.optional x11Support "clx/new-clx"
40 assert x11Support -> (libX11 != null && libXau != null && libXt != null
41 && libXpm != null && xorgproto != null && libXext != null);
44 ffcallAvailable = stdenv.hostPlatform.isLinux && (libffcall != null);
45 # Some modules need autoreconf called in their directory.
46 shouldReconfModule = name: name != "asdf";
50 version = "2.50pre20230112";
53 src = fetchFromGitLab {
56 rev = "bf72805c4dace982a6d3399ff4e7f7d5e77ab99a";
57 hash = "sha256-sQoN2FUg9BPaCgvCF91lFsU/zLja1NrgWsEIr2cPiqo=";
61 nativeBuildInputs = [ autoconf269 automake libtool ];
62 buildInputs = [libsigsegv]
63 ++ lib.optional (gettext != null) gettext
64 ++ lib.optional (ncurses != null) ncurses
65 ++ lib.optional (pcre != null) pcre
66 ++ lib.optional (zlib != null) zlib
67 ++ lib.optional (readline != null) readline
68 ++ lib.optional (ffcallAvailable && (libffi != null)) libffi
69 ++ lib.optional ffcallAvailable libffcall
70 ++ lib.optionals x11Support [
71 libX11 libXau libXt libXpm xorgproto libXext
75 ./gnulib_aarch64.patch
78 # First, replace port 9090 (rather low, can be used)
79 # with 64237 (much higher, IANA private area, not
80 # anything rememberable).
82 sed -e 's@9090@64237@g' -i tests/socket.tst
83 sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in
84 sed -i 's@1\.16\.2@${automake.version}@' src/aclocal.m4
85 find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i
88 preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin (''
91 autoreconf -f -i -I m4 -I glm4
93 '' + lib.concatMapStrings (x: ''
97 autoreconf -f -i -I "$root/src" -I "$root/src/m4" -I "$root/src/glm4"
99 '') (builtins.filter shouldReconfModule withModules));
101 configureFlags = [ "builddir" ]
102 ++ lib.optional (!dllSupport) "--without-dynamic-modules"
103 ++ lib.optional (readline != null) "--with-readline"
104 # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise
105 ++ lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi"
106 ++ lib.optional ffcallAvailable "--with-ffcall"
107 ++ lib.optional (!ffcallAvailable) "--without-ffcall"
108 ++ builtins.map (x: " --with-module=" + x) withModules
109 ++ lib.optional threadSupport "--with-threads=POSIX_THREADS";
112 sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
113 sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp
120 lib.optionalString (withModules != [])
121 (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full''
122 + lib.concatMapStrings (x: " " + x) withModules);
124 env.NIX_CFLAGS_COMPILE = "-O0 -falign-functions=${if stdenv.hostPlatform.is64bit then "8" else "4"}";
127 description = "ANSI Common Lisp Implementation";
128 homepage = "http://clisp.org";
129 mainProgram = "clisp";
130 maintainers = lib.teams.lisp.members;
131 license = lib.licenses.gpl2Plus;
132 platforms = with lib.platforms; linux ++ darwin;