depot/third_party/nixpkgs/pkgs/by-name/co/cosmopolitan/cosmocc.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

25 lines
640 B
Nix

{ runCommand, cosmopolitan }:
let
cosmocc = runCommand "cosmocc-${cosmopolitan.version}"
{
pname = "cosmocc";
inherit (cosmopolitan) version;
passthru.tests = {
cc = runCommand "c-test" { } ''
${cosmocc}/bin/cosmocc ${./hello.c}
./a.out > $out
'';
};
meta = cosmopolitan.meta // {
description = "compilers for Cosmopolitan C/C++ programs";
};
} ''
mkdir -p $out/bin
install ${cosmopolitan.dist}/tool/scripts/{cosmocc,cosmoc++} $out/bin
sed 's|/opt/cosmo\([ /]\)|${cosmopolitan.dist}\1|g' -i $out/bin/*
'';
in
cosmocc