From ef72749089ae200b5b8da0e7bc046b3200b90fd7 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 12 Nov 2020 13:24:17 +0000 Subject: [PATCH] Apply cmake export patch Related: rhbz#1892200 --- ...ic-library-exports-into-their-own-ex.patch | 48 +++++++++++++++++++ ...-binary-exports-into-their-own-expor.patch | 48 +++++++++++++++++++ llvm.spec | 16 +++++-- 3 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 0001-CMake-Split-static-library-exports-into-their-own-ex.patch create mode 100644 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch diff --git a/0001-CMake-Split-static-library-exports-into-their-own-ex.patch b/0001-CMake-Split-static-library-exports-into-their-own-ex.patch new file mode 100644 index 0000000..03a439e --- /dev/null +++ b/0001-CMake-Split-static-library-exports-into-their-own-ex.patch @@ -0,0 +1,48 @@ +diff -Naur a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +--- a/llvm/cmake/modules/AddLLVM.cmake 2020-08-20 16:24:59.000000000 +0000 ++++ b/llvm/cmake/modules/AddLLVM.cmake 2020-09-15 07:09:05.411311520 +0000 +@@ -760,7 +760,11 @@ + if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + (in_llvm_libs AND "llvm-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS) OR + NOT LLVM_DISTRIBUTION_COMPONENTS) +- set(export_to_llvmexports EXPORT LLVMExports) ++ if (ARG_SHARED) ++ set(export_to_llvmexports EXPORT LLVMExports) ++ else() ++ set(export_to_llvmexports EXPORT LLVMStaticExports) ++ endif() + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) + endif() + +diff -Naur a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt +--- a/llvm/cmake/modules/CMakeLists.txt 2020-08-20 16:24:59.000000000 +0000 ++++ b/llvm/cmake/modules/CMakeLists.txt 2020-09-15 07:09:05.411311520 +0000 +@@ -79,6 +79,7 @@ + # source files are put in the same cmake directory. + set(LLVM_CONFIG_EXPORTS_FILE "${LLVM_EXPORTS_FILE}") + set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS};${LLVM_EXPORTS_BUILDTREE_ONLY}") ++set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake") + set(llvm_config_include_buildtree_only_exports + "include(\"${LLVM_BUILDTREEONLY_EXPORTS_FILE}\")") + configure_file( +@@ -139,6 +140,8 @@ + if(llvm_has_exports) + install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} + COMPONENT cmake-exports) ++ install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} ++ COMPONENT cmake-exports) + endif() + + install(FILES +diff -Naur a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in +--- a/llvm/cmake/modules/LLVMConfig.cmake.in 2020-08-20 16:24:59.000000000 +0000 ++++ b/llvm/cmake/modules/LLVMConfig.cmake.in 2020-09-15 07:09:05.411311520 +0000 +@@ -103,6 +103,8 @@ + set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@") + include("@LLVM_CONFIG_EXPORTS_FILE@") + @llvm_config_include_buildtree_only_exports@ ++ ++ include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL) + endif() + + # By creating intrinsics_gen, omp_gen and acc_gen here, subprojects that depend diff --git a/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch b/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch new file mode 100644 index 0000000..0ba80a8 --- /dev/null +++ b/0001-CMake-Split-test-binary-exports-into-their-own-expor.patch @@ -0,0 +1,48 @@ +diff -Naur a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +--- a/llvm/cmake/modules/AddLLVM.cmake 2020-09-15 09:12:47.596424499 +0000 ++++ b/llvm/cmake/modules/AddLLVM.cmake 2020-09-15 13:36:03.509429423 +0000 +@@ -1235,7 +1235,12 @@ + set(export_to_llvmexports) + if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) +- set(export_to_llvmexports EXPORT LLVMExports) ++ if (${name} STREQUAL "not" OR ${name} STREQUAL "count" OR ++ ${name} STREQUAL "yaml-bench" OR ${name} STREQUAL "lli-child-target") ++ set(export_to_llvmexports EXPORT LLVMTestExports) ++ else() ++ set(export_to_llvmexports EXPORT LLVMExports) ++ endif() + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) + endif() + +diff -Naur a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt +--- a/llvm/cmake/modules/CMakeLists.txt 2020-09-15 09:12:47.596424499 +0000 ++++ b/llvm/cmake/modules/CMakeLists.txt 2020-09-15 09:14:33.110044977 +0000 +@@ -80,6 +80,7 @@ + set(LLVM_CONFIG_EXPORTS_FILE "${LLVM_EXPORTS_FILE}") + set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS};${LLVM_EXPORTS_BUILDTREE_ONLY}") + set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake") ++set(LLVM_CONFIG_TEST_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMTestExports.cmake") + set(llvm_config_include_buildtree_only_exports + "include(\"${LLVM_BUILDTREEONLY_EXPORTS_FILE}\")") + configure_file( +@@ -142,6 +143,8 @@ + COMPONENT cmake-exports) + install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} + COMPONENT cmake-exports) ++ install(EXPORT LLVMTestExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} ++ COMPONENT cmake-exports) + endif() + + install(FILES +diff -Naur a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in +--- a/llvm/cmake/modules/LLVMConfig.cmake.in 2020-09-15 09:12:47.597424505 +0000 ++++ b/llvm/cmake/modules/LLVMConfig.cmake.in 2020-09-15 09:14:54.261169357 +0000 +@@ -105,6 +105,7 @@ + @llvm_config_include_buildtree_only_exports@ + + include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL) ++ include("@LLVM_CONFIG_TEST_EXPORTS_FILE@" OPTIONAL) + endif() + + # By creating intrinsics_gen, omp_gen and acc_gen here, subprojects that depend diff --git a/llvm.spec b/llvm.spec index f9910f3..fbf3cd5 100644 --- a/llvm.spec +++ b/llvm.spec @@ -11,7 +11,7 @@ %global llvm_libdir %{_libdir}/%{name} %global build_llvm_libdir %{buildroot}%{llvm_libdir} #%%global rc_ver 6 -%global baserelease 2 +%global baserelease 3 %global llvm_srcdir llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src %global maj_ver 11 %global min_ver 0 @@ -57,6 +57,10 @@ Patch1: 0001-SystemZ-Use-LA-instead-of-AGR-in-eliminateFrameIndex.patch Patch2: 0001-gcc11.patch + +Patch101: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch +Patch102: 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch + BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake @@ -212,7 +216,7 @@ pathfix.py -i %{__python3} -pn \ %endif %endif \ - -DLLVM_TARGETS_TO_BUILD=all \ + -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF" \ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ -DLLVM_ENABLE_ZLIB:BOOL=ON \ -DLLVM_ENABLE_FFI:BOOL=ON \ @@ -220,7 +224,6 @@ pathfix.py -i %{__python3} -pn \ %if %{with gold} -DLLVM_BINUTILS_INCDIR=%{_includedir} \ %endif - -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR \ \ -DLLVM_BUILD_RUNTIME:BOOL=ON \ \ @@ -481,6 +484,8 @@ fi %{_includedir}/llvm-c %{_libdir}/libLLVM.so %{_libdir}/cmake/llvm +%exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake +%exclude %{_libdir}/cmake/llvm/LLVMTestExports.cmake %else %{_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{pkg_bindir}/llvm-config @@ -503,6 +508,7 @@ fi %if %{without compat_build} %{_libdir}/*.a %exclude %{_libdir}/libLLVMTestingSupport.a +%{_libdir}/cmake/llvm/LLVMStaticExports.cmake %else %{_libdir}/%{name}/lib/*.a %endif @@ -527,6 +533,7 @@ fi %{_bindir}/llvm-opt-fuzzer %{_libdir}/BugpointPasses.so %{_libdir}/LLVMHello.so +%{_libdir}/cmake/llvm/LLVMTestExports.cmake %files googletest %license LICENSE.TXT @@ -536,6 +543,9 @@ fi %endif %changelog +* Thu Nov 12 2020 sguelton@redhat.com - 11.0.0-3 +- Apply cmake export patch + * Sat Oct 31 2020 Jeff Law - 11.0.0-2 - Fix missing #include for gcc-11