Merge pull request #26310 from LnL7/darwin-stdenv-no-sphinx

darwin-stdenv: remove python dependencies
This commit is contained in:
Daiderd Jordan 2017-06-05 12:44:07 +02:00 committed by GitHub
commit 30f329e74b
5 changed files with 37 additions and 23 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,25 +16,28 @@ 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 ];
postBuild = ''
postBuild = stdenv.lib.optionalString enableManpages ''
cmake --build . --target docs-clang-man
'';
@ -45,7 +49,8 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "man" "python" ];
outputs = [ "out" "python" ]
++ stdenv.lib.optional enableManpages "man";
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -62,7 +67,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 enableSharedLibraries "lib"
++ stdenv.lib.optional enableManpages "man";
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,16 +86,19 @@ in stdenv.mkDerivation rec {
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DCOMPILER_RT_INCLUDE_TESTS=OFF" # FIXME: requires clang source code
]
++ stdenv.lib.optional enableSharedLibraries
"-DLLVM_LINK_LLVM_DYLIB=ON"
++ stdenv.lib.optionals enableManpages [
"-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)
]
++ stdenv.lib.optional (!isDarwin)
"-DLLVM_BINUTILS_INCDIR=${binutils.dev}/include"
++ stdenv.lib.optionals (isDarwin) [
++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
];
@ -109,10 +117,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" \

View File

@ -3,7 +3,7 @@
# darwin attributes
, ps
, isBootstrap ? false
, useSharedLibraries ? !stdenv.isCygwin
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
, useNcurses ? false, ncurses
, useQt4 ? false, qt4
}:

View File

@ -233,11 +233,11 @@ in rec {
libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
coreutils findutils diffutils patchutils;
llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
in super.llvmPackages // {
llvm = llvmOverride;
clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
};
llvmPackages = let llvmOverride = llvmPackages.llvm.override { enableManpages = false; inherit libcxxabi; }; in
super.llvmPackages // {
llvm = llvmOverride;
clang-unwrapped = llvmPackages.clang-unwrapped.override { enableManpages = false; llvm = llvmOverride; };
};
darwin = super.darwin // {
inherit (darwin) dyld Libsystem libiconv locale;
@ -313,7 +313,7 @@ in rec {
xz.out xz.bin libcxx libcxxabi gmp.out gnumake findutils bzip2.out
bzip2.bin llvmPackages.llvm llvmPackages.llvm.lib zlib.out zlib.dev libffi.out coreutils ed diffutils gnutar
gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk
gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.man patch pcre.out binutils-raw.out
gnugrep llvmPackages.clang-unwrapped patch pcre.out binutils-raw.out
binutils-raw.dev binutils gettext
]) ++ (with pkgs.darwin; [
dyld Libsystem CF cctools ICU libiconv locale

View File

@ -5637,7 +5637,7 @@ with pkgs;
llvmPackages_4 = callPackage ../development/compilers/llvm/4 ({
inherit (stdenvAdapters) overrideCC;
} // stdenv.lib.optionalAttrs stdenv.isDarwin {
cmake = cmake.override { isBootstrap = true; useSharedLibraries = false; };
cmake = cmake.override { isBootstrap = true; };
libxml2 = libxml2.override { pythonSupport = false; };
python2 = callPackage ../development/interpreters/python/cpython/2.7/boot.nix { inherit (darwin) CF configd; };
});