Port clang changes

From: bec3936967
This commit is contained in:
Nikita Popov 2024-07-31 12:38:37 +00:00 committed by Timm Bäder
parent c3ed99b303
commit ba868932ac
5 changed files with 55 additions and 55 deletions

View file

@ -62,15 +62,9 @@ popd
-DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON \
%endif
-DPython3_EXECUTABLE=%{__python3} \
%if %{with compat_build}
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
-DCLANG_BUILD_TOOLS:BOOL=OFF \
%else
-DLLVM_INCLUDE_TESTS:BOOL=ON \
-DCLANG_INCLUDE_TESTS:BOOL=ON \
-DLLVM_BUILD_UTILS:BOOL=ON \
%endif
-DCLANG_ENABLE_ARCMT:BOOL=ON \
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \
-DCLANG_INCLUDE_DOCS:BOOL=ON \

View file

@ -497,7 +497,7 @@
%license clang-tools-extra/LICENSE.TXT
%{install_includedir}/clang-tidy/
%files -n git-clang-format
%files -n git-clang-format%{pkg_suffix}
%license clang/LICENSE.TXT
%{install_bindir}/git-clang-format
%if %{with compat_build}

View file

@ -47,6 +47,7 @@
%if %{with compat_build}
%global pkg_name_llvm llvm%{maj_ver}
%global pkg_suffix %{maj_ver}
%global exec_suffix -%{maj_ver}
%global install_prefix %{_libdir}/%{pkg_name_llvm}
%global install_bindir %{install_prefix}/bin
@ -68,6 +69,7 @@
%global install_libexecdir %{_libexecdir}
%global install_docdir %{_docdir}
%global pkg_datadir %{_datadir}
%global pkg_suffix %{nil}
%global exec_suffix %{nil}
%endif

View file

