1 { lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null, testers }:
4 platform = with stdenv;
5 if isDarwin then "macosx"
6 else if isCygwin then "cygwin"
7 else if (isFreeBSD || isOpenBSD) then "bsd"
8 else if isSunOS then "solaris"
9 else "linux"; # Should be a sane default
11 stdenv.mkDerivation (finalAttrs: {
18 url = "https://code.call-cc.org/releases/${finalAttrs.version}/chicken-${finalAttrs.version}.tar.gz";
19 sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY=";
22 # Disable two broken tests: "static link" and "linking tests"
24 sed -i tests/runtests.sh -e "/static link/,+4 { s/^/# / }"
25 sed -i tests/runtests.sh -e "/linking tests/,+11 { s/^/# / }"
28 setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh;
30 # -fno-strict-overflow is not a supported argument in clang
31 hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ];
34 "PLATFORM=${platform}"
38 "TARGET_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
39 "TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
40 ] ++ (lib.optionals stdenv.isDarwin [
41 "XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
42 "LINKER_OPTIONS=-headerpad_max_install_names"
43 "POSTINSTALL_PROGRAM=install_name_tool"
44 ]) ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
45 "HOSTSYSTEM=${stdenv.hostPlatform.config}"
50 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
51 darwin.autoSignDarwinBinariesHook
54 buildInputs = lib.optionals (bootstrap-chicken != null) [
58 doCheck = !stdenv.isDarwin;
60 ./csi -R chicken.pathname -R chicken.platform \
61 -p "(assert (equal? \"${toString finalAttrs.binaryVersion}\" (pathname-file (car (repository-path)))))"
64 passthru.tests.version = testers.testVersion {
65 package = finalAttrs.finalPackage;
66 command = "csi -version";
70 homepage = "https://call-cc.org/";
71 license = lib.licenses.bsd3;
72 maintainers = with lib.maintainers; [ corngood nagy konst-aa ];
73 platforms = lib.platforms.unix;
74 description = "A portable compiler for the Scheme programming language";
76 CHICKEN is a compiler for the Scheme programming language.
77 CHICKEN produces portable and efficient C, supports almost all
78 of the R5RS Scheme language standard, and includes many
79 enhancements and extensions. CHICKEN runs on Linux, macOS,
80 Windows, and many Unix flavours.