diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix index c32766134a9f..948b4ddd54db 100644 --- a/pkgs/applications/graphics/darktable/default.nix +++ b/pkgs/applications/graphics/darktable/default.nix @@ -34,8 +34,6 @@ stdenv.mkDerivation rec { "-DUSE_KWALLET=OFF" ]; - # Doc has high risk of collisions - postInstall = "rm -r $out/share/doc"; # darktable changed its rpath handling in commit # 83c70b876af6484506901e6b381304ae0d073d3c and as a result the diff --git a/pkgs/applications/networking/p2p/transmission/default.nix b/pkgs/applications/networking/p2p/transmission/default.nix index 9d37f1f43981..ab4fc0908ba8 100644 --- a/pkgs/applications/networking/p2p/transmission/default.nix +++ b/pkgs/applications/networking/p2p/transmission/default.nix @@ -57,9 +57,6 @@ in stdenv.mkDerivation { ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ] ; - # Doc has high risk of collisions - postInstall = "rm -r $out/share/doc"; - buildInputs = [ openssl curl diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh index 87bbefa6bbfa..73f24a9a2054 100755 --- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh +++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh @@ -68,6 +68,24 @@ cmakeConfigurePhase() { # nix/store directory. cmakeFlags="-DCMAKE_INSTALL_NAME_DIR=${!outputLib}/lib $cmakeFlags" + # The docdir flag needs to include PROJECT_NAME as per GNU guidelines, + # try to extract it from CMakeLists.txt. + if [[ -z "$shareDocName" ]]; then + local cmakeLists="${cmakeDir}/CMakeLists.txt" + if [[ -f "$cmakeLists" ]]; then + local shareDocName="$(grep --only-matching --perl-regexp --ignore-case '\bproject\s*\(\s*"?\K([^[:space:]")]+)' < "$cmakeLists" | head -n1)" + fi + # The argument sometimes contains garbage or variable interpolation. + # When that is the case, let’s fall back to the derivation name. + if [[ -z "$shareDocName" ]] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-+]'; then + if [[ -n "${pname-}" ]]; then + shareDocName="$pname" + else + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')" + fi + fi + fi + # This ensures correct paths with multiple output derivations # It requires the project to use variables from GNUInstallDirs module # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html