@ -101,24 +101,13 @@ cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake
#region CLANG installation
%if %{with compat_build}
# TODO(kkleine): I don't know if the removal of every binary
# below is what we want to do in big-merge for compat packages.
# Re-evaluate this!
# Remove binaries/other files
rm -Rf %{buildroot}%{install_bindir}
rm -Rf %{buildroot}%{install_prefix}/share
rm -Rf %{buildroot}%{install_prefix}/libexec
# Remove scanview-py helper libs
rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild}
%else
# Add a symlink in /usr/bin to clang-format-diff
ln -s %{install_datadir}/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff
# File in the macros file for other packages to use. We are not doing this
# in the compat package, because the version macros would # conflict with
# eachother if both clang and the clang compat package were installed together.
%if %{without compat_build}
install -p -m0644 -D %{SOURCE2005} %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang}
sed -i -e "s|@@CLANG_MAJOR_VERSION@@|%{maj_ver}|" \
-e "s|@@CLANG_MINOR_VERSION@@|%{min_ver}|" \
@ -140,18 +129,55 @@ mv %{buildroot}%{_prefix}/%{_lib}/{libear,libscanbuild} %{buildroot}%{python3_si
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libear
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libscanbuild
# Fix permissions of scan-view scripts
chmod a+x %{buildroot}%{_datadir}/scan-view/{Reporter.py,startfile.py}
# multilib fix
%multilib_fix_c_header --file %{_includedir}/clang/Config/config.h
# Move emacs integration files to the correct directory
mkdir -p %{buildroot}%{_emacs_sitestartdir}
for f in clang-format.el clang-rename.el clang-include-fixer.el; do
mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/$f
done
# Create Manpage symlinks
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++.1.gz
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang-%{maj_ver}.1.gz
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++-%{maj_ver}.1.gz
# Fix permission
chmod u-x %{buildroot}%{_mandir}/man1/scan-build.1*
# Add clang++-{version} symlink
ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver}
%else
# Not sure where to put these python modules for the compat build.
rm -Rf %{buildroot}%{install_libdir}/{libear,libscanbuild}
# Not sure where to put the emacs integration files for the compat build.
rm -Rf %{buildroot}%{install_datadir}/clang/*.el
# Not sure what to do with man pages for the compat builds
rm -Rf %{buildroot}%{install_prefix}/share/man/
# Add version suffix to binaries
mkdir -p %{buildroot}%{_bindir}
for f in %{buildroot}/%{install_bindir}/*; do
filename=`basename $f`
if echo $filename | grep -e '%{maj_ver}'; then
continue
fi
ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver}
done
# Add clang++-{version} symlink
ln -s ../../%{install_bindir}/clang++ %{buildroot}%{install_bindir}/clang++-%{maj_ver}
%endif
# Fix permissions of scan-view scripts
chmod a+x %{buildroot}%{_datadir}/scan-view/{Reporter.py,startfile.py}
# multilib fix
%multilib_fix_c_header --file %{_includedir}/clang/Config/config.h
# remove editor integrations (bbedit, sublime, emacs, vim)
rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py*
@ -165,29 +191,10 @@ rm -Rvf %{buildroot}%{_datadir}/clang-doc/index.js
# TODO: What are the Fedora guidelines for packaging bash autocomplete files?
rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh
# Create Manpage symlinks
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++.1.gz
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang-%{maj_ver}.1.gz
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++-%{maj_ver}.1.gz
# Add clang++-{version} symlink
ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver}
# Fix permission
chmod u-x %{buildroot}%{_mandir}/man1/scan-build.1*
%endif
# Create sub-directories in the clang resource directory that will be
# populated by other packages
mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/
%if %{without compat_build}
# Add a symlink in /usr/bin to clang-format-diff
ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff
%endif
# Install config file for clang
%if %{maj_ver} >=18
mkdir -p %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/

View file

@ -132,14 +132,14 @@ libomp-devel to enable -fopenmp.
%package -n %{pkg_name_clang}-libs
Summary: Runtime library for clang
Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}
Recommends: compiler-rt%{?_isa} = %{version}
Recommends: %{pkg_name_compiler_rt}%{?_isa} = %{version}
Requires: %{pkg_name_llvm}-libs = %{version}
# atomic support is not part of compiler-rt
Recommends: libatomic%{?_isa}
# libomp-devel is required, so clang can find the omp.h header when compiling
# with -fopenmp.
Recommends: libomp-devel%{_isa} = %{version}
Recommends: libomp%{_isa} = %{version}
Recommends: %{pkg_name_libomp}-devel%{_isa} = %{version}
Recommends: %{pkg_name_libomp}%{_isa} = %{version}
%description -n %{pkg_name_clang}-libs
Runtime library for clang.
@ -147,12 +147,10 @@ Runtime library for clang.
%package -n %{pkg_name_clang}-devel
Summary: Development header files for clang
Requires: %{pkg_name_clang}-libs = %{version}-%{release}
%if %{without compat_build}
Requires: %{pkg_name_clang}%{?_isa} = %{version}-%{release}
# The clang CMake files reference tools from clang-tools-extra.
Requires: %{pkg_name_clang}-tools-extra%{?_isa} = %{version}-%{release}
Provides: clang-devel(major) = %{maj_ver}
%endif
%description -n %{pkg_name_clang}-devel
Development header files for clang.
@ -164,7 +162,6 @@ Provides: clang-resource-filesystem(major) = %{maj_ver}
%description -n %{pkg_name_clang}-resource-filesystem
This package owns the clang resouce directory: $libdir/clang/$version/
%if %{without compat_build}
%package -n %{pkg_name_clang}-analyzer
Summary: A source code analysis framework
License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
@ -195,16 +192,16 @@ Development header files for clang tools.
# Put git-clang-format in its own package, because it Requires git
# and we don't want to force users to install all those dependenices if they
# just want clang.
%package -n git-clang-format
%package -n git-clang-format%{pkg_suffix}
Summary: Integration of clang-format for git
Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release}
Requires: git
Requires: python3
%description -n git-clang-format
%description -n git-clang-format%{pkg_suffix}
clang-format integration for git.
%if %{without compat_build}
%package -n python3-clang
Summary: Python3 bindings for clang
Requires: %{pkg_name_clang}-devel%{?_isa} = %{version}-%{release}