treewide: use stdenv.hostPlatform.extensions.sharedLibrary where appropriate

This commit is contained in:
Alyssa Ross 2021-10-13 16:38:22 +00:00
parent 7ff58e4a86
commit 851b719ac6
7 changed files with 8 additions and 14 deletions

View file

@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
# z3's install phase is stupid because it tries to calculate the
# python package store location itself, meaning it'll attempt to
# write files into the nix store, and fail.
soext = if stdenv.system == "x86_64-darwin" then ".dylib" else ".so";
soext = stdenv.hostPlatform.extensions.sharedLibrary;
installPhase = ''
mkdir -p $out/bin $out/lib/${python.libPrefix}/site-packages $out/include
cp ../src/api/z3*.h $out/include

View file

@ -151,13 +151,11 @@ stdenv.mkDerivation rec {
in
(lib.optionalString enableFIPS (''
for libname in freebl3 nssdbm3 softokn3
do '' +
do libfile="$out/lib/lib$libname${stdenv.hostPlatform.extensions.sharedLibrary}"'' +
(if stdenv.isDarwin
then ''
libfile="$out/lib/lib$libname.dylib"
DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
'' else ''
libfile="$out/lib/lib$libname.so"
LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
'') + ''
${nss}/bin/shlibsign -v -i "$libfile"

View file

@ -166,13 +166,11 @@ stdenv.mkDerivation rec {
in
(lib.optionalString enableFIPS (''
for libname in freebl3 nssdbm3 softokn3
do '' +
do libfile="$out/lib/lib$libname${stdenv.hostPlatform.extensions.sharedLibrary}"'' +
(if stdenv.isDarwin
then ''
libfile="$out/lib/lib$libname.dylib"
DYLD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
'' else ''
libfile="$out/lib/lib$libname.so"
LD_LIBRARY_PATH=$out/lib:${nspr.out}/lib \
'') + ''
${nss}/bin/shlibsign -v -i "$libfile"

View file

@ -57,7 +57,7 @@
passthru = {
fancyName = "MariaDB";
driver = if stdenv.isDarwin then "lib/libmaodbc.dylib" else "lib/libmaodbc.so";
driver = "lib/libmaodbc${stdenv.hostPlatform.extensions.sharedLibrary}";
};
meta = with lib; {

View file

@ -12,7 +12,7 @@ buildPythonPackage rec {
# TODO: not very nice!
postPatch =
let libname = if stdenv.isDarwin then "libaugeas.dylib" else "libaugeas.so";
let libname = "libaugeas${stdenv.hostPlatform.extensions.sharedLibrary}";
in
''
substituteInPlace augeas/ffi.py \

View file

@ -48,7 +48,7 @@ buildPythonPackage rec {
"-DOPENCOLLADA_LIBRARY_DIR=${opencollada}/lib/opencollada"
"-DSWIG_EXECUTABLE=${swig}/bin/swig"
"-DLIBXML2_INCLUDE_DIR=${libxml2.dev}/include/libxml2"
"-DLIBXML2_LIBRARIES=${libxml2.out}/lib/${if stdenv.isDarwin then "libxml2.dylib" else "libxml2.so"}"
"-DLIBXML2_LIBRARIES=${libxml2.out}/lib/libxml2${stdenv.hostPlatform.extensions.sharedLibrary}"
];
meta = with lib; {

View file

@ -8,9 +8,7 @@
, stdenv
}:
let
node-api-lib = (if stdenv.isDarwin then "libquery_engine.dylib" else "libquery_engine.so");
in rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage rec {
pname = "prisma-engines";
version = "3.2.0";
@ -47,7 +45,7 @@ in rustPlatform.buildRustPackage rec {
cargoBuildFlags = "-p query-engine -p query-engine-node-api -p migration-engine-cli -p introspection-core -p prisma-fmt";
postInstall = ''
mv $out/lib/${node-api-lib} $out/lib/libquery_engine.node
mv $out/lib/libquery_engine${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libquery_engine.node
'';
# Tests are long to compile