1{
2 lib,
3 llvmPackages_18,
4 fetchzip,
5 sbcl,
6 pkg-config,
7 fmt_9,
8 gmpxx,
9 libelf,
10 boost,
11 libunwind,
12 ninja,
13}:
14
15let
16 inherit (llvmPackages_18) stdenv llvm libclang;
17in
18
19stdenv.mkDerivation rec {
20 pname = "clasp";
21 version = "2.7.0";
22
23 src = fetchzip {
24 url = "https://github.com/clasp-developers/clasp/releases/download/${version}/clasp-${version}.tar.gz";
25 hash = "sha256-IoEwsMvY/bbb6K6git+7zRGP0DIJDROt69FBQuzApRk=";
26 };
27
28 patches = [
29 ./remove-unused-command-line-argument.patch
30 ];
31
32 # Workaround for https://github.com/clasp-developers/clasp/issues/1590
33 postPatch = ''
34 echo '(defmethod configure-unit (c (u (eql :git))))' >> src/koga/units.lisp
35 '';
36
37 nativeBuildInputs = [
38 sbcl
39 pkg-config
40 fmt_9
41 gmpxx
42 libelf
43 boost
44 libunwind
45 ninja
46 llvm
47 libclang
48 ];
49
50 ninjaFlags = [
51 "-C"
52 "build"
53 ];
54
55 configurePhase = ''
56 export SOURCE_DATE_EPOCH=1
57 export ASDF_OUTPUT_TRANSLATIONS=$(pwd):$(pwd)/__fasls
58 sbcl --script koga \
59 --skip-sync \
60 --build-mode=bytecode-faso \
61 --cc=$NIX_CC/bin/cc \
62 --cxx=$NIX_CC/bin/c++ \
63 --reproducible-build \
64 --package-path=/ \
65 --bin-path=$out/bin \
66 --lib-path=$out/lib \
67 --dylib-path=$out/lib \
68 --share-path=$out/share \
69 --pkgconfig-path=$out/lib/pkgconfig
70 '';
71
72 postInstall = ''
73 # --dylib-path not honored. Fix it in post.
74 mv $out/libclasp* $out/lib/
75 '';
76
77 meta = {
78 description = "Common Lisp implementation based on LLVM with C++ integration";
79 license = lib.licenses.lgpl21Plus;
80 teams = [ lib.teams.lisp ];
81 platforms = [
82 "x86_64-linux"
83 "x86_64-darwin"
84 ];
85 homepage = "https://github.com/clasp-developers/clasp";
86 mainProgram = "clasp";
87 };
88}