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