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

llvm-4/clang-4: Build and install man pages #25921

Merged
merged 3 commits into from
May 28, 2017

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented May 19, 2017

Motivation for this change

man pages are useful!

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@mention-bot
Copy link

@dtzWill, thanks for your PR! By analyzing the history of the files in this pull request, we identified @copumpkin to be a potential reviewer.

@LnL7 LnL7 added the 1.severity: mass-darwin-rebuild This PR causes a large number of packages to rebuild on Darwin label May 19, 2017
@@ -13,20 +13,32 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';

buildInputs = [ cmake libedit libxml2 llvm python ];
buildInputs = [ cmake libedit libxml2 llvm python python.pkgs.sphinx ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a rebuild for darwin anyway, can you move cmake, ... to nativeBuildInputs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, okay. I'll push that here although it changes the scope of the PR a bit.. feel free to retitle it if you'd like 👍.

postPatch = ''
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp

# Patch for standalone doc building
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';

outputs = [ "out" "python" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this should include man, since this is part of the darwin stdenv?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erm, not sure what you mean sorry! Sounds like you're suggesting adding 'man' as an additional output, but I'm not sure what impact that would have on the Darwin stdenv (positive or negative).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed, adding "man" to the outputs and copying them to $man instead.

  1. without that every darwin user will end up with the manpages on their system, regardless if they installed it in a way that man can even find them.
  2. having a separate output also allows users to install the manpages without polluting their global environment with the cc and clang binaries.

for example:

{ pkgs, ... }:
{
  environment.systemPackages = [ llvm.man clang.man ];
}

Copy link
Member Author

@dtzWill dtzWill May 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, is there a good way to avoid including the manpages in stdenv but still include them when installing the compiler explicitly?

Looking into it, looks like cc-wrapper propagates the man output which I believe satisfies the "make available when explicitly installed" part of my question above.

Neat re:installing man pages globally without their binaries, I hadn't thought about that and it seems very useful indeed!

I'll make that change shortly, although I don't think i can check whether the Darwin stdenv ends up containing the man page or not.

(rebuilding, will push once it at least builds locally :))

Copy link
Member

@LnL7 LnL7 May 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think meta.outputsToInstall is used when you want to include an output by default when 'installing'. And I'm pretty sure that's not used when it's just a build input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for checking the darwin stdenv, I think you can do this and check for clang-*-man.

nix-store -qR $(nix-instantiate -A stdenv --argstr system x86_64-darwin)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Looks like it's working, then! 👍

@dtzWill
Copy link
Member Author

dtzWill commented May 19, 2017

Thanks for the comments/review, updated!

@dtzWill dtzWill force-pushed the feature/llvm-manpages branch from ad86fcf to 3d1c1c5 Compare May 19, 2017 21:05
@LnL7
Copy link
Member

LnL7 commented May 20, 2017

Looks like something in the stdenv is trying to refer to the man output 😕, also not sure why that breaks the build.

output ‘/nix/store/vrkx52xhl4y54dnvq169g8va5m74786j-stdenv-darwin’ is not allowed to refer to path ‘/nix/store/pmwxqq97xx865pxq64jdgcphfpdzf7gc-clang-4.0.0-man’

Verified

This commit was signed with the committer’s verified signature. The key has expired.
LnL7 Daiderd Jordan
@LnL7
Copy link
Member

LnL7 commented May 21, 2017

That should do it. I don't think it's possible not to reference the man output unless we change the cc-wrapper to also use multiple outputs.

@LnL7 LnL7 self-assigned this May 23, 2017
@LnL7 LnL7 changed the base branch from master to staging May 27, 2017 21:30
@LnL7
Copy link
Member

LnL7 commented May 27, 2017

FYI. I added support for multiple outputs to the cc-wrapper in #26153

@LnL7 LnL7 merged commit 779ec14 into NixOS:staging May 28, 2017
@dtzWill
Copy link
Member Author

dtzWill commented May 28, 2017

Woohoo, thanks!

@dtzWill dtzWill deleted the feature/llvm-manpages branch May 28, 2017 19:29
@vcunat
Copy link
Member

vcunat commented Jun 1, 2017

BTW, I'm not convinced that tiny outputs without extra dependencies are worth splitting.

$ du -hs ./result-man/
12K     ./result-man/

EDIT: well, if there was some use case for having the man pages without the rest, that would be a very good reason. At least in general I fail to see use cases for having documentation without the documented thing itself.

@LnL7
Copy link
Member

LnL7 commented Jun 1, 2017

@vcunat Size isn't the main reason why I suggested it. I think installing compilers in the system/user profile is a bad idea because it makes nix-shell -A unreliable. This makes it straightforward to only install the manpages without having to resort to buildEnv with pathsToLink or something.

@vcunat
Copy link
Member

vcunat commented Jun 1, 2017

Hmm, right, that makes good-enough sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.severity: mass-darwin-rebuild This PR causes a large number of packages to rebuild on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants