diff --git a/nix/rocksdb.nix b/nix/rocksdb.nix index e9edc44900..d40ac32b38 100644 --- a/nix/rocksdb.nix +++ b/nix/rocksdb.nix @@ -81,7 +81,7 @@ stdenv.mkDerivation rec { mkdir -p $tools/bin cp tools/{ldb,sst_dump}${stdenv.hostPlatform.extensions.executable} $tools/bin/ '' + lib.optionalString stdenv.isDarwin '' - ls -1 $tools/bin/* | xargs -I{} ${stdenv.cc.bintools.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" $out/lib/librocksdb.dylib {} + ls -1 $tools/bin/* | xargs -I{} ${stdenv.cc.bintools.targetPrefix}install_name_tool -change "@rpath/librocksdb.${lib.versions.major version}.dylib" $out/lib/librocksdb.dylib {} '' + lib.optionalString (stdenv.isLinux && enableShared) '' ls -1 $tools/bin/* | xargs -I{} patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib {} ''; @@ -94,7 +94,7 @@ stdenv.mkDerivation rec { fi '' + lib.optionalString stdenv.isDarwin '' ${stdenv.cc.targetPrefix}install_name_tool -change "@rpath/libsnappy.1.dylib" "${snappy}/lib/libsnappy.1.dylib" $out/lib/librocksdb.dylib - ${stdenv.cc.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" "$out/lib/librocksdb.8.dylib" $out/lib/librocksdb.dylib + ${stdenv.cc.targetPrefix}install_name_tool -change "@rpath/librocksdb.${lib.versions.major version}.dylib" "$out/lib/librocksdb.${lib.versions.major version}.dylib" $out/lib/librocksdb.dylib ''; meta = with lib; {