llvm-packages: add option to enable manpages

This commit is contained in:
Daiderd Jordan 2017-05-31 20:16:13 +02:00
parent 983657087b
commit b3fb9178e8
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
2 changed files with 21 additions and 9 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, fetch, cmake, libxml2, libedit, llvm, version, release_version, clang-tools-extra_src, python
, fixDarwinDylibNames
, enableManpages ? true
}:
let
@ -15,21 +16,24 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
nativeBuildInputs = [ cmake python python.pkgs.sphinx ];
nativeBuildInputs = [ cmake python ]
++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
buildInputs = [ libedit libxml2 llvm ]
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
] ++ stdenv.lib.optionals enableManpages [
"-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}") ++
(stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include");
++ stdenv.lib.optional stdenv.isLinux "-DGCC_INSTALL_PREFIX=${gcc}"
++ stdenv.lib.optional (stdenv.cc.libc != null) "-DC_INCLUDE_DIRS=${stdenv.cc.libc}/include";
patches = [ ./purity.patch ];
@ -45,7 +49,7 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "man" "python" ];
outputs = [ "out" ] ++ stdenv.lib.optional enableManpages "man" ++ [ "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -62,6 +66,8 @@ let
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
''
+ stdenv.lib.optionalString enableManpages ''
# Manually install clang manpage
cp docs/man/*.1 $out/share/man/man1/

View File

@ -16,6 +16,7 @@
, compiler-rt_src
, libcxxabi
, debugVersion ? false
, enableManpages ? true
, enableSharedLibraries ? true
, darwin
}:
@ -38,9 +39,13 @@ in stdenv.mkDerivation rec {
mv compiler-rt-* $sourceRoot/projects/compiler-rt
'';
outputs = [ "out" "man" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
outputs = [ "out" ]
++ stdenv.lib.optional enableManpages "man"
++ stdenv.lib.optional enableSharedLibraries "lib";
nativeBuildInputs = [ perl groff cmake python ]
++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
nativeBuildInputs = [ perl groff cmake python python.pkgs.sphinx ];
buildInputs = [ libxml2 libffi ]
++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
@ -81,6 +86,7 @@ in stdenv.mkDerivation rec {
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
] ++ stdenv.lib.optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
@ -109,10 +115,10 @@ in stdenv.mkDerivation rec {
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
'';
postInstall = ''
postInstall = stdenv.lib.optionalString enableManpages ''
moveToOutput "share/man" "$man"
''
+ stdenv.lib.optionalString (enableSharedLibraries) ''
+ stdenv.lib.optionalString enableSharedLibraries ''
moveToOutput "lib/libLLVM-*" "$lib"
moveToOutput "lib/libLLVM.${shlib}" "$lib"
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \