depot/third_party/nixpkgs/pkgs/development/tools/cosmocc/default.nix
Default email 94427deb9d Project import generated by Copybara.
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
2023-05-24 16:37:59 +03:00

34 lines
846 B
Nix

{ runCommand, cosmopolitan }:
let
inherit (cosmopolitan) version;
cosmocc =
runCommand "cosmocc-${version}"
{
pname = "cosmocc";
inherit version;
meta = cosmopolitan.meta // {
description = "compilers for Cosmopolitan C/C++ programs";
};
passthru.tests = {
cc = runCommand "c-test" { } ''
cat > hello.c << END
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
END
${cosmocc}/bin/cosmocc hello.c
./a.out > $out
'';
};
} ''
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