-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
c8a2502
commit d83fcfa
Showing
3 changed files
with
238 additions
and
135 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,89 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
llvm_meta, | ||
src ? null, | ||
monorepoSrc ? null, | ||
version, | ||
release_version, | ||
runCommand, | ||
python3, | ||
python3Packages, | ||
patches ? [ ], | ||
cmake, | ||
ninja, | ||
isFullBuild ? true, | ||
linuxHeaders, | ||
}: | ||
let | ||
pname = "libc"; | ||
|
||
src' = 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" | ||
''); | ||
|
||
stdenv' = | ||
if stdenv.cc.isClang then | ||
stdenv.override { | ||
cc = stdenv.cc.override { | ||
nixSupport = stdenv.cc.nixSupport // { | ||
cc-cflags = lib.remove "-lunwind" stdenv.cc.nixSupport.cc-cflags; | ||
}; | ||
}; | ||
} | ||
else | ||
stdenv; | ||
in | ||
stdenv'.mkDerivation (finalAttrs: { | ||
inherit pname version patches; | ||
|
||
src = src'; | ||
|
||
sourceRoot = "${finalAttrs.src.name}/runtimes"; | ||
|
||
nativeBuildInputs = | ||
[ | ||
cmake | ||
python3 | ||
] | ||
++ (lib.optional (lib.versionAtLeast release_version "15") ninja) | ||
++ (lib.optional isFullBuild python3Packages.pyyaml); | ||
|
||
buildInputs = lib.optional isFullBuild linuxHeaders; | ||
|
||
outputs = [ "out" ] ++ (lib.optional isFullBuild "dev"); | ||
|
||
postUnpack = lib.optionalString isFullBuild '' | ||
patchShebangs $sourceRoot/../$pname/hdrgen/yaml_to_classes.py | ||
chmod +x $sourceRoot/../$pname/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" 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"; | ||
}; | ||
}) |
Oops, something went wrong.