Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 134 lines 4.0 kB view raw
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 4# by default 5# - full: contains base plus modules in withModules 6{ lib 7, stdenv 8, fetchFromGitLab 9, autoconf269 10, automake 11, libtool 12, libsigsegv 13, gettext 14, ncurses 15, pcre 16, zlib 17, readline 18, libffi 19, libffcall 20, libX11 21, libXau 22, libXt 23, libXpm 24, libXext 25, xorgproto 26, coreutils 27# build options 28, threadSupport ? (stdenv.hostPlatform.isx86 && ! stdenv.hostPlatform.isDarwin) 29, x11Support ? (stdenv.hostPlatform.isx86 && ! stdenv.hostPlatform.isDarwin) 30, dllSupport ? true 31, withModules ? [ 32 "asdf" 33 "pcre" 34 "rawsock" 35 ] 36 ++ lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ] 37 ++ lib.optional x11Support "clx/new-clx" 38}: 39 40assert x11Support -> (libX11 != null && libXau != null && libXt != null 41 && libXpm != null && xorgproto != null && libXext != null); 42 43let 44 ffcallAvailable = stdenv.isLinux && (libffcall != null); 45 # Some modules need autoreconf called in their directory. 46 shouldReconfModule = name: name != "asdf"; 47in 48 49stdenv.mkDerivation { 50 version = "2.50pre20230112"; 51 pname = "clisp"; 52 53 src = fetchFromGitLab { 54 owner = "gnu-clisp"; 55 repo = "clisp"; 56 rev = "bf72805c4dace982a6d3399ff4e7f7d5e77ab99a"; 57 hash = "sha256-sQoN2FUg9BPaCgvCF91lFsU/zLja1NrgWsEIr2cPiqo="; 58 }; 59 60 strictDeps = true; 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 72 ]; 73 74 patches = [ 75 ./gnulib_aarch64.patch 76 ]; 77 78 # First, replace port 9090 (rather low, can be used) 79 # with 64237 (much higher, IANA private area, not 80 # anything rememberable). 81 postPatch = '' 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 86 ''; 87 88 preConfigure = lib.optionalString stdenv.isDarwin ('' 89 ( 90 cd src 91 autoreconf -f -i -I m4 -I glm4 92 ) 93 '' + lib.concatMapStrings (x: '' 94 ( 95 root="$PWD" 96 cd modules/${x} 97 autoreconf -f -i -I "$root/src" -I "$root/src/m4" -I "$root/src/glm4" 98 ) 99 '') (builtins.filter shouldReconfModule withModules)); 100 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"; 110 111 preBuild = '' 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 114 cd builddir 115 ''; 116 117 doCheck = true; 118 119 postInstall = 120 lib.optionalString (withModules != []) 121 (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' 122 + lib.concatMapStrings (x: " " + x) withModules); 123 124 env.NIX_CFLAGS_COMPILE = "-O0 -falign-functions=${if stdenv.is64bit then "8" else "4"}"; 125 126 meta = { 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; 133 }; 134}