lib/default.nix
λpkgs
let
Toolchain versions
The architecture Fil-C builds for; upstream's libpas/common.sh.
uses platform used by dynamicLinker elfFormat llvmTarget
x86_64 = "X86"; aarch64 = "AArch64";.${filcArch}
uses filcArch used by commonLLVMOptions
glibc's aclocal.m4 insists on exactly this Autoconf release.
Standard ccache setup for all builds
if [ -w "/nix/var/cache/ccache" ]; then
export CCACHE_DIR=/nix/var/cache/ccache
export CCACHE_COMPRESS=1
export CCACHE_SLOPPINESS=random_seed
export CCACHE_UMASK=007
else
export CCACHE_DISABLE=1
fi
used by mkFilcLLVMBuild
"RelWithDebInfo"
true
false
false
false
false
false
false
false
false
true
"-static-libgcc"
"$out"
"lld"
uses llvmTarget used by allOptions
Convert attribute set to CMake flags
This is just a function that abstracts some common stuff for doing CMake/ninja/ccache builds.
λpname, cmakeOptions?, cmakeSource, buildDir?, ninjaTargets?, installTargets?, preConfigure?, postBuild?, customInstall?, meta?
| pname | |
| cmakeOptions | default { } |
| cmakeSource | |
| buildDir | default "build" |
| ninjaTargets | default [ ] |
| installTargets | default "install" |
| preConfigure | default "" |
| postBuild | default "" |
| customInstall | default null |
| meta | default { } |
pkgs.ccacheStdenv.mkDerivation
Let Nix decide how many cores to use.
true
NINJA_STATUS="[B %f/%t %es] " ninja -v -C ${buildDir} ${join" " ninjaTargets}
${postBuild}
else
NINJA_STATUS="[I %f/%t %es] " ninja -v -C ${buildDir} ${join" " installTargets}
uses cmakeFlags join setupCcache
Merge multiple derivations into one (layers applied in order)
λname layers
mkdir -p $out/{lib,include,bin}
${lib.concatMapStringsSep"\n" layer: ''
[ -d ${layer}/lib ] && rsync -a ${layer}/lib/ $out/lib/ || true
[ -d ${layer}/include ] && rsync -a ${layer}/include/ $out/include/ || true
[ -d ${layer}/bin ] && rsync -a ${layer}/bin/ $out/bin/ || true
'' layers}
chmod -R u+w $out
uses lib
Add nixpkgs libc contract metadata to a sysroot
λsysroot
λdynamicLinker, crts?
| dynamicLinker | |
| crts | default "crt1.o" "crti.o" "crtn.o" |
uses lib
in
188inherit
lib join
189inherit
gcc llvm llvmMajor targetPlatform gcc-lib filcArch llvmTarget elfFormat dynamicLinker
200inherit
autoconf272 setupCcache commonLLVMOptions cmakeFlags
206inherit
mkFilcLLVMBuild mergeLayers addLibcMetadata
Define a version of the host Clang that doesn't have any automatic stuff, to build libpizlo in a clean and consistent way.