2023-08-04 22:07:22 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null, testers }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
platform = with stdenv;
|
|
|
|
if isDarwin then "macosx"
|
|
|
|
else if isCygwin then "cygwin"
|
|
|
|
else if (isFreeBSD || isOpenBSD) then "bsd"
|
|
|
|
else if isSunOS then "solaris"
|
|
|
|
else "linux"; # Should be a sane default
|
|
|
|
in
|
2023-08-04 22:07:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "chicken";
|
2021-12-19 01:06:50 +00:00
|
|
|
version = "5.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
binaryVersion = 11;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2023-08-04 22:07:22 +00:00
|
|
|
url = "https://code.call-cc.org/releases/${finalAttrs.version}/chicken-${finalAttrs.version}.tar.gz";
|
2021-12-19 01:06:50 +00:00
|
|
|
sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# Disable two broken tests: "static link" and "linking tests"
|
|
|
|
postPatch = ''
|
|
|
|
sed -i tests/runtests.sh -e "/static link/,+4 { s/^/# / }"
|
|
|
|
sed -i tests/runtests.sh -e "/linking tests/,+11 { s/^/# / }"
|
|
|
|
'';
|
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
# -fno-strict-overflow is not a supported argument in clang
|
|
|
|
hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ];
|
2020-11-19 00:13:47 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
2023-08-04 22:07:22 +00:00
|
|
|
"PLATFORM=${platform}"
|
|
|
|
"PREFIX=$(out)"
|
2020-11-19 00:13:47 +00:00
|
|
|
"C_COMPILER=$(CC)"
|
2023-04-12 12:48:02 +00:00
|
|
|
"CXX_COMPILER=$(CXX)"
|
2023-08-04 22:07:22 +00:00
|
|
|
"TARGET_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
|
|
|
|
"TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
|
|
|
|
] ++ (lib.optionals stdenv.isDarwin [
|
|
|
|
"XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
|
2022-09-11 15:47:08 +00:00
|
|
|
"LINKER_OPTIONS=-headerpad_max_install_names"
|
2022-12-02 08:20:57 +00:00
|
|
|
"POSTINSTALL_PROGRAM=install_name_tool"
|
2023-08-04 22:07:22 +00:00
|
|
|
]) ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"HOSTSYSTEM=${stdenv.hostPlatform.config}"
|
2020-11-19 00:13:47 +00:00
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
nativeBuildInputs = [
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapper
|
2022-10-30 15:09:59 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
darwin.autoSignDarwinBinariesHook
|
2022-08-21 13:32:41 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals (bootstrap-chicken != null) [
|
2020-04-24 23:36:52 +00:00
|
|
|
bootstrap-chicken
|
2022-08-21 13:32:41 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2021-06-28 23:13:55 +00:00
|
|
|
postCheck = ''
|
|
|
|
./csi -R chicken.pathname -R chicken.platform \
|
2023-08-04 22:07:22 +00:00
|
|
|
-p "(assert (equal? \"${toString finalAttrs.binaryVersion}\" (pathname-file (car (repository-path)))))"
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "csi -version";
|
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2021-06-28 23:13:55 +00:00
|
|
|
homepage = "https://call-cc.org/";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2023-04-12 12:48:02 +00:00
|
|
|
maintainers = with lib.maintainers; [ corngood nagy konst-aa ];
|
2021-06-28 23:13:55 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A portable compiler for the Scheme programming language";
|
|
|
|
longDescription = ''
|
|
|
|
CHICKEN is a compiler for the Scheme programming language.
|
|
|
|
CHICKEN produces portable and efficient C, supports almost all
|
|
|
|
of the R5RS Scheme language standard, and includes many
|
|
|
|
enhancements and extensions. CHICKEN runs on Linux, macOS,
|
|
|
|
Windows, and many Unix flavours.
|
|
|
|
'';
|
|
|
|
};
|
2023-08-04 22:07:22 +00:00
|
|
|
})
|