clang: move libclang to separate lib output

Currently clang-unwrapped can't be used as a buildInput without also
shadowing clang/clang++ of a clang based stdenv.
This commit is contained in:
Daiderd Jordan 2017-12-31 11:07:57 +01:00
parent a9f118914f
commit 812f7714e2
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
8 changed files with 22 additions and 10 deletions

View File

@ -29,7 +29,7 @@ let
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
'';
outputs = [ "out" "python" ];
outputs = [ "out" "lib" "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -38,6 +38,9 @@ let
ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
ln -sv $out/bin/clang $out/bin/cpp
# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
@ -51,7 +54,6 @@ let
enableParallelBuilding = true;
passthru = {
lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
isClang = true;
inherit llvm;
} // stdenv.lib.optionalAttrs stdenv.isLinux {

View File

@ -22,6 +22,8 @@ let
inherit clang-tools-extra_src stdenv;
};
libclang = self.clang-unwrapped.lib;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun {

View File

@ -31,7 +31,7 @@ let
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
'';
outputs = [ "out" "python" ];
outputs = [ "out" "lib" "python" ];
# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
@ -40,6 +40,9 @@ let
ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
ln -sv $out/bin/clang $out/bin/cpp
# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
@ -53,7 +56,6 @@ let
enableParallelBuilding = true;
passthru = {
lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
isClang = true;
inherit llvm;
} // stdenv.lib.optionalAttrs stdenv.isLinux {

View File

@ -22,6 +22,8 @@ let
inherit clang-tools-extra_src stdenv;
};
libclang = self.clang-unwrapped.lib;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun {

View File

@ -49,7 +49,7 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "python" ]
outputs = [ "out" "lib" "python" ]
++ stdenv.lib.optional enableManpages "man";
# Clang expects to find LLVMgold in its own prefix
@ -59,13 +59,15 @@ let
ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
ln -sv $out/bin/clang $out/bin/cpp
# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
mv $out/bin/set-xcode-analyzer $python/bin
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
''
+ stdenv.lib.optionalString enableManpages ''
@ -79,7 +81,6 @@ let
enableParallelBuilding = true;
passthru = {
lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
isClang = true;
inherit llvm;
} // stdenv.lib.optionalAttrs stdenv.isLinux {

View File

@ -34,6 +34,7 @@ let
llvm = overrideManOutput llvm;
clang-unwrapped = overrideManOutput clang-unwrapped;
libclang = self.clang-unwrapped.lib;
llvm-manpages = lowPrio self.llvm.man;
clang-manpages = lowPrio self.clang-unwrapped.man;

View File

@ -50,7 +50,7 @@ let
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
'';
outputs = [ "out" "python" ]
outputs = [ "out" "lib" "python" ]
++ stdenv.lib.optional enableManpages "man";
# Clang expects to find LLVMgold in its own prefix
@ -60,13 +60,15 @@ let
ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
ln -sv $out/bin/clang $out/bin/cpp
# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
mkdir -p $python/bin $python/share/clang/
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
mv $out/bin/set-xcode-analyzer $python/bin
fi
mv $out/share/clang/*.py $python/share/clang
rm $out/bin/c-index-test
''
+ stdenv.lib.optionalString enableManpages ''
@ -80,7 +82,6 @@ let
enableParallelBuilding = true;
passthru = {
lib = self; # compatibility with gcc, so that `stdenv.cc.cc.lib` works on both
isClang = true;
inherit llvm;
} // stdenv.lib.optionalAttrs stdenv.isLinux {

View File

@ -34,6 +34,7 @@ let
llvm = overrideManOutput llvm;
clang-unwrapped = overrideManOutput clang-unwrapped;
libclang = self.clang-unwrapped.lib;
llvm-manpages = lowPrio self.llvm.man;
clang-manpages = lowPrio self.clang-unwrapped.man;