Skip to content

Commit

Permalink
Problem: rocksdb nix expression hard code the major version
Browse files Browse the repository at this point in the history
- handle the major version dynamically.

Signed-off-by: yihuang <[email protected]>
  • Loading branch information
yihuang authored Oct 9, 2023
1 parent a31a35d commit 4cc4f67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nix/rocksdb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
'';
Expand All @@ -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; {
Expand Down

0 comments on commit 4cc4f67

Please sign in to comment.