cosmocc: move to cosmopolitan
Also, a refactor.
This commit is contained in:
parent
037d5af018
commit
3666c314f8
5 changed files with 39 additions and 35 deletions
25
pkgs/by-name/co/cosmopolitan/cosmocc.nix
Normal file
25
pkgs/by-name/co/cosmopolitan/cosmocc.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ 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
|
6
pkgs/by-name/co/cosmopolitan/hello.c
Normal file
6
pkgs/by-name/co/cosmopolitan/hello.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, bintools-unwrapped
|
||||
, callPackage
|
||||
, coreutils
|
||||
, substituteAll
|
||||
, unzip
|
||||
|
@ -74,6 +75,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
cosmocc = callPackage ./cosmocc.nix {
|
||||
cosmopolitan = finalAttrs.finalPackage;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://justine.lol/cosmopolitan/";
|
||||
description = "Your build-once run-anywhere c library";
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
{ 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
|
|
@ -20921,7 +20921,7 @@ with pkgs;
|
|||
|
||||
cog = callPackage ../development/web/cog { };
|
||||
|
||||
cosmocc = callPackage ../development/tools/cosmocc { };
|
||||
inherit (cosmopolitan) cosmocc;
|
||||
|
||||
python-cosmopolitan = callPackage ../development/interpreters/python-cosmopolitan { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue