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;
}
+2 -2
View File
@@ -1,10 +1,10 @@
{ stdenv, runCommandLocal, recurseIntoAttrs, installShellFiles }:
{ lib, stdenv, runCommandLocal, recurseIntoAttrs, installShellFiles }:
let
runTest = name: env: buildCommand:
runCommandLocal "install-shell-files--${name}" ({
nativeBuildInputs = [ installShellFiles ];
meta.platforms = stdenv.lib.platforms.all;
meta.platforms = lib.platforms.all;
} // env) buildCommand;
in
+2 -2
View File
@@ -1,4 +1,4 @@
{ stdenv }:
{ lib, stdenv }:
# This tests that libraries listed in LD_LIBRARY_PATH take precedence over those listed in RPATH.
@@ -84,5 +84,5 @@ in stdenv.mkDerivation {
touch $out
'';
meta.platforms = stdenv.lib.platforms.linux;
meta.platforms = lib.platforms.linux;
}
+2 -2
View File
@@ -1,4 +1,4 @@
{ stdenv, runCommand }:
{ lib, stdenv, runCommand }:
let
bad-shebang = stdenv.mkDerivation {
@@ -13,7 +13,7 @@ let
};
in runCommand "patch-shebangs-test" {
passthru = { inherit bad-shebang; };
meta.platforms = stdenv.lib.platforms.all;
meta.platforms = lib.platforms.all;
} ''
printf "checking whether patchShebangs works properly... ">&2
if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
+4 -4
View File
@@ -1,4 +1,4 @@
{ stdenv }:
{ lib, stdenv }:
let
foo = stdenv.mkDerivation {
@@ -12,7 +12,7 @@ let
chmod +x $out/bin/foo
cp ${./foo.c} $out/include/foo.h
$CC -shared \
${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
-o $out/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
${./foo.c}
'';
@@ -30,7 +30,7 @@ let
chmod +x $out/bin/bar
cp ${./bar.c} $dev/include/bar.h
$CC -shared \
${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
-o $dev/lib/libbar${stdenv.hostPlatform.extensions.sharedLibrary} \
${./bar.c}
'';
@@ -64,5 +64,5 @@ stdenv.mkDerivation {
touch $out
'';
meta.platforms = stdenv.lib.platforms.all;
meta.platforms = lib.platforms.all;
}