Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chez-racket: init at 2021-12-11 #131833

Merged
merged 2 commits into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions pkgs/development/compilers/chez-racket/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ stdenv, buildPackages, callPackage }:

let
chezSystemMap = {
# See `/workarea` of source code for list of systems
"aarch64-darwin" = "tarm64osx";
"aarch64-linux" = "tarm64le";
"armv7l-linux" = "tarm32le";
"x86_64-darwin" = "ta6osx";
"x86_64-linux" = "ta6le";
};
inherit (stdenv.hostPlatform) system;
chezSystem = chezSystemMap.${system} or (throw "Add ${system} to chezSystemMap to enable building chez-racket");
# Chez Scheme uses an ad-hoc `configure`, hence we don't use the usual
# stdenv abstractions.
forBoot = {
pname = "chez-scheme-racket-boot";
configurePhase = ''
runHook preConfigure
./configure --pb ZLIB=$ZLIB LZ4=$LZ4
runHook postConfigure
'';
makeFlags = [ "${chezSystem}.bootquick" ];
installPhase = ''
runHook preInstall
mkdir -p $out
pushd boot
mv $(ls -1 | grep -v "^pb$") -t $out
popd
runHook postInstall
'';
};
boot = buildPackages.callPackage (import ./shared.nix forBoot) {};
forFinal = {
pname = "chez-scheme-racket";
configurePhase = ''
runHook preConfigure
cp -r ${boot}/* -t ./boot
./configure -m=${chezSystem} --installprefix=$out --installman=$out/share/man ZLIB=$ZLIB LZ4=$LZ4
runHook postConfigure
'';
preBuild = ''
pushd ${chezSystem}/c
'';
postBuild = ''
popd
'';
setupHook = ./setup-hook.sh;
};
final = callPackage (import ./shared.nix forFinal) {};
in
final
5 changes: 5 additions & 0 deletions pkgs/development/compilers/chez-racket/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
addChezLibraryPath() {
addToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site"
}

addEnvHooks "$targetOffset" addChezLibraryPath
41 changes: 41 additions & 0 deletions pkgs/development/compilers/chez-racket/shared.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
args:
{ stdenv, lib, fetchFromGitHub, coreutils, darwin
, ncurses, libiconv, libX11, zlib, lz4
}:

stdenv.mkDerivation (args // {
version = "unstable-2021-12-11";

src = fetchFromGitHub {
owner = "racket";
repo = "ChezScheme";
rev = "8846c96b08561f05a937d5ecfe4edc96cc99be39";
sha256 = "IYJQzT88T8kFahx2BusDOyzz6lQDCbZIfSz9rZoNF7A=";
fetchSubmodules = true;
};

prePatch = ''
rm -rf zlib/*.c lz4/lib/*.c
'';

postPatch = ''
export ZLIB="$(find ${zlib.out}/lib -type f | sort | head -n1)"
export LZ4="$(find ${lz4.out}/lib -type f | sort | head -n1)"
'';

nativeBuildInputs = lib.optionals stdenv.isDarwin (with darwin; [ cctools autoSignDarwinBinariesHook ]);
buildInputs = [ ncurses libX11 zlib lz4 ]
++ lib.optional stdenv.isDarwin libiconv;

enableParallelBuilding = true;

NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=format-truncation";

meta = {
description = "Fork of Chez Scheme for Racket";
homepage = "https://github.com/racket/ChezScheme";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ l-as ];
platforms = lib.platforms.unix;
};
})
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11599,6 +11599,8 @@ with pkgs;
inherit (darwin) cctools;
};

chez-racket = callPackage ../development/compilers/chez-racket {};

chez-srfi = callPackage ../development/chez-modules/chez-srfi { };

chez-mit = callPackage ../development/chez-modules/chez-mit { };
Expand Down