btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / ch / chez / package.nix
blobde998e550b41e58d4e0ac2af03228dce2a062bd9
1 { lib, stdenv, fetchurl
2 , coreutils, cctools
3 , darwin
4 , ncurses, libiconv, libX11, libuuid, testers
5 }:
7 stdenv.mkDerivation (finalAttrs: {
8   pname = "chez-scheme";
9   version = "10.0.0";
11   src = fetchurl {
12     url = "https://github.com/cisco/ChezScheme/releases/download/v${finalAttrs.version}/csv${finalAttrs.version}.tar.gz";
13     hash = "sha256-03GZASte0ZhcQGnWqH/xjl4fWi3yfkApkfr0XcTyIyw=";
14   };
16   nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
17     cctools
18   ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
19     darwin.autoSignDarwinBinariesHook
20   ];
21   buildInputs = [ ncurses libiconv libX11 libuuid ];
23   enableParallelBuilding = true;
25   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=format-truncation";
27   /*
28   ** We have to fix a few occurrences to tools with absolute
29   ** paths in some helper scripts, otherwise the build will fail on
30   ** NixOS or in any chroot build.
31   */
32   patchPhase = ''
33     substituteInPlace ./makefiles/installsh \
34       --replace-warn "/usr/bin/true" "${coreutils}/bin/true"
36     substituteInPlace zlib/configure \
37       --replace-warn "/usr/bin/libtool" libtool
38   '';
40   /*
41   ** Don't use configureFlags, since that just implicitly appends
42   ** everything onto a --prefix flag, which ./configure gets very angry
43   ** about.
44   **
45   ** Also, carefully set a manual workarea argument, so that we
46   ** can later easily find the machine type that we built Chez
47   ** for.
48   */
49   configurePhase = ''
50     ./configure --as-is --threads --installprefix=$out --installman=$out/share/man
51   '';
53   /*
54   ** Clean up some of the examples from the build output.
55   */
56   postInstall = ''
57     rm -rf $out/lib/csv${finalAttrs.version}/examples
58   '';
60   setupHook = ./setup-hook.sh;
62   passthru.tests = {
63     version = testers.testVersion {
64       package = finalAttrs.finalPackage;
65     };
66   };
68   meta = {
69     description  = "Powerful and incredibly fast R6RS Scheme compiler";
70     homepage     = "https://cisco.github.io/ChezScheme/";
71     license      = lib.licenses.asl20;
72     maintainers  = with lib.maintainers; [ thoughtpolice ];
73     platforms    = lib.platforms.unix;
74     mainProgram  = "scheme";
75   };