package.nix: Avoid ${..} for conditional strings

Using `+` is Nixpkgs standard ideom for this, and helps avoid needless
rebuilds somewhat.
This commit is contained in:
John Ericson 2023-12-13 20:49:31 +00:00
parent 28f2f3136d
commit 2d24875fe4

View file

@ -254,25 +254,25 @@ in {
disallowedReferences = [ boost ]; disallowedReferences = [ boost ];
preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) '' preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) (
# Copy libboost_context so we don't get all of Boost in our closure. ''
# https://github.com/NixOS/nixpkgs/issues/45462 # Copy libboost_context so we don't get all of Boost in our closure.
mkdir -p $out/lib # https://github.com/NixOS/nixpkgs/issues/45462
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*,libboost_regex*} $out/lib mkdir -p $out/lib
rm -f $out/lib/*.a cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*,libboost_regex*} $out/lib
${lib.optionalString stdenv.hostPlatform.isLinux '' rm -f $out/lib/*.a
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
chmod u+w $out/lib/*.so.* chmod u+w $out/lib/*.so.*
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
''} '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
${lib.optionalString stdenv.hostPlatform.isDarwin ''
for LIB in $out/lib/*.dylib; do for LIB in $out/lib/*.dylib; do
chmod u+w $LIB chmod u+w $LIB
install_name_tool -id $LIB $LIB install_name_tool -id $LIB $LIB
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
done done
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
''} ''
''; );
configureFlags = [ configureFlags = [
"--sysconfdir=/etc" "--sysconfdir=/etc"