llvm/install.spec.inc

273 lines
9 KiB
PHP
Raw Normal View History

merge llvm, clang, compiler-rt and libomp repos * %check: export LD_LIBRARY_PATH because runtimes use external cmake projects that wouldn't find libclang++.so * %check: use LLVM's LIT_XFAIL to mark tests that are expected to fail and don't just delete them * clang: bring over *.patch files * clang: remove build requires tags from clang package that are already defined by main llvm package * clang: remove duplicates found in llvm globals and use %{pkg_datadir} instead of %{install_datadir} * clang: rename and use pkg_name -> pkg_name_clang * clang: use %{pkg_name_clang} instead of %{name} * compiler-rt and libomp: wrap in %if %{without compat_build} * libomp: also build libomp for s390x (See https://github.com/llvm/llvm-project/pull/66081) * libomp: exclude libomp-devel on s390x just like libomp itself * libomp: introduce pkg_name_libomp and cleanup the globals * libomp: remove gdb-plugin (NEED TO CONFIRM IF THIS IS REALLY TRUE) * libomp: filter out flaky libomp test: ompt/teams/distribute_dispatch.c * llvm: add BuildRequires: graphviz to llvm-doc * llvm: use %{pkg_name_llvm} instead of %{name} * make: added temporary Makefile so I can more easily run srpm or rpm builds locally * make: Added local-tmt-vm target (not really useful yet) * rpm: for non-RHEL add prefix like "Jan 05 16:17:06" to every log line This should help in finding out how long things take to build/install/... * rpm: fully specify %files for top-level packages * rpm: make all packages fully qualified * rpm: obsolete llvm-snapshot-builder * rpm: remove BuildRequires: python3-lit because we have it in-tree * rpm: remove BuildRequires: tags for clang and llvm specifics as we're building in-tree * rpm: rename %llvm_srcdir -> %srcdir_llvm * rpm: rename %pkg_name -> %pkg_name_llvm * rpm: use full qualified name in %description * rpm: use region comments in spec file to group by package. This allows editors to fold text to get a better overview * rpmlint: update rc file to reflect clang and compiler-rt (libomp has no rpmlint rc file) * use python-lit from within tree
2023-10-12 09:15:14 +00:00
#region LLVM installation
cd llvm
%cmake_install
cd -
mkdir -p %{buildroot}/%{_bindir}
%if %{without compat_build}
# Fix some man pages
ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config%{exec_suffix}-%{__isa_bits}.1
# Install binaries needed for lit tests
%global test_binaries llvm-isel-fuzzer llvm-opt-fuzzer
for f in %{test_binaries}
do
install -m 0755 llvm/%{_vpath_builddir}/bin/$f %{buildroot}%{_bindir}
done
%multilib_fix_c_header --file %{install_includedir}/llvm/Config/llvm-config.h
# Install libraries needed for unittests
%global build_libdir llvm/%{_vpath_builddir}/%{_lib}
install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir}
install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{_libdir}
%if %{with gold}
# Add symlink to lto plugin in the binutils plugin directory.
%{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/
ln -s -t %{buildroot}%{_libdir}/bfd-plugins/ ../LLVMgold.so
%endif
%else
# Add version suffix to binaries
for f in %{buildroot}/%{install_bindir}/*; do
filename=`basename $f`
ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix}
done
# Move header files
mkdir -p %{buildroot}/%{pkg_includedir}
ln -s ../../../%{install_includedir}/llvm %{buildroot}/%{pkg_includedir}/llvm
ln -s ../../../%{install_includedir}/llvm-c %{buildroot}/%{pkg_includedir}/llvm-c
# Fix multi-lib
%multilib_fix_c_header --file %{install_includedir}/llvm/Config/llvm-config.h
# Create ld.so.conf.d entry
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf << EOF
%{install_libdir}
EOF
# Add version suffix to man pages and move them to mandir.
mkdir -p %{buildroot}/%{_mandir}/man1
for f in %{build_install_prefix}/share/man/man1/*; do
filename=`basename $f | cut -f 1 -d '.'`
mv $f %{buildroot}%{_mandir}/man1/$filename%{exec_suffix}.1
done
# Remove opt-viewer, since this is just a compatibility package.
rm -Rf %{build_install_prefix}/share/opt-viewer
%endif
# llvm-config special casing. llvm-config is managed by update-alternatives.
# the original file must remain available for compatibility with the CMake
# infrastructure. Without compat, cmake points to the symlink, with compat it
# points to the original file.
%if %{without compat_build}
mv %{buildroot}/%{install_bindir}/llvm-config %{buildroot}/%{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
# We still maintain a versionned symlink for consistency across llvm versions.
# This is specific to the non-compat build and matches the exec prefix for
# compat builds. An isa-agnostic versionned symlink is also maintained in the (un)install
# steps.
(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config%{exec_suffix}-%{__isa_bits} llvm-config-%{maj_ver}-%{__isa_bits} )
# ghost presence
touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver}
%else
rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config llvm-config%{exec_suffix}-%{__isa_bits} )
%endif
# ghost presence
touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake
cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake
cd ..
#endregion
#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!
merge llvm, clang, compiler-rt and libomp repos * %check: export LD_LIBRARY_PATH because runtimes use external cmake projects that wouldn't find libclang++.so * %check: use LLVM's LIT_XFAIL to mark tests that are expected to fail and don't just delete them * clang: bring over *.patch files * clang: remove build requires tags from clang package that are already defined by main llvm package * clang: remove duplicates found in llvm globals and use %{pkg_datadir} instead of %{install_datadir} * clang: rename and use pkg_name -> pkg_name_clang * clang: use %{pkg_name_clang} instead of %{name} * compiler-rt and libomp: wrap in %if %{without compat_build} * libomp: also build libomp for s390x (See https://github.com/llvm/llvm-project/pull/66081) * libomp: exclude libomp-devel on s390x just like libomp itself * libomp: introduce pkg_name_libomp and cleanup the globals * libomp: remove gdb-plugin (NEED TO CONFIRM IF THIS IS REALLY TRUE) * libomp: filter out flaky libomp test: ompt/teams/distribute_dispatch.c * llvm: add BuildRequires: graphviz to llvm-doc * llvm: use %{pkg_name_llvm} instead of %{name} * make: added temporary Makefile so I can more easily run srpm or rpm builds locally * make: Added local-tmt-vm target (not really useful yet) * rpm: for non-RHEL add prefix like "Jan 05 16:17:06" to every log line This should help in finding out how long things take to build/install/... * rpm: fully specify %files for top-level packages * rpm: make all packages fully qualified * rpm: obsolete llvm-snapshot-builder * rpm: remove BuildRequires: python3-lit because we have it in-tree * rpm: remove BuildRequires: tags for clang and llvm specifics as we're building in-tree * rpm: rename %llvm_srcdir -> %srcdir_llvm * rpm: rename %pkg_name -> %pkg_name_llvm * rpm: use full qualified name in %description * rpm: use region comments in spec file to group by package. This allows editors to fold text to get a better overview * rpmlint: update rc file to reflect clang and compiler-rt (libomp has no rpmlint rc file) * use python-lit from within tree
2023-10-12 09:15:14 +00:00
# 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
# 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.
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}|" \
-e "s|@@CLANG_PATCH_VERSION@@|%{patch_ver}|" \
%{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang}
# install clang python bindings
mkdir -p %{buildroot}%{python3_sitelib}/clang/
# If we don't default to true here, we'll see this error:
# install: omitting directory 'bindings/python/clang/__pycache__'
# NOTE: this only happens if we include the gdb plugin of libomp.
# Remove the plugin with command and we're good: rm -rf %{buildroot}/%{_datarootdir}/gdb
install -p -m644 clang/bindings/python/clang/* %{buildroot}%{python3_sitelib}/clang/ || true
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang
# install scanbuild-py to python sitelib.
mv %{buildroot}%{_prefix}/%{_lib}/{libear,libscanbuild} %{buildroot}%{python3_sitelib}
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/{libear,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
# 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*
# TODO: Package html docs
rm -Rvf %{buildroot}%{_docdir}/LLVM/clang/html
rm -Rvf %{buildroot}%{_docdir}/LLVM/clang-tools/html
rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css
rm -Rvf %{buildroot}%{_datadir}/clang/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}%{install_libdir}/clang/%{maj_ver}/{include,lib,share}/
2024-04-02 00:31:38 +00:00
%if 0%{?fedora} == 38
# Install config file
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
mv %{SOURCE2006} %{buildroot}%{_sysconfdir}/%{name}/%{_target_platform}.cfg
%endif
merge llvm, clang, compiler-rt and libomp repos * %check: export LD_LIBRARY_PATH because runtimes use external cmake projects that wouldn't find libclang++.so * %check: use LLVM's LIT_XFAIL to mark tests that are expected to fail and don't just delete them * clang: bring over *.patch files * clang: remove build requires tags from clang package that are already defined by main llvm package * clang: remove duplicates found in llvm globals and use %{pkg_datadir} instead of %{install_datadir} * clang: rename and use pkg_name -> pkg_name_clang * clang: use %{pkg_name_clang} instead of %{name} * compiler-rt and libomp: wrap in %if %{without compat_build} * libomp: also build libomp for s390x (See https://github.com/llvm/llvm-project/pull/66081) * libomp: exclude libomp-devel on s390x just like libomp itself * libomp: introduce pkg_name_libomp and cleanup the globals * libomp: remove gdb-plugin (NEED TO CONFIRM IF THIS IS REALLY TRUE) * libomp: filter out flaky libomp test: ompt/teams/distribute_dispatch.c * llvm: add BuildRequires: graphviz to llvm-doc * llvm: use %{pkg_name_llvm} instead of %{name} * make: added temporary Makefile so I can more easily run srpm or rpm builds locally * make: Added local-tmt-vm target (not really useful yet) * rpm: for non-RHEL add prefix like "Jan 05 16:17:06" to every log line This should help in finding out how long things take to build/install/... * rpm: fully specify %files for top-level packages * rpm: make all packages fully qualified * rpm: obsolete llvm-snapshot-builder * rpm: remove BuildRequires: python3-lit because we have it in-tree * rpm: remove BuildRequires: tags for clang and llvm specifics as we're building in-tree * rpm: rename %llvm_srcdir -> %srcdir_llvm * rpm: rename %pkg_name -> %pkg_name_llvm * rpm: use full qualified name in %description * rpm: use region comments in spec file to group by package. This allows editors to fold text to get a better overview * rpmlint: update rc file to reflect clang and compiler-rt (libomp has no rpmlint rc file) * use python-lit from within tree
2023-10-12 09:15:14 +00:00
%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}/
echo "--gcc-triple=%{_target_cpu}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg
echo "--gcc-triple=%{_target_cpu}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg
merge llvm, clang, compiler-rt and libomp repos * %check: export LD_LIBRARY_PATH because runtimes use external cmake projects that wouldn't find libclang++.so * %check: use LLVM's LIT_XFAIL to mark tests that are expected to fail and don't just delete them * clang: bring over *.patch files * clang: remove build requires tags from clang package that are already defined by main llvm package * clang: remove duplicates found in llvm globals and use %{pkg_datadir} instead of %{install_datadir} * clang: rename and use pkg_name -> pkg_name_clang * clang: use %{pkg_name_clang} instead of %{name} * compiler-rt and libomp: wrap in %if %{without compat_build} * libomp: also build libomp for s390x (See https://github.com/llvm/llvm-project/pull/66081) * libomp: exclude libomp-devel on s390x just like libomp itself * libomp: introduce pkg_name_libomp and cleanup the globals * libomp: remove gdb-plugin (NEED TO CONFIRM IF THIS IS REALLY TRUE) * libomp: filter out flaky libomp test: ompt/teams/distribute_dispatch.c * llvm: add BuildRequires: graphviz to llvm-doc * llvm: use %{pkg_name_llvm} instead of %{name} * make: added temporary Makefile so I can more easily run srpm or rpm builds locally * make: Added local-tmt-vm target (not really useful yet) * rpm: for non-RHEL add prefix like "Jan 05 16:17:06" to every log line This should help in finding out how long things take to build/install/... * rpm: fully specify %files for top-level packages * rpm: make all packages fully qualified * rpm: obsolete llvm-snapshot-builder * rpm: remove BuildRequires: python3-lit because we have it in-tree * rpm: remove BuildRequires: tags for clang and llvm specifics as we're building in-tree * rpm: rename %llvm_srcdir -> %srcdir_llvm * rpm: rename %pkg_name -> %pkg_name_llvm * rpm: use full qualified name in %description * rpm: use region comments in spec file to group by package. This allows editors to fold text to get a better overview * rpmlint: update rc file to reflect clang and compiler-rt (libomp has no rpmlint rc file) * use python-lit from within tree
2023-10-12 09:15:14 +00:00
%endif
#endregion
#region COMPILER-RT installation
%if %{without compat_build}
%ifarch ppc64le
# Fix install path on ppc64le so that the directory name matches the triple used
# by clang.
mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/ppc64le-redhat-linux-gnu
%endif
%endif
#endregion
#region OPENMP installation
%if %{without compat_build}
# Remove static libraries with equivalent shared libraries
rm -rf %{buildroot}%{_libdir}/libarcher_static.a
# Remove the openmp gdb plugin for now
rm -rf %{buildroot}/%{_datarootdir}/gdb
# # TODO(kkleine): These was added to avoid a permission issue
# chmod go+w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
# chmod +w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
# Remove files that we don't package, yet.
rm %{buildroot}%{install_bindir}/llvm-omp-device-info
rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
merge llvm, clang, compiler-rt and libomp repos * %check: export LD_LIBRARY_PATH because runtimes use external cmake projects that wouldn't find libclang++.so * %check: use LLVM's LIT_XFAIL to mark tests that are expected to fail and don't just delete them * clang: bring over *.patch files * clang: remove build requires tags from clang package that are already defined by main llvm package * clang: remove duplicates found in llvm globals and use %{pkg_datadir} instead of %{install_datadir} * clang: rename and use pkg_name -> pkg_name_clang * clang: use %{pkg_name_clang} instead of %{name} * compiler-rt and libomp: wrap in %if %{without compat_build} * libomp: also build libomp for s390x (See https://github.com/llvm/llvm-project/pull/66081) * libomp: exclude libomp-devel on s390x just like libomp itself * libomp: introduce pkg_name_libomp and cleanup the globals * libomp: remove gdb-plugin (NEED TO CONFIRM IF THIS IS REALLY TRUE) * libomp: filter out flaky libomp test: ompt/teams/distribute_dispatch.c * llvm: add BuildRequires: graphviz to llvm-doc * llvm: use %{pkg_name_llvm} instead of %{name} * make: added temporary Makefile so I can more easily run srpm or rpm builds locally * make: Added local-tmt-vm target (not really useful yet) * rpm: for non-RHEL add prefix like "Jan 05 16:17:06" to every log line This should help in finding out how long things take to build/install/... * rpm: fully specify %files for top-level packages * rpm: make all packages fully qualified * rpm: obsolete llvm-snapshot-builder * rpm: remove BuildRequires: python3-lit because we have it in-tree * rpm: remove BuildRequires: tags for clang and llvm specifics as we're building in-tree * rpm: rename %llvm_srcdir -> %srcdir_llvm * rpm: rename %pkg_name -> %pkg_name_llvm * rpm: use full qualified name in %description * rpm: use region comments in spec file to group by package. This allows editors to fold text to get a better overview * rpmlint: update rc file to reflect clang and compiler-rt (libomp has no rpmlint rc file) * use python-lit from within tree
2023-10-12 09:15:14 +00:00
%endif
#endregion
2024-05-03 11:12:47 +00:00
#region LLD installation
2024-05-07 14:46:16 +00:00
# Remove LLD's HTML documentation files
rm -Rvf %{buildroot}%{_docdir}/LLVM/lld/html
2024-05-03 11:12:47 +00:00
# This is generated by Patch1 during build and (probably) must be removed afterward
rm %{buildroot}%{install_includedir}/mach-o/compact_unwind_encoding.h
%if %{with compat_build}
# Add version suffix to binaries
mkdir -p %{buildroot}%{_bindir}
for f in %{buildroot}/%{install_bindir}/*; do
filename=`basename $f`
ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver}
done
%else
# Required when using update-alternatives:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/
touch %{buildroot}%{_bindir}/ld
2024-05-06 14:41:14 +00:00
install -D -m 644 -t %{buildroot}%{_mandir}/man1/ %{src_tarball_dir}/lld/docs/ld.lld.1
2024-05-03 11:12:47 +00:00
%post -n %{pkg_name_lld}
%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1
%postun -n %{pkg_name_lld}
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld
fi
%endif
#endregion