Revert "llvmPackages: do not include static archives when shared…"

Reverts #162607 / 1748887ff2.

Reason for revert: This change caused llvm-config{,-native} to be unable
to find static archives bundled with LLVM, as has been [reported]. Ever
since #152944 using moveToOutput in LLVM is _evil_ because llvm-config
obtains it knowledge about the installation locations from the CMake
configure step.

Consequently a change like #162607 will need to be implemented by making
LLVM itself install the static archives to the correct location or by
adding yet another patch which updates llvm-config's knowledge of the
location. The latter is not desireable in my opinion, though, since it
is just asking for this sort of trouble: Before #152944 we had an
outputs.patch that did this sort of things which broke spectacularly in
edge cases.

Fixes #148117.

[reported]: https://github.com/NixOS/nixpkgs/issues/148117#issuecomment-1158245576
This commit is contained in:
sternenseemann 2022-06-17 12:17:43 +02:00
parent 477504f766
commit 0083a683d7
11 changed files with 0 additions and 66 deletions

View File

@ -244,12 +244,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -256,12 +256,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -244,12 +244,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -206,12 +206,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -203,12 +203,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -222,12 +222,6 @@ stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes} '') versionSuffixes}
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -215,12 +215,6 @@ stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes} '') versionSuffixes}
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -234,12 +234,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes} '') versionSuffixes}
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -226,12 +226,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -241,12 +241,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';

View File

@ -200,12 +200,6 @@ in stdenv.mkDerivation (rec {
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
'' ''
+ optionalString enableSharedLibraries ''
mkdir -p $dev/lib
mv $lib/lib/*.a $dev/lib
sed -i -E "s|$lib/lib/(.*)\.a|$dev/lib/\1\.a|" \
"$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake"
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
''; '';