forked from mirrors/nixpkgs
Merge pull request #93166 from jtojnar/cmake-docdir
This commit is contained in:
commit
7dff6d6681
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue