2023-05-24 13:37:59 +00:00
|
|
|
{ runCommand, cosmopolitan }:
|
2023-02-16 17:41:37 +00:00
|
|
|
|
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
inherit (cosmopolitan) version;
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
cosmocc =
|
2023-05-24 13:37:59 +00:00
|
|
|
runCommand "cosmocc-${version}"
|
2023-02-16 17:41:37 +00:00
|
|
|
{
|
|
|
|
pname = "cosmocc";
|
2023-05-24 13:37:59 +00:00
|
|
|
inherit version;
|
2023-02-16 17:41:37 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
meta = cosmopolitan.meta // {
|
2023-02-16 17:41:37 +00:00
|
|
|
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
|