-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3d73af
commit 50de490
Showing
3 changed files
with
228 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
llvm_meta, | ||
src ? null, | ||
monorepoSrc ? null, | ||
version, | ||
release_version, | ||
runCommand, | ||
python3, | ||
python3Packages, | ||
patches ? [ ], | ||
cmake, | ||
ninja, | ||
isFullBuild ? true, | ||
linuxHeaders, | ||
}: | ||
let | ||
pname = "libc"; | ||
|
||
src' = | ||
if monorepoSrc != null then | ||
runCommand "${pname}-src-${version}" { } ('' | ||
mkdir -p "$out" | ||
cp -r ${monorepoSrc}/cmake "$out" | ||
cp -r ${monorepoSrc}/runtimes "$out" | ||
cp -r ${monorepoSrc}/llvm "$out" | ||
cp -r ${monorepoSrc}/${pname} "$out" | ||
'') | ||
else | ||
src; | ||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
inherit pname version patches; | ||
|
||
src = src'; | ||
|
||
sourceRoot = | ||
if lib.versionOlder release_version "13" then null else "${finalAttrs.src.name}/runtimes"; | ||
|
||
nativeBuildInputs = | ||
[ | ||
cmake | ||
python3 | ||
] | ||
++ (lib.optional (lib.versionAtLeast release_version "15") ninja) | ||
++ (lib.optional finalAttrs.passthru.isFullBuild python3Packages.pyyaml); | ||
|
||
buildInputs = lib.optional finalAttrs.passthru.isFullBuild linuxHeaders; | ||
|
||
postUnpack = lib.optionalString finalAttrs.passthru.isFullBuild '' | ||
patchShebangs --host $sourceRoot/hdrgen/yaml_to_classes.py | ||
chmod +x $sourceRoot/hdrgen/yaml_to_classes.py | ||
''; | ||
|
||
prePatch = lib.optionalString (lib.versionAtLeast release_version "13") '' | ||
cd ../${finalAttrs.pname} | ||
chmod -R u+w ../ | ||
''; | ||
|
||
postPatch = lib.optionalString (lib.versionAtLeast release_version "13") '' | ||
cd ../runtimes | ||
''; | ||
|
||
cmakeFlags = [ | ||
(lib.cmakeBool "LLVM_LIBC_FULL_BUILD" finalAttrs.passthru.isFullBuild) | ||
(lib.cmakeFeature "LLVM_ENABLE_RUNTIMES" "libc") | ||
]; | ||
|
||
# For the update script: | ||
passthru = { | ||
monorepoSrc = monorepoSrc; | ||
inherit isFullBuild; | ||
}; | ||
|
||
meta = llvm_meta // { | ||
homepage = "https://libc.llvm.org/"; | ||
description = "Standard C library for LLVM"; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters