2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null }:
|
2013-03-26 14:52:54 +00:00
|
|
|
|
2013-11-28 21:08:19 +00:00
|
|
|
let
|
2013-11-28 22:23:40 +00:00
|
|
|
platform = with stdenv;
|
2013-11-29 10:46:57 +00:00
|
|
|
if isDarwin then "macosx"
|
2013-11-28 22:23:40 +00:00
|
|
|
else if isCygwin then "cygwin"
|
2015-02-25 03:15:51 +00:00
|
|
|
else if (isFreeBSD || isOpenBSD) then "bsd"
|
2013-11-28 22:23:40 +00:00
|
|
|
else if isSunOS then "solaris"
|
2015-02-25 03:15:51 +00:00
|
|
|
else "linux"; # Should be a sane default
|
2013-11-28 21:08:19 +00:00
|
|
|
in
|
2021-06-26 19:47:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "chicken";
|
2021-12-11 15:20:35 +00:00
|
|
|
version = "5.3.0";
|
2013-11-28 21:08:19 +00:00
|
|
|
|
2019-08-07 02:47:51 +00:00
|
|
|
binaryVersion = 11;
|
2014-10-09 18:49:15 +00:00
|
|
|
|
2014-06-02 16:15:44 +00:00
|
|
|
src = fetchurl {
|
2018-06-28 18:43:35 +00:00
|
|
|
url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz";
|
2021-12-11 15:20:35 +00:00
|
|
|
sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY=";
|
2014-06-02 16:15:44 +00:00
|
|
|
};
|
2013-03-26 14:52:54 +00:00
|
|
|
|
2020-11-15 14:11:56 +00:00
|
|
|
setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh;
|
2016-06-25 14:53:21 +00:00
|
|
|
|
2020-11-15 14:11:56 +00:00
|
|
|
# -fno-strict-overflow is not a supported argument in clang on darwin
|
|
|
|
hardeningDisable = lib.optionals stdenv.isDarwin ["strictoverflow"];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PLATFORM=${platform}" "PREFIX=$(out)"
|
|
|
|
] ++ (lib.optionals stdenv.isDarwin [
|
|
|
|
"XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
|
|
|
|
"C_COMPILER=$(CC)"
|
2023-04-12 08:20:54 +00:00
|
|
|
"CXX_COMPILER=$(CXX)"
|
2022-09-10 13:08:13 +00:00
|
|
|
"LINKER_OPTIONS=-headerpad_max_install_names"
|
2022-11-27 02:06:53 +00:00
|
|
|
"POSTINSTALL_PROGRAM=install_name_tool"
|
2020-11-15 14:11:56 +00:00
|
|
|
]);
|
2013-11-28 21:08:19 +00:00
|
|
|
|
2022-07-14 21:26:35 +00:00
|
|
|
nativeBuildInputs = [
|
2014-10-17 15:26:36 +00:00
|
|
|
makeWrapper
|
2022-10-23 22:55:38 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
darwin.autoSignDarwinBinariesHook
|
2022-07-14 21:26:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals (bootstrap-chicken != null) [
|
2014-10-09 09:13:29 +00:00
|
|
|
bootstrap-chicken
|
2022-07-14 21:26:35 +00:00
|
|
|
];
|
2014-10-09 09:13:29 +00:00
|
|
|
|
2014-10-17 15:26:36 +00:00
|
|
|
postInstall = ''
|
|
|
|
for f in $out/bin/*
|
|
|
|
do
|
|
|
|
wrapProgram $f \
|
2021-06-30 07:23:22 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}
|
2014-10-17 15:26:36 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2022-04-13 21:31:24 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2021-06-26 19:47:51 +00:00
|
|
|
postCheck = ''
|
|
|
|
./csi -R chicken.pathname -R chicken.platform \
|
|
|
|
-p "(assert (equal? \"${toString binaryVersion}\" (pathname-file (car (repository-path)))))"
|
|
|
|
'';
|
2014-10-09 18:49:15 +00:00
|
|
|
|
2022-04-13 21:31:24 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/chicken -version
|
|
|
|
'';
|
|
|
|
|
2013-11-28 21:08:19 +00:00
|
|
|
meta = {
|
2021-06-26 19:47:51 +00:00
|
|
|
homepage = "https://call-cc.org/";
|
2021-01-22 11:25:31 +00:00
|
|
|
license = lib.licenses.bsd3;
|
2023-02-12 02:01:24 +00:00
|
|
|
maintainers = with lib.maintainers; [ corngood nagy konst-aa ];
|
2021-06-26 19:47:51 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2013-11-28 21:08:19 +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
|
2017-08-06 22:05:18 +00:00
|
|
|
enhancements and extensions. CHICKEN runs on Linux, macOS,
|
2013-11-28 21:08:19 +00:00
|
|
|
Windows, and many Unix flavours.
|
|
|
|
'';
|
|
|
|
};
|
2013-03-26 14:52:54 +00:00
|
|
|
}
|