Add libclang.so compat library

Related: rhbz#1928132
This commit is contained in:
Tom Stellard 2021-05-13 19:02:24 -07:00
parent 50d4f87e06
commit cc93e2f5f2
3 changed files with 51 additions and 5 deletions

1
.gitignore vendored
View File

@ -167,3 +167,4 @@
/clang-12.0.0.src.tar.xz.sig
/clang-tools-extra-12.0.0.src.tar.xz
/clang-tools-extra-12.0.0.src.tar.xz.sig
/llvm-11.1.0rc2.src.tar.xz

View File

@ -59,6 +59,13 @@
%bcond_with python3
%endif
%bcond_without bundle_compat_lib
%if %{with bundle_compat_lib}
%global compat_maj_ver 11
%global compat_ver %{compat_maj_ver}.1.0rc2
%endif
%global build_install_prefix %{buildroot}%{install_prefix}
%ifarch ppc64le
@ -71,7 +78,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -83,6 +90,10 @@ Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio
Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig
%endif
Source4: tstellar-gpg-key.asc
%if %{with bundle_compat_lib}
Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/clang-%{compat_ver}.src.tar.xz
Source6: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/llvm-%{compat_ver}.src.tar.xz
%endif
# Patches for clang
Patch0: 0001-PATCH-clang-Reorganize-gtest-integration.patch
@ -265,6 +276,11 @@ Requires: python3
%prep
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'
%if %{with bundle_compat_lib}
%setup -T -q -b 5 -n clang-%{compat_ver}.src
%setup -T -q -b 6 -n llvm-%{compat_ver}.src
%endif
%if 0%{?compat_build}
%autosetup -n %{clang_srcdir} -p2
%else
@ -318,6 +334,27 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
%if %{with bundle_compat_lib}
mv ../clang-%{compat_ver}.src ../clang
%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly"
# Use llvm cmake files from the main package.
#sed -i 's~${LLVM_CMAKE_PATH}~%{_libdir}/cmake/llvm/~' ../clang-%{compat_ver}.src/lib/Basic/CMakeLists.txt
%cmake -S ../llvm-%{compat_ver}.src -B ../clang-compat-libs -G Ninja \
-DLLVM_ENABLE_PROJECTS=clang \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON
%ninja_build -C ../clang-compat-libs libclang.so
%endif
# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the
# rpath of libraries and binaries. llvm will skip the manual setting
# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value
@ -373,10 +410,15 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%cmake_build
%install
%cmake_install
%if %{with bundle_compat_lib}
install -m 0755 ../clang-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
%endif
%if 0%{?compat_build}
# Remove binaries/other files
@ -482,6 +524,9 @@ false
%{pkg_libdir}/*.so.*
%{pkg_libdir}/clang/%{version}
%endif
%if %{with bundle_compat_lib}
%{_libdir}/libclang.so.%{compat_maj_ver}*
%endif
%files devel
%if !0%{?compat_build}
@ -543,6 +588,9 @@ false
%endif
%changelog
* Fri May 14 2021 Tom Stellard <tstellar@redhat.com> - 12.0.0-2
- Add libclang.so compat library
* Fri Apr 16 2021 Tom Stellard <tstellar@redhat.cm> - 12.0.0-1
- 12.0.0 Release

View File

@ -1,4 +1 @@
SHA512 (clang-12.0.0.src.tar.xz) = f5613b9bffc962467d3bedb7f66b4e057e2781eb63c5dadfd3cf0b02453e29eff0a4f844889031292f06a8b4c081d4d41c515b7f719826ce5c4209a09df9f1f6
SHA512 (clang-12.0.0.src.tar.xz.sig) = 9780c2f68dfd7ea633dd137dda265ffda6425be658b0724e25dadb6abc54d3368e7850687ce38f4c3bf0c7049a2c1bd2fb299cec5f548c38f3bc4ca1f8877437
SHA512 (clang-tools-extra-12.0.0.src.tar.xz) = e0323a2506da748b5de32a3df53a987f3f74184c2d02d4e7b173e23e54396427e2d9b6600a7962795020bfc2c0dae16b210a69a4b8784086d1470d88f423c330
SHA512 (clang-tools-extra-12.0.0.src.tar.xz.sig) = 30afa9c2411417c30a47dcdcfe97ebf353ad1de1a98ed82d45bdfb3fafc30dcb335f6fd18ff3b44e2ed34ff5137932e3a4675289242712df01b8b6da8877fcef
SHA512 (llvm-11.1.0rc2.src.tar.xz) = 4293bedabfacc3de5384b5567eb69d4ae19095540c31cf1f46b8e841db36b28215353aace2e55ccc15a069a63ba2954b2c969ad6337bebaa8877248a2dca024b