@@ -0,0 +1,97 @@
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
6+{ stdenv, fetchhg, libsigsegv, gettext, ncurses, readline, libX11
7+, libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto
12+, threadSupport ? (stdenv.isi686 || stdenv.isx86_64)
13+, x11Support ? (stdenv.isi686 || stdenv.isx86_64)
19+ ++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ]
20+ ++ stdenv.lib.optional x11Support "clx/new-clx"
23+assert x11Support -> (libX11 != null && libXau != null && libXt != null
24+ && libXpm != null && xproto != null && libXext != null && xextproto != null);
26+stdenv.mkDerivation rec {
27+ v = "2.50pre20161201";
31+ url = "http://hg.code.sf.net/p/clisp/clisp";
33+ sha256 = "097igsfpn8xipnjapyf5hx6smzh04v4ncskxl747xxn6pgpq813z";
36+ inherit libsigsegv gettext coreutils;
38+ ffcallAvailable = stdenv.isLinux && (libffcall != null);
40+ buildInputs = [libsigsegv]
41+ ++ stdenv.lib.optional (gettext != null) gettext
42+ ++ stdenv.lib.optional (ncurses != null) ncurses
43+ ++ stdenv.lib.optional (pcre != null) pcre
44+ ++ stdenv.lib.optional (zlib != null) zlib
45+ ++ stdenv.lib.optional (readline != null) readline
46+ ++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) libffi
47+ ++ stdenv.lib.optional ffcallAvailable libffcall
48+ ++ stdenv.lib.optionals x11Support [
49+ libX11 libXau libXt libXpm xproto libXext xextproto
52+ # First, replace port 9090 (rather low, can be used)
53+ # with 64237 (much higher, IANA private area, not
54+ # anything rememberable).
55+ # Also remove reference to a type that disappeared from recent glibc
56+ # (seems the correct thing to do, found no reference to any solution)
58+ sed -e 's@9090@64237@g' -i tests/socket.tst
59+ sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in
60+ find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i
62+ substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" ""
65+ configureFlags = "builddir"
66+ + stdenv.lib.optionalString (!dllSupport) " --without-dynamic-modules"
67+ + stdenv.lib.optionalString (readline != null) " --with-readline"
68+ # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise
69+ + stdenv.lib.optionalString (ffcallAvailable && (libffi != null)) " --with-dynamic-ffi"
70+ + stdenv.lib.optionalString ffcallAvailable " --with-ffcall"
71+ + stdenv.lib.optionalString (!ffcallAvailable) " --without-ffcall"
72+ + stdenv.lib.concatMapStrings (x: " --with-module=" + x) withModules
73+ + stdenv.lib.optionalString threadSupport " --with-threads=POSIX_THREADS";
76+ sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
81+ stdenv.lib.optionalString (withModules != [])
82+ (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full''
83+ + stdenv.lib.concatMapStrings (x: " " + x) withModules);
85+ NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}";
87+ # TODO : make mod-check fails
91+ description = "ANSI Common Lisp Implementation";
92+ homepage = http://clisp.cons.org;
93+ maintainers = with stdenv.lib.maintainers; [raskin tohl];
94+ # problems on Darwin: https://github.com/NixOS/nixpkgs/issues/20062
95+ platforms = stdenv.lib.platforms.linux;