Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAKE_INSTALL_DOCDIR set incorrectly without multiple outputs #82304

Closed
jtojnar opened this issue Mar 11, 2020 · 5 comments
Closed

CMAKE_INSTALL_DOCDIR set incorrectly without multiple outputs #82304

jtojnar opened this issue Mar 11, 2020 · 5 comments
Labels
0.kind: bug 6.topic: stdenv Standard environment

Comments

@jtojnar
Copy link
Contributor

jtojnar commented Mar 11, 2020

CMake’s GNUInstallDirs module expects CMAKE_INSTALL_DOCDIR variable to contain the project name.

The issue is that $shareDocName used by the setup hook

cmakeFlags="-DCMAKE_INSTALL_DOCDIR=${!outputDoc}/share/doc/${shareDocName} $cmakeFlags"

is only defined when using multiple outputs:

if [ -z "$shareDocName" ]; then
local confScript="$configureScript"
if [ -z "$confScript" ] && [ -x ./configure ]; then
confScript=./configure
fi
if [ -f "$confScript" ]; then
local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"
fi
# PACKAGE_TARNAME sometimes contains garbage.
if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then
shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"
fi
fi

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 11, 2020

Actually, the variable does not seem to be set even with multiple outputs. Which makes sense since there is no configure script.

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 11, 2020

The issue would actually be that, since this package sets pname instead of name, shareDocName is falling back to an empty string. Edit: mkDerivation creates name as well since it is actually needed by derivation construct.

Though here _multioutConfig does not even run since the CMake setup hook makes it return immediately:


if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then return; fi;

@jtojnar
Copy link
Contributor Author

jtojnar commented Mar 11, 2020

Asked on StackOverflow about the best way to continue:

https://stackoverflow.com/q/60631865/160386

@doronbehar
Copy link
Contributor

Asked on StackOverflow about the best way to continue:

Perhaps this question is more appropriate for https://discourse.cmake.org/ ?

alyssais added a commit to alyssais/nixpkgs that referenced this issue Jun 24, 2020
This brings cmake inline with the behaviour used for configure
scripts, defined in multiple-outputs.sh.  It's important because
that setup hook will only set shareDocName if multiple outputs are in
use (and setOutputFlags hasn't been disabled).  So previously,
CMAKE_INSTALL_DOCDIR would be set to $out/share/doc for single-output
derivations, instead of $out/share/doc/$shareDocName, which would
result in collisions.

Since this hook now uses the setOutputFlags variable, I had to remove
the empty assignment of it added in
a714284.

Fixes: NixOS#82304
@jtojnar
Copy link
Contributor Author

jtojnar commented Jul 19, 2020

The change was actually reverted, #93166 is a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: stdenv Standard environment
Projects
None yet
Development

No branches or pull requests

2 participants