2024-09-16 08:09:13 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchgit,
|
|
|
|
fetchurl,
|
|
|
|
makeWrapper,
|
|
|
|
darwin,
|
2024-12-11 14:24:54 +00:00
|
|
|
#tcc-mob,
|
2024-09-16 08:09:13 +00:00
|
|
|
version ? "git",
|
|
|
|
testers
|
|
|
|
}:
|
|
|
|
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
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "chicken";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
binaryVersion = 12;
|
|
|
|
|
|
|
|
srcs = [
|
|
|
|
(fetchgit {
|
2024-09-21 16:38:24 +00:00
|
|
|
url = "git://code.call-cc.org/chicken-core";
|
2024-12-11 14:24:54 +00:00
|
|
|
rev = "25c24723d3300c0a05d529acee3512f6d9469d6f";
|
|
|
|
sha256 = "sha256-QsOuDE/8odBGAQOr2p9gZJssts55n0R8OEBhH+ooSP8=";
|
2024-09-16 08:09:13 +00:00
|
|
|
})
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://code.call-cc.org/dev-snapshots/2024/07/01/chicken-6.0.0-bootstrap.tar.gz";
|
|
|
|
sha256 = "sha256-qkcyWzsaN9+HbMBolmv7zeaPrtbaCTGa9HoF2g/3//o=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
cp -r `echo $srcs | awk '{print $1}'`/* .
|
|
|
|
cp -r `echo $srcs | awk '{print $1}'`/.* .
|
|
|
|
chmod -R 777 .
|
|
|
|
mkdir -p boot/snapshot
|
|
|
|
cd boot
|
|
|
|
tar xzf `echo $srcs | awk '{print $2}'`
|
|
|
|
cd ..
|
|
|
|
echo ${version} > buildid
|
|
|
|
|
|
|
|
cd boot/chicken-6.0.0
|
|
|
|
case "${platform}" in
|
|
|
|
bsd)
|
|
|
|
mkcmd=gmake;;
|
|
|
|
*)
|
|
|
|
mkcmd=make;;
|
|
|
|
esac
|
2024-09-21 16:38:24 +00:00
|
|
|
$mkcmd C_COMPILER=$CC PREFIX="$(pwd)"/../snapshot
|
|
|
|
$mkcmd C_COMPILER=$CC PREFIX="$(pwd)"/../snapshot install
|
2024-09-16 08:09:13 +00:00
|
|
|
cd ../..
|
2024-12-11 14:24:54 +00:00
|
|
|
./configure --chicken "$(pwd)"/boot/snapshot/bin/chicken
|
2024-09-16 08:09:13 +00:00
|
|
|
$mkcmd boot-chicken
|
|
|
|
'';
|
|
|
|
|
|
|
|
# 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/^/# / }"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# -fno-strict-overflow is not a supported argument in clang
|
|
|
|
hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PLATFORM=${platform}"
|
|
|
|
"PREFIX=$(out)"
|
2024-12-11 14:24:54 +00:00
|
|
|
#"C_COMPILER=${tcc-mob}/bin/tcc"
|
2024-09-16 08:09:13 +00:00
|
|
|
"CXX_COMPILER=$(CXX)"
|
|
|
|
] ++ (lib.optionals stdenv.isDarwin [
|
|
|
|
"XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
|
|
|
|
"LINKER_OPTIONS=-headerpad_max_install_names"
|
|
|
|
"POSTINSTALL_PROGRAM=install_name_tool"
|
|
|
|
]) ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"HOSTSYSTEM=${stdenv.hostPlatform.config}"
|
2024-12-11 14:24:54 +00:00
|
|
|
#"TARGET_C_COMPILER=${tcc-mob}/bin/${stdenv.cc.targetPrefix}tcc"
|
|
|
|
"TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c"
|
2024-09-16 08:09:13 +00:00
|
|
|
"TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
|
|
|
|
]);
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
pkgs.hostname
|
2024-12-11 14:24:54 +00:00
|
|
|
#tcc-mob
|
2024-09-16 08:09:13 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
|
|
|
|
darwin.autoSignDarwinBinariesHook
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
2024-12-11 14:24:54 +00:00
|
|
|
./configure --chicken ./chicken-boot --prefix $PREFIX --platform=$PLATFORM
|
2024-09-16 08:09:13 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
postCheck = ''
|
|
|
|
./csi -R chicken.pathname -R chicken.platform \
|
|
|
|
-p "(assert (equal? \"${toString finalAttrs.binaryVersion}\" (pathname-file (car (repository-path)))))"
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "csi -version";
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://call-cc.org/";
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ corngood nagy konst-aa ];
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
description = "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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
})
|