From ad9f519879e045bd87b6dc3aaaea7a4d951b9d87 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 8 Aug 2024 14:33:26 +0000 Subject: [PATCH] Add support for bundle_compat_lib --- build.spec.inc | 20 ++++++++++++++++++++ files.spec.inc | 11 +++++++++-- globals.spec.inc | 11 +++++++++++ install.spec.inc | 5 +++++ prep.spec.inc | 5 +++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/build.spec.inc b/build.spec.inc index 39814fa..ea72efb 100644 --- a/build.spec.inc +++ b/build.spec.inc @@ -230,3 +230,23 @@ popd %cmake_build --target runtimes cd .. + +%if %{with bundle_compat_lib} +%cmake -S ../llvm-project-%{compat_ver}.src/llvm -B ../llvm-compat-libs -G Ninja \ + -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_libdir}/llvm%{compat_maj_ver}/ \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_PROJECTS=clang \ + -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_TESTS=OFF + +%ninja_build -C ../llvm-compat-libs LLVM +%ninja_build -C ../llvm-compat-libs libclang.so +%ninja_build -C ../llvm-compat-libs libclang-cpp.so + +%endif diff --git a/files.spec.inc b/files.spec.inc index f8ddaa4..d00fc1c 100644 --- a/files.spec.inc +++ b/files.spec.inc @@ -271,6 +271,9 @@ %if %{with compat_build} %config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf %endif +%if %{with bundle_compat_lib} +%{_libdir}/libLLVM.so.%{compat_maj_ver}* +%endif %files -n %{pkg_name_llvm}-devel %license llvm/LICENSE.TXT @@ -364,8 +367,12 @@ %files -n %{pkg_name_clang}-libs %license clang/LICENSE.TXT %{_prefix}/lib/clang/%{maj_ver}/include/* -%{install_libdir}/libclang.so.* -%{install_libdir}/libclang-cpp.so.* +%{install_libdir}/libclang.so.%{maj_ver}* +%{install_libdir}/libclang-cpp.so.%{maj_ver}* +%if %{with bundle_compat_lib} +%{_libdir}/libclang.so.%{compat_maj_ver}* +%{_libdir}/libclang-cpp.so.%{compat_maj_ver}* +%endif %files -n %{pkg_name_clang}-devel %license clang/LICENSE.TXT diff --git a/globals.spec.inc b/globals.spec.inc index 5714776..4b8cb30 100644 --- a/globals.spec.inc +++ b/globals.spec.inc @@ -5,9 +5,20 @@ %else %bcond_with gold %endif + +# Build compat packages llvmN instead of main package for the current LLVM +# version. Used on Fedora. %bcond_with compat_build +# Bundle compat libraries for a previous LLVM version, as part of llvm-libs and +# clang-libs. Used on RHEL. +%bcond_with bundle_compat_lib %bcond_without check +%if %{with bundle_compat_lib} +%global compat_maj_ver 18 +%global compat_ver %{compat_maj_ver}.1.8 +%endif + # Compat builds do not include python-lit and lldb %if %{with compat_build} %bcond_with python_lit diff --git a/install.spec.inc b/install.spec.inc index 552e531..204781b 100644 --- a/install.spec.inc +++ b/install.spec.inc @@ -269,3 +269,8 @@ rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix} # ghost presence touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix} +%if %{with bundle_compat_lib} +install -m 0755 ../llvm-compat-libs/lib/libLLVM.so.%{compat_maj_ver}* %{buildroot}%{_libdir} +install -m 0755 ../llvm-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir} +install -m 0755 ../llvm-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{buildroot}%{_libdir} +%endif diff --git a/prep.spec.inc b/prep.spec.inc index 896a4c4..aacb9c3 100644 --- a/prep.spec.inc +++ b/prep.spec.inc @@ -3,6 +3,11 @@ %{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %endif +%if %{with bundle_compat_lib} +%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE3001}' --data='%{SOURCE3000}' +%setup -T -q -b 3000 -n llvm-project-%{compat_ver}.src +%endif + # -T : Do Not Perform Default Archive Unpacking (without this, the th source would be unpacked twice) # -b : Unpack The nth Sources Before Changing Directory # -n : Set Name of Build Directory