treewide: stdenv.lib -> lib

This commit is contained in:
Pavol Rusnak
2021-01-24 01:49:49 +01:00
parent 2f34b4b883
commit 90f7338112
49 changed files with 134 additions and 133 deletions
+10 -10
View File
@@ -1,13 +1,13 @@
{ stdenv, glibc }:
with stdenv.lib;
{ lib, stdenv, glibc }:
let
# Sanitizers are not supported on Darwin.
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
sanitizersWorking = !stdenv.hostPlatform.isMusl && (
(stdenv.cc.isClang && versionAtLeast (getVersion stdenv.cc.name) "5.0.0")
(stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "5.0.0")
|| (stdenv.cc.isGNU && stdenv.isLinux)
);
staticLibc = optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
staticLibc = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
in stdenv.mkDerivation {
name = "cc-wrapper-test";
@@ -23,7 +23,7 @@ in stdenv.mkDerivation {
$CXX -o cxx-check ${./cxx-main.cc}
./cxx-check
${optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
printf "checking whether compiler can build with CoreFoundation.framework... " >&2
mkdir -p foo/lib
$CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
@@ -31,12 +31,12 @@ in stdenv.mkDerivation {
''}
${optionalString (!stdenv.isDarwin) ''
${lib.optionalString (!stdenv.isDarwin) ''
printf "checking whether compiler builds valid static C binaries... " >&2
$CC ${staticLibc} -static -o cc-static ${./cc-main.c}
./cc-static
# our glibc does not have pie enabled yet.
${optionalString (stdenv.hostPlatform.isMusl && stdenv.cc.isGNU) ''
${lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.cc.isGNU) ''
printf "checking whether compiler builds valid static pie C binaries... " >&2
$CC ${staticLibc} -static-pie -o cc-static-pie ${./cc-main.c}
./cc-static-pie
@@ -52,7 +52,7 @@ in stdenv.mkDerivation {
printf "checking whether compiler uses NIX_LDFLAGS... " >&2
mkdir -p foo/lib
$CC -shared \
${optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
-DVALUE=42 \
-o foo/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
${./foo.c}
@@ -68,7 +68,7 @@ in stdenv.mkDerivation {
$CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c}
./nostdinc-main++
${optionalString sanitizersWorking ''
${lib.optionalString sanitizersWorking ''
printf "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers
@@ -77,5 +77,5 @@ in stdenv.mkDerivation {
touch $out
'';
meta.platforms = platforms.all;
meta.platforms = lib.platforms.all;
}
+2 -2
View File
@@ -1,4 +1,4 @@
{ stdenv }:
{ lib, stdenv }:
stdenv.mkDerivation {
name = "cc-multilib-test";
@@ -33,5 +33,5 @@ stdenv.mkDerivation {
touch $out
'';
meta.platforms = stdenv.lib.platforms.x86_64;
meta.platforms = lib.platforms.x86_64;
}