From 106d0f6b513b4e54f94d347bf3b103f1433dcb56 Mon Sep 17 00:00:00 2001 From: Tomas Hlavaty Date: Mon, 4 Apr 2016 22:22:30 +0200 Subject: clisp: control build options and fix non x86* architectures --- pkgs/development/interpreters/clisp/default.nix | 65 +++++++++++++++++-------- 1 file changed, 45 insertions(+), 20 deletions(-) (limited to 'pkgs/development/interpreters') diff --git a/pkgs/development/interpreters/clisp/default.nix b/pkgs/development/interpreters/clisp/default.nix index 919c3771bc5d..c3d289d2a8d4 100644 --- a/pkgs/development/interpreters/clisp/default.nix +++ b/pkgs/development/interpreters/clisp/default.nix @@ -1,6 +1,27 @@ +# 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, fetchurl, libsigsegv, gettext, ncurses, readline, libX11 , libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto -, libffi, libffcall, coreutils}: +, libffi, libffcall, coreutils +# build options +, threadSupport ? (stdenv.isi686 || stdenv.isx86_64) +, x11Support ? (stdenv.isi686 || stdenv.isx86_64) +, dllSupport ? true +, withModules ? [ + "bindings/glibc" + "pcre" + "rawsock" + "wildcard" + "zlib" + ] + ++ stdenv.lib.optional x11Support "clx/new-clx" +}: + +assert x11Support -> (libX11 != null && libXau != null && libXt != null + && libXpm != null && xproto != null && libXext != null && xextproto != null); stdenv.mkDerivation rec { v = "2.49"; @@ -13,11 +34,17 @@ stdenv.mkDerivation rec { inherit libsigsegv gettext coreutils; - buildInputs = - [ libsigsegv gettext ncurses readline libX11 libXau - libXt pcre zlib libXpm xproto libXext xextproto libffi - libffcall - ]; + 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 (libffi != null) libffi + ++ stdenv.lib.optional (libffcall != null) libffcall + ++ stdenv.lib.optionals x11Support [ + libX11 libXau libXt libXpm xproto libXext xextproto + ]; patches = [ ./bits_ipctypes_to_sys_ipc.patch ]; # from Gentoo @@ -34,24 +61,23 @@ stdenv.mkDerivation rec { substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" "" ''; - configureFlags = - '' - --with-readline builddir --with-dynamic-ffi --with-ffcall - --with-module=clx/new-clx --with-module=i18n --with-module=bindings/glibc - --with-module=pcre --with-module=rawsock --with-module=readline - --with-module=syscalls --with-module=wildcard --with-module=zlib - --with-threads=POSIX_THREADS - ''; + configureFlags = "builddir" + + stdenv.lib.optionalString (!dllSupport) " --without-dynamic-modules" + + stdenv.lib.optionalString (readline != null) " --with-readline" + + stdenv.lib.optionalString (libffi != null) " --with-dynamic-ffi" + + stdenv.lib.optionalString (libffcall != null) " --with-ffcall" + + stdenv.lib.concatMapStrings (x: " --with-module=" + x) withModules + + stdenv.lib.optionalString threadSupport " --with-threads=POSIX_THREADS"; preBuild = '' sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d cd builddir ''; - postInstall = '' - ./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full \ - clx/new-clx bindings/glibc pcre rawsock wildcard zlib - ''; + 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"}"; @@ -61,8 +87,7 @@ stdenv.mkDerivation rec { meta = { description = "ANSI Common Lisp Implementation"; homepage = http://clisp.cons.org; - maintainers = [stdenv.lib.maintainers.raskin]; + maintainers = with stdenv.lib.maintainers; [raskin tohl]; platforms = stdenv.lib.platforms.linux; }; } - -- cgit 1.4.1