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

This commit is contained in:
Will Dietz 2017-05-19 07:26:05 -05:00
parent 7868cb8ad4
commit 9aa3548931
2 changed files with 30 additions and 5 deletions

View File

@ -13,10 +13,15 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
buildInputs = [ cmake libedit libxml2 llvm python ];
buildInputs = [ cmake libedit libxml2 llvm python python.pkgs.sphinx ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++
# Maybe with compiler-rt this won't be needed?
(stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}") ++
@ -24,12 +29,19 @@ let
patches = [ ./purity.patch ];
postBuild = ''
cmake --build . --target docs-clang-man
'';
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" ];
outputs = [ "out" "man" "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -46,6 +58,12 @@ let
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
# Manually install clang manpage
cp docs/man/*.1 $out/share/man/man1/
# Move it and other man pages to 'man' output
moveToOutput "share/man" "$man"
'';
enableParallelBuilding = true;

View File

@ -38,9 +38,9 @@ in stdenv.mkDerivation rec {
mv compiler-rt-* $sourceRoot/projects/compiler-rt
'';
outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
outputs = [ "out" "man" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
buildInputs = [ perl groff cmake libxml2 python libffi ]
buildInputs = [ perl groff cmake libxml2 python libffi python.pkgs.sphinx ]
++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
propagatedBuildInputs = [ ncurses zlib ];
@ -80,6 +80,11 @@ in stdenv.mkDerivation rec {
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ stdenv.lib.optional enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
] ++ stdenv.lib.optional (!isDarwin)
@ -103,7 +108,9 @@ in stdenv.mkDerivation rec {
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
'';
postInstall = ""
postInstall = ''
moveToOutput "share/man" "$man"
''
+ stdenv.lib.optionalString (enableSharedLibraries) ''
moveToOutput "lib/libLLVM-*" "$lib"
moveToOutput "lib/libLLVM.${shlib}" "$lib"