8 inherit (lib) addMetaAttrs;
9 addToNativeBuildInputs = pkg: old: {
10 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ lib.toList pkg;
12 addToBuildInputs = pkg: old: {
13 buildInputs = (old.buildInputs or [ ]) ++ lib.toList pkg;
15 addToPropagatedBuildInputs = pkg: old: {
16 propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.toList pkg;
19 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
21 addToBuildInputsWithPkgConfig = pkg: old: (addPkgConfig old) // (addToBuildInputs pkg old);
22 addToPropagatedBuildInputsWithPkgConfig =
23 pkg: old: (addPkgConfig old) // (addToPropagatedBuildInputs pkg old);
24 broken = addMetaAttrs { broken = true; };
25 brokenOnDarwin = addMetaAttrs { broken = stdenv.hostPlatform.isDarwin; };
26 addToCscOptions = opt: old: {
27 CSC_OPTIONS = lib.concatStringsSep " " ([ old.CSC_OPTIONS or "" ] ++ lib.toList opt);
34 (addToBuildInputsWithPkgConfig (
40 ++ lib.optionals stdenv.hostPlatform.isDarwin [ pkgs.darwin.apple_sdk.frameworks.OpenGL ]
41 ++ lib.optionals stdenv.hostPlatform.isLinux [ pkgs.xorg.libX11 ]
46 # depends on 'chicken' egg, which doesn't exist,
47 # so we specify all the deps here
48 propagatedBuildInputs = [
49 chickenEggs.foreigners
52 breadline = addToBuildInputs pkgs.readline;
53 blas = addToBuildInputsWithPkgConfig pkgs.blas;
54 blosc = addToBuildInputs pkgs.c-blosc;
55 botan = addToBuildInputsWithPkgConfig pkgs.botan2;
58 (addToBuildInputsWithPkgConfig pkgs.cairo old)
59 // (addToPropagatedBuildInputs (with chickenEggs; [
63 cmark = addToBuildInputs pkgs.cmark;
65 # For some reason lazy-seq 2 gets interpreted as lazy-seq 0.0.0??
67 substituteInPlace comparse.egg \
68 --replace-fail 'lazy-seq "0.1.0"' 'lazy-seq "0.0.0"'
73 (addToPropagatedBuildInputsWithPkgConfig pkgs.libepoxy old)
74 // lib.optionalAttrs stdenv.cc.isClang {
75 env.NIX_CFLAGS_COMPILE = toString [
76 "-Wno-error=incompatible-function-pointer-types"
77 "-Wno-error=int-conversion"
80 espeak = addToBuildInputsWithPkgConfig pkgs.espeak-ng;
81 exif = addToBuildInputsWithPkgConfig pkgs.libexif;
84 (addToBuildInputsWithPkgConfig pkgs.expat old)
85 // lib.optionalAttrs stdenv.cc.isClang {
86 env.NIX_CFLAGS_COMPILE = toString [
87 "-Wno-error=incompatible-function-pointer-types"
92 (addToBuildInputsWithPkgConfig pkgs.xorg.libX11 old)
93 // lib.optionalAttrs stdenv.cc.isClang {
94 env.NIX_CFLAGS_COMPILE = toString [
95 "-Wno-error=implicit-function-declaration"
98 freetype = addToBuildInputsWithPkgConfig pkgs.freetype;
99 fuse = addToBuildInputsWithPkgConfig pkgs.fuse;
100 gl-utils = addPkgConfig;
101 glfw3 = addToBuildInputsWithPkgConfig pkgs.glfw3;
103 iconv = addToBuildInputs (lib.optional stdenv.hostPlatform.isDarwin pkgs.libiconv);
104 icu = addToBuildInputsWithPkgConfig pkgs.icu;
105 imlib2 = addToBuildInputsWithPkgConfig pkgs.imlib2;
108 (addToBuildInputs (lib.optional stdenv.hostPlatform.isDarwin pkgs.libinotify-kqueue) old)
109 // lib.optionalAttrs stdenv.hostPlatform.isDarwin (addToCscOptions "-L -linotify" old);
110 leveldb = addToBuildInputs pkgs.leveldb;
112 # For some reason comparse version gets interpreted as 0.0.0
114 substituteInPlace lowdown.egg \
115 --replace-fail 'comparse "3"' 'comparse "0.0.0"'
118 magic = addToBuildInputs pkgs.file;
121 (addToBuildInputs pkgs.pcre old)
122 // lib.optionalAttrs stdenv.cc.isClang {
123 env.NIX_CFLAGS_COMPILE = toString [
124 "-Wno-error=implicit-function-declaration"
125 "-Wno-error=implicit-int"
129 # For some reason comparse gets interpreted as comparse 0.0.0
131 substituteInPlace medea.egg \
132 --replace-fail 'comparse "0.3.0"' 'comparse "0.0.0"'
135 # missing dependency in upstream egg
136 mistie = addToPropagatedBuildInputs (with chickenEggs; [ srfi-1 ]);
137 mosquitto = addToPropagatedBuildInputs ([ pkgs.mosquitto ]);
138 nanomsg = addToBuildInputs pkgs.nanomsg;
139 ncurses = addToBuildInputsWithPkgConfig [ pkgs.ncurses ];
140 opencl = addToBuildInputs (
145 ++ lib.optionals stdenv.hostPlatform.isDarwin [ pkgs.darwin.apple_sdk.frameworks.OpenCL ]
147 openssl = addToBuildInputs pkgs.openssl;
148 plot = addToBuildInputs pkgs.plotutils;
149 postgresql = addToBuildInputsWithPkgConfig pkgs.postgresql;
150 rocksdb = addToBuildInputs pkgs.rocksdb_8_3;
151 scheme2c-compatibility =
153 addToNativeBuildInputs (lib.optionals (stdenv.system == "x86_64-darwin") [
154 pkgs.memorymappingHook
155 ]) (addPkgConfig old);
159 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL old)
161 # needed for sdl-config to be in PATH
162 (addToNativeBuildInputs pkgs.SDL old)
167 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2 old)
169 # needed for sdl2-config to be in PATH
170 (addToNativeBuildInputs pkgs.SDL2 old)
175 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2_image old)
177 # needed for sdl2-config to be in PATH
178 (addToNativeBuildInputs pkgs.SDL2 old)
183 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2_ttf old)
185 # needed for sdl2-config to be in PATH
186 (addToNativeBuildInputs pkgs.SDL2 old)
188 soil = addToPropagatedBuildInputsWithPkgConfig pkgs.libepoxy;
189 sqlite3 = addToBuildInputs pkgs.sqlite;
190 stemmer = old: (addToBuildInputs pkgs.libstemmer old) // (addToCscOptions "-L -lstemmer" old);
192 old: (addToBuildInputs [ pkgs.ncurses pkgs.stfl ] old) // (addToCscOptions "-L -lncurses" old);
195 (addToBuildInputs [ pkgs.zlib pkgs.taglib ] old)
197 # needed for tablib-config to be in PATH
198 addToNativeBuildInputs pkgs.taglib old
200 uuid-lib = addToBuildInputs pkgs.libuuid;
201 webview = addToBuildInputsWithPkgConfig pkgs.webkitgtk_4_0;
202 ws-client = addToBuildInputs pkgs.zlib;
203 xlib = addToPropagatedBuildInputs pkgs.xorg.libX11;
204 yaml = addToBuildInputs pkgs.libyaml;
205 zlib = addToBuildInputs pkgs.zlib;
206 zmq = addToBuildInputs pkgs.zeromq;
207 zstd = addToBuildInputs pkgs.zstd;
209 # less trivial fixes, should be upstreamed
212 (addToBuildInputsWithPkgConfig pkgs.libgit2 old)
215 substituteInPlace libgit2.scm \
216 --replace "asize" "reserved"
221 (addToBuildInputs pkgs.libffi old)
224 substituteInPlace lazy-ffi.scm \
225 --replace "ffi/ffi.h" "ffi.h"
230 (addToBuildInputsWithPkgConfig (
231 lib.optionals (!stdenv.hostPlatform.isDarwin) [
235 ++ lib.optionals stdenv.hostPlatform.isDarwin [
236 pkgs.darwin.apple_sdk.frameworks.Foundation
237 pkgs.darwin.apple_sdk.frameworks.OpenGL
242 substituteInPlace opengl.egg \
243 --replace 'framework ' 'framework" "'
247 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
248 substituteInPlace build.scm \
254 pledge = addMetaAttrs { platforms = lib.platforms.openbsd; };
255 unveil = addMetaAttrs { platforms = lib.platforms.openbsd; };
257 # overrides for chicken 5.4
260 (addToBuildInputsWithPkgConfig [ pkgs.dbus ] old)
262 # backticks in compiler options
263 # aren't supported anymore as of chicken 5.4, it seems.
266 dbus.egg dbus.setup \
267 --replace '`pkg-config --cflags dbus-1`' "$(pkg-config --cflags dbus-1)" \
268 --replace '`pkg-config --libs dbus-1`' "$(pkg-config --libs dbus-1)"
272 # define-values is used but not imported
273 # some breaking change happened now it needs to be done
276 substituteInPlace *.scm **/*.scm \
277 --replace-quiet 'only chicken.base' 'only chicken.base define-values'
281 # chicken-do checks for changes to a file that doesn't exist
288 "ephem-v1.1" = broken;
291 begin-syntax = broken;
292 canvas-draw = broken;
293 chicken-doc-admin = broken;
294 coops-utils = broken;
303 salmonella-html-report = broken;
307 tokyocabinet = broken;
311 # fatal error: 'mqueue.h' file not found
312 posix-mq = brokenOnDarwin;
313 # Undefined symbols for architecture arm64: "_pthread_setschedprio"
314 pthreads = brokenOnDarwin;
315 # error: use of undeclared identifier 'B4000000'
316 stty = brokenOnDarwin;