libredirect: Use extensions.sharedLibrary

This is to make sure we get the correct shared library suffix of the
target platform. While for example on Darwin it would even work with the
hardcoded .so prefix it's IMHO a bit nicer to have the actual native
extension.

Signed-off-by: aszlig <aszlig@nix.build>
This commit is contained in:
aszlig
2018-11-12 09:59:39 +01:00
parent 9ef52352bd
commit ba1fddb315

View File

@@ -5,11 +5,16 @@ stdenv.mkDerivation {
unpackPhase = "cp ${./libredirect.c} libredirect.c";
shlibext = stdenv.targetPlatform.extensions.sharedLibrary;
buildPhase = ''
$CC -Wall -std=c99 -O3 -shared libredirect.c -o libredirect.so -fPIC -ldl
$CC -Wall -std=c99 -O3 -shared libredirect.c \
-o "libredirect$shlibext" -fPIC -ldl
'';
installPhase = "mkdir -p $out/lib; cp libredirect.so $out/lib";
installPhase = ''
install -vD "libredirect$shlibext" "$out/lib/libredirect$shlibext"
'';
meta = {
platforms = stdenv.lib.platforms.unix;