2016-12-29 17:36:55 +01:00
|
|
|
# there are the following linking sets:
|
|
|
|
# - boot (not installed): without modules, only used when building clisp
|
|
|
|
# - base (default): contains readline and i18n, regexp and syscalls modules
|
|
|
|
# by default
|
|
|
|
# - full: contains base plus modules in withModules
|
|
|
|
{ stdenv, fetchhg, libsigsegv, gettext, ncurses, readline, libX11
|
2018-12-31 04:40:47 +01:00
|
|
|
, libXau, libXt, pcre, zlib, libXpm, xorgproto, libXext
|
2017-03-12 23:02:28 +01:00
|
|
|
, libffi, libffcall, automake
|
2016-12-29 17:36:55 +01:00
|
|
|
, coreutils
|
|
|
|
# build options
|
|
|
|
, threadSupport ? (stdenv.isi686 || stdenv.isx86_64)
|
|
|
|
, x11Support ? (stdenv.isi686 || stdenv.isx86_64)
|
|
|
|
, dllSupport ? true
|
|
|
|
, withModules ? [
|
|
|
|
"pcre"
|
|
|
|
"rawsock"
|
|
|
|
]
|
|
|
|
++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ]
|
|
|
|
++ stdenv.lib.optional x11Support "clx/new-clx"
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert x11Support -> (libX11 != null && libXau != null && libXt != null
|
2018-12-31 04:40:47 +01:00
|
|
|
&& libXpm != null && xorgproto != null && libXext != null);
|
2016-12-29 17:36:55 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-11-15 19:03:56 +01:00
|
|
|
v = "2.50pre20171114";
|
2016-12-29 17:36:55 +01:00
|
|
|
name = "clisp-${v}";
|
|
|
|
|
|
|
|
src = fetchhg {
|
|
|
|
url = "http://hg.code.sf.net/p/clisp/clisp";
|
2017-11-15 19:03:56 +01:00
|
|
|
rev = "36df6dc59b8f";
|
|
|
|
sha256 = "1pidiv1m55lvc4ln8vx0ylnnhlj95y6hrfdq96nrj14f4v8fkvmr";
|
2016-12-29 17:36:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
inherit libsigsegv gettext coreutils;
|
|
|
|
|
|
|
|
ffcallAvailable = stdenv.isLinux && (libffcall != null);
|
|
|
|
|
2017-03-12 23:02:28 +01:00
|
|
|
nativeBuildInputs = [ automake ]; # sometimes fails otherwise
|
2016-12-29 17:36:55 +01:00
|
|
|
buildInputs = [libsigsegv]
|
|
|
|
++ stdenv.lib.optional (gettext != null) gettext
|
|
|
|
++ stdenv.lib.optional (ncurses != null) ncurses
|
|
|
|
++ stdenv.lib.optional (pcre != null) pcre
|
|
|
|
++ stdenv.lib.optional (zlib != null) zlib
|
|
|
|
++ stdenv.lib.optional (readline != null) readline
|
|
|
|
++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) libffi
|
|
|
|
++ stdenv.lib.optional ffcallAvailable libffcall
|
|
|
|
++ stdenv.lib.optionals x11Support [
|
2018-12-31 04:40:47 +01:00
|
|
|
libX11 libXau libXt libXpm xorgproto libXext
|
2016-12-29 17:36:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
# First, replace port 9090 (rather low, can be used)
|
|
|
|
# with 64237 (much higher, IANA private area, not
|
|
|
|
# anything rememberable).
|
|
|
|
# Also remove reference to a type that disappeared from recent glibc
|
|
|
|
# (seems the correct thing to do, found no reference to any solution)
|
|
|
|
postPatch = ''
|
|
|
|
sed -e 's@9090@64237@g' -i tests/socket.tst
|
|
|
|
sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in
|
|
|
|
find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i
|
|
|
|
|
|
|
|
substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" ""
|
|
|
|
'';
|
|
|
|
|
2018-07-25 23:44:21 +02:00
|
|
|
configureFlags = [ "builddir" ]
|
|
|
|
++ stdenv.lib.optional (!dllSupport) "--without-dynamic-modules"
|
|
|
|
++ stdenv.lib.optional (readline != null) "--with-readline"
|
2016-12-29 17:36:55 +01:00
|
|
|
# --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise
|
2018-07-25 23:44:21 +02:00
|
|
|
++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi"
|
|
|
|
++ stdenv.lib.optional ffcallAvailable "--with-ffcall"
|
|
|
|
++ stdenv.lib.optional (!ffcallAvailable) "--without-ffcall"
|
|
|
|
++ builtins.map (x: " --with-module=" + x) withModules
|
|
|
|
++ stdenv.lib.optional threadSupport "--with-threads=POSIX_THREADS";
|
2016-12-29 17:36:55 +01:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
|
2017-11-15 19:03:56 +01:00
|
|
|
sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp
|
2016-12-29 17:36:55 +01:00
|
|
|
cd builddir
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
stdenv.lib.optionalString (withModules != [])
|
|
|
|
(''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full''
|
|
|
|
+ stdenv.lib.concatMapStrings (x: " " + x) withModules);
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}";
|
|
|
|
|
|
|
|
# TODO : make mod-check fails
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "ANSI Common Lisp Implementation";
|
|
|
|
homepage = http://clisp.cons.org;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [raskin tohl];
|
|
|
|
# problems on Darwin: https://github.com/NixOS/nixpkgs/issues/20062
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|