Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 150 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{ 7 lib, 8 stdenv, 9 fetchFromGitLab, 10 autoconf, 11 automake, 12 bash, 13 libtool, 14 libsigsegv, 15 gettext, 16 ncurses, 17 pcre, 18 zlib, 19 readline, 20 libffi, 21 libffcall, 22 libX11, 23 libXau, 24 libXt, 25 libXpm, 26 libXext, 27 xorgproto, 28 coreutils, 29 # build options 30 threadSupport ? (stdenv.hostPlatform.isx86 && !stdenv.hostPlatform.isDarwin), 31 x11Support ? (stdenv.hostPlatform.isx86 && !stdenv.hostPlatform.isDarwin), 32 dllSupport ? true, 33 withModules ? 34 [ 35 "asdf" 36 "pcre" 37 "rawsock" 38 ] 39 ++ lib.optionals stdenv.hostPlatform.isLinux [ 40 "bindings/glibc" 41 "zlib" 42 ] 43 ++ lib.optional x11Support "clx/new-clx", 44}: 45 46assert 47 x11Support 48 -> ( 49 libX11 != null 50 && libXau != null 51 && libXt != null 52 && libXpm != null 53 && xorgproto != null 54 && libXext != null 55 ); 56 57let 58 ffcallAvailable = stdenv.hostPlatform.isLinux && (libffcall != null); 59in 60 61stdenv.mkDerivation { 62 version = "2.49.95-unstable-2024-12-28"; 63 pname = "clisp"; 64 65 src = fetchFromGitLab { 66 owner = "gnu-clisp"; 67 repo = "clisp"; 68 rev = "c3ec11bab87cfdbeba01523ed88ac2a16b22304d"; 69 hash = "sha256-xXGx2FlS0l9huVMHqNbcAViLjxK8szOFPT0J8MpGp9w="; 70 }; 71 72 strictDeps = true; 73 nativeBuildInputs = [ 74 autoconf 75 automake 76 libtool 77 ]; 78 buildInputs = 79 [ 80 bash 81 libsigsegv 82 ] 83 ++ lib.optional (gettext != null) gettext 84 ++ lib.optional (ncurses != null) ncurses 85 ++ lib.optional (pcre != null) pcre 86 ++ lib.optional (zlib != null) zlib 87 ++ lib.optional (readline != null) readline 88 ++ lib.optional (ffcallAvailable && (libffi != null)) libffi 89 ++ lib.optional ffcallAvailable libffcall 90 ++ lib.optionals x11Support [ 91 libX11 92 libXau 93 libXt 94 libXpm 95 xorgproto 96 libXext 97 ]; 98 99 # First, replace port 9090 (rather low, can be used) 100 # with 64237 (much higher, IANA private area, not 101 # anything rememberable). 102 postPatch = '' 103 sed -e 's@9090@64237@g' -i tests/socket.tst 104 sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in 105 sed -i 's@1\.16\.2@${automake.version}@' src/aclocal.m4 106 find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i 107 ''; 108 109 configureFlags = 110 [ "builddir" ] 111 ++ lib.optional (!dllSupport) "--without-dynamic-modules" 112 ++ lib.optional (readline != null) "--with-readline" 113 # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise 114 ++ lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" 115 ++ lib.optional ffcallAvailable "--with-ffcall" 116 ++ lib.optional (!ffcallAvailable) "--without-ffcall" 117 ++ builtins.map (x: " --with-module=" + x) withModules 118 ++ lib.optional threadSupport "--with-threads=POSIX_THREADS"; 119 120 preBuild = '' 121 sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d 122 sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp 123 cd builddir 124 ''; 125 126 # ;; Loading file ../src/defmacro.lisp ... 127 # *** - handle_fault error2 ! address = 0x8 not in [0x1000000c0000,0x1000000c0000) ! 128 # SIGSEGV cannot be cured. Fault address = 0x8. 129 hardeningDisable = [ "pie" ]; 130 131 doCheck = true; 132 133 postInstall = lib.optionalString (withModules != [ ]) ( 134 ''bash ./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' 135 + lib.concatMapStrings (x: " " + x) withModules 136 ); 137 138 env.NIX_CFLAGS_COMPILE = "-O0 -falign-functions=${ 139 if stdenv.hostPlatform.is64bit then "8" else "4" 140 }"; 141 142 meta = { 143 description = "ANSI Common Lisp Implementation"; 144 homepage = "http://clisp.org"; 145 mainProgram = "clisp"; 146 teams = [ lib.teams.lisp ]; 147 license = lib.licenses.gpl2Plus; 148 platforms = with lib.platforms; linux ++ darwin; 149 }; 150}