nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 89 lines 2.7 kB view raw
1{ lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null }: 2 3let 4 version = "4.13.0"; 5 platform = with stdenv; 6 if isDarwin then "macosx" 7 else if isCygwin then "cygwin" 8 else if (isFreeBSD || isOpenBSD) then "bsd" 9 else if isSunOS then "solaris" 10 else "linux"; # Should be a sane default 11in 12stdenv.mkDerivation { 13 pname = "chicken"; 14 inherit version; 15 16 binaryVersion = 8; 17 18 src = fetchurl { 19 url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz"; 20 sha256 = "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd"; 21 }; 22 23 setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh; 24 25 # -fno-strict-overflow is not a supported argument in clang on darwin 26 hardeningDisable = lib.optionals stdenv.isDarwin ["strictoverflow"]; 27 28 makeFlags = [ 29 "PLATFORM=${platform}" "PREFIX=$(out)" 30 "VARDIR=$(out)/var/lib" 31 ] ++ (lib.optionals stdenv.isDarwin [ 32 "XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin" 33 "C_COMPILER=$(CC)" 34 "POSTINSTALL_PROGRAM=install_name_tool" 35 ]); 36 37 # We need a bootstrap-chicken to regenerate the c-files after 38 # applying a patch to add support for CHICKEN_REPOSITORY_EXTRA 39 patches = lib.optionals (bootstrap-chicken != null) [ 40 ./0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch 41 ]; 42 43 nativeBuildInputs = [ 44 makeWrapper 45 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 46 darwin.autoSignDarwinBinariesHook 47 ]; 48 49 buildInputs = lib.optionals (bootstrap-chicken != null) [ 50 bootstrap-chicken 51 ]; 52 53 preBuild = lib.optionalString (bootstrap-chicken != null) '' 54 # Backup the build* files - those are generated from hostname, 55 # git-tag, etc. and we don't need/want that 56 mkdir -p build-backup 57 mv buildid buildbranch buildtag.h build-backup 58 59 # Regenerate eval.c after the patch 60 make spotless $makeFlags 61 62 mv build-backup/* . 63 ''; 64 65 postInstall = '' 66 for f in $out/bin/* 67 do 68 wrapProgram $f \ 69 --prefix PATH : ${stdenv.cc}/bin 70 done 71 ''; 72 73 # TODO: Assert csi -R files -p '(pathname-file (repository-path))' == binaryVersion 74 75 meta = { 76 homepage = "http://www.call-cc.org/"; 77 license = lib.licenses.bsd3; 78 maintainers = with lib.maintainers; [ corngood ]; 79 platforms = lib.platforms.linux ++ lib.platforms.darwin; # Maybe other Unix 80 description = "A portable compiler for the Scheme programming language"; 81 longDescription = '' 82 CHICKEN is a compiler for the Scheme programming language. 83 CHICKEN produces portable and efficient C, supports almost all 84 of the R5RS Scheme language standard, and includes many 85 enhancements and extensions. CHICKEN runs on Linux, macOS, 86 Windows, and many Unix flavours. 87 ''; 88 }; 89}