nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 150 lines 3.9 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 "asdf" 35 "pcre" 36 "rawsock" 37 ] 38 ++ lib.optionals stdenv.hostPlatform.isLinux [ 39 "bindings/glibc" 40 "zlib" 41 ] 42 ++ lib.optional x11Support "clx/new-clx", 43}: 44 45assert 46 x11Support 47 -> ( 48 libX11 != null 49 && libXau != null 50 && libXt != null 51 && libXpm != null 52 && xorgproto != null 53 && libXext != null 54 ); 55 56let 57 ffcallAvailable = stdenv.hostPlatform.isLinux && (libffcall != null); 58in 59 60stdenv.mkDerivation { 61 version = "2.49.95-unstable-2024-12-28"; 62 pname = "clisp"; 63 64 src = fetchFromGitLab { 65 owner = "gnu-clisp"; 66 repo = "clisp"; 67 rev = "c3ec11bab87cfdbeba01523ed88ac2a16b22304d"; 68 hash = "sha256-xXGx2FlS0l9huVMHqNbcAViLjxK8szOFPT0J8MpGp9w="; 69 }; 70 71 strictDeps = true; 72 nativeBuildInputs = [ 73 autoconf 74 automake 75 libtool 76 ]; 77 buildInputs = [ 78 bash 79 libsigsegv 80 ] 81 ++ lib.optional (gettext != null) gettext 82 ++ lib.optional (ncurses != null) ncurses 83 ++ lib.optional (pcre != null) pcre 84 ++ lib.optional (zlib != null) zlib 85 ++ lib.optional (readline != null) readline 86 ++ lib.optional (ffcallAvailable && (libffi != null)) libffi 87 ++ lib.optional ffcallAvailable libffcall 88 ++ lib.optionals x11Support [ 89 libX11 90 libXau 91 libXt 92 libXpm 93 xorgproto 94 libXext 95 ]; 96 97 # First, replace port 9090 (rather low, can be used) 98 # with 64237 (much higher, IANA private area, not 99 # anything rememberable). 100 postPatch = '' 101 sed -e 's@9090@64237@g' -i tests/socket.tst 102 sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in 103 sed -i 's@1\.16\.2@${automake.version}@' src/aclocal.m4 104 find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i 105 ''; 106 107 configureFlags = [ 108 "builddir" 109 ] 110 ++ lib.optional (!dllSupport) "--without-dynamic-modules" 111 ++ lib.optional (readline != null) "--with-readline" 112 # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise 113 ++ lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" 114 ++ lib.optional ffcallAvailable "--with-ffcall" 115 ++ lib.optional (!ffcallAvailable) "--without-ffcall" 116 ++ map (x: " --with-module=" + x) withModules 117 ++ lib.optional threadSupport "--with-threads=POSIX_THREADS"; 118 119 preBuild = '' 120 sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d 121 sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp 122 cd builddir 123 ''; 124 125 doCheck = true; 126 127 postInstall = lib.optionalString (withModules != [ ]) '' 128 bash ./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full \ 129 ${lib.concatMapStrings (x: " " + x) withModules} 130 131 find "$out"/lib/clisp*/full -type l -name "*.o" | while read -r symlink; do 132 if [[ "$(readlink "$symlink")" =~ (.*\/builddir\/)(.*) ]]; then 133 ln -sf "../''${BASH_REMATCH[2]}" "$symlink" 134 fi 135 done 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}