2022-04-03 18:54:34 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, unzip, bintools-unwrapped }:
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-04-17 00:35:05 +00:00
|
|
|
pname = "cosmopolitan";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "unstable-2022-03-22";
|
2021-04-17 00:35:05 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jart";
|
|
|
|
repo = "cosmopolitan";
|
2022-03-30 09:31:56 +00:00
|
|
|
rev = "5022f9e9207ff2b79ddd6de6d792d3280e12fb3a";
|
|
|
|
sha256 = "sha256-UjL4wR5HhuXiQXg6Orcx2fKiVGRPMJk15P779BP1fRA=";
|
2021-04-17 00:35:05 +00:00
|
|
|
};
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nativeBuildInputs = [ bintools-unwrapped unzip ];
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
outputs = [ "out" "dist" ];
|
2021-04-17 00:35:05 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
# slashes are significant because upstream uses o/$(MODE)/foo.o
|
|
|
|
buildFlags = "o/cosmopolitan.h o//cosmopolitan.a o//libc/crt/crt.o o//ape/ape.o o//ape/ape.lds";
|
|
|
|
checkTarget = "o//test";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
2021-04-17 00:35:05 +00:00
|
|
|
dontConfigure = true;
|
|
|
|
dontFixup = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-04-03 18:54:34 +00:00
|
|
|
mkdir -p $out/{include,lib}
|
2022-03-30 09:31:56 +00:00
|
|
|
install o/cosmopolitan.h $out/include
|
2021-04-17 00:35:05 +00:00
|
|
|
install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} $out/lib
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
cp -RT . "$dist"
|
2021-04-17 00:35:05 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://justine.lol/cosmopolitan/";
|
|
|
|
description = "Your build-once run-anywhere c library";
|
|
|
|
platforms = platforms.x86_64;
|
|
|
|
badPlatforms = platforms.darwin;
|
|
|
|
license = licenses.isc;
|
2022-04-03 18:54:34 +00:00
|
|
|
maintainers = teams.cosmopolitan.members;
|
2021-04-17 00:35:05 +00:00
|
|
|
};
|
|
|
|
}
|