Add #region #endregion comments

Each `#region XY` now has an `#endregion XY` instead of just
`#endregion`. This is optional and `XY` does not have to be repeated for
the "system" to work but it makes working with regions a bit more
convenient.

```
  #region globals...

  #region packages...

  #region prep...

  #region build...

  #region install...

  #region check...

  #region misc...

  #region files...

  #region changelog...
```
This commit is contained in:
Konrad Kleine 2024-10-02 11:03:59 +00:00
parent 031f5fb3e8
commit 4251de274b

128
llvm.spec
View file

@ -1,13 +1,15 @@
%bcond_with snapshot_build #region globals
#region version
%global maj_ver 19 %global maj_ver 19
%global min_ver 1 %global min_ver 1
%global patch_ver 0 %global patch_ver 0
#global rc_ver 4 #global rc_ver 4
%bcond_with snapshot_build
%if %{with snapshot_build} %if %{with snapshot_build}
%include %{_sourcedir}/version.spec.inc %include %{_sourcedir}/version.spec.inc
%endif %endif
#endregion version
# Components enabled if supported by target architecture: # Components enabled if supported by target architecture:
%define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x %define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x
@ -120,13 +122,13 @@
# The executable Python scripts in /usr/share/opt-viewer/ import each other # The executable Python scripts in /usr/share/opt-viewer/ import each other
%undefine _py3_shebang_P %undefine _py3_shebang_P
#endregion #endregion LLVM globals
#region CLANG globals #region CLANG globals
%global pkg_name_clang clang%{pkg_suffix} %global pkg_name_clang clang%{pkg_suffix}
#endregion #endregion CLANG globals
#region COMPILER-RT globals #region COMPILER-RT globals
@ -142,9 +144,9 @@
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
# export ASMFLAGS=$CFLAGS # export ASMFLAGS=$CFLAGS
#endregion #endregion COMPILER-RT globals
#region OPENMP globals #region LLD globals
%global pkg_name_libomp libomp%{pkg_suffix} %global pkg_name_libomp libomp%{pkg_suffix}
@ -160,16 +162,19 @@
%global libomp_arch %{_arch} %global libomp_arch %{_arch}
%endif %endif
#endregion #endregion LLD globals
#region LLD globals #region LLD globals
%global pkg_name_lld lld%{pkg_suffix} %global pkg_name_lld lld%{pkg_suffix}
#endregion #endregion LLD globals
#region LLDB globals #region LLDB globals
%global pkg_name_lldb lldb %global pkg_name_lldb lldb
#endregion #endregion LLDB globals
#endregion globals
#region packages
#region main package
Name: %{pkg_name_llvm} Name: %{pkg_name_llvm}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 1%{?dist} Release: 1%{?dist}
@ -204,7 +209,7 @@ Source1000: version.spec.inc
#region CLANG patches #region CLANG patches
Patch2001: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch Patch2001: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2002: 0003-PATCH-clang-Don-t-install-static-libraries.patch Patch2002: 0003-PATCH-clang-Don-t-install-static-libraries.patch
#endregion #endregion CLANG patches
# Workaround a bug in ORC on ppc64le. # Workaround a bug in ORC on ppc64le.
# More info is available here: https://reviews.llvm.org/D159115#4641826 # More info is available here: https://reviews.llvm.org/D159115#4641826
@ -212,7 +217,7 @@ Patch2005: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
#region LLD patches #region LLD patches
Patch3002: 0001-Always-build-shared-libs-for-LLD.patch Patch3002: 0001-Always-build-shared-libs-for-LLD.patch
#endregion #endregion LLD patches
#region RHEL patches #region RHEL patches
# All RHEL # All RHEL
@ -224,7 +229,7 @@ Patch9001: 0001-19-Remove-myst_parser-dependency-for-RHEL.patch
# RHEL 8 only # RHEL 8 only
Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
#endregion #endregion RHEL patches
%if 0%{?rhel} == 8 %if 0%{?rhel} == 8
%global python3_pkgversion 3.12 %global python3_pkgversion 3.12
@ -327,6 +332,7 @@ LLVM is a compiler infrastructure designed for compile-time, link-time,
runtime, and idle-time optimization of programs from arbitrary programming runtime, and idle-time optimization of programs from arbitrary programming
languages. The compiler infrastructure includes mirror sets of programming languages. The compiler infrastructure includes mirror sets of programming
tools as well as libraries with equivalent functionality. tools as well as libraries with equivalent functionality.
#endregion main package
#region LLVM lit package #region LLVM lit package
%if %{with python_lit} %if %{with python_lit}
@ -346,7 +352,7 @@ Recommends: python%{python3_pkgversion}-psutil
%description -n python%{python3_pkgversion}-lit %description -n python%{python3_pkgversion}-lit
lit is a tool used by the LLVM project for executing its test suites. lit is a tool used by the LLVM project for executing its test suites.
%endif %endif
#endregion #endregion LLVM lit package
#region LLVM packages #region LLVM packages
@ -432,7 +438,7 @@ Summary: Statistics for the RPM build
Statistics for the RPM build. Only available in snapshot builds. Statistics for the RPM build. Only available in snapshot builds.
%endif %endif
#endregion #endregion LLVM packages
#region CLANG packages #region CLANG packages
@ -552,7 +558,7 @@ Obsoletes: python3-clang < 18.9
%endif %endif
#endregion #endregion CLANG packages
#region COMPILER-RT packages #region COMPILER-RT packages
@ -570,7 +576,7 @@ implementation of the low-level target-specific hooks required by
code generation, sanitizer runtimes and profiling library for code code generation, sanitizer runtimes and profiling library for code
instrumentation, and Blocks C language extension. instrumentation, and Blocks C language extension.
#endregion #endregion COMPILER-RT packages
#region OPENMP packages #region OPENMP packages
@ -596,7 +602,7 @@ Requires: clang-resource-filesystem%{?isa} = %{version}
OpenMP header files. OpenMP header files.
URL: http://openmp.llvm.org URL: http://openmp.llvm.org
#endregion #endregion OPENMP packages
#region LLD packages #region LLD packages
@ -631,7 +637,7 @@ Summary: LLD shared libraries
%description -n %{pkg_name_lld}-libs %description -n %{pkg_name_lld}-libs
Shared libraries for LLD. Shared libraries for LLD.
#endregion #endregion LLD packages
#region Toolset package #region Toolset package
%if 0%{?rhel} %if 0%{?rhel}
@ -644,7 +650,7 @@ Requires: lld = %{version}
%description -n %{pkg_name_llvm}-toolset %description -n %{pkg_name_llvm}-toolset
This is the main package for llvm-toolset. This is the main package for llvm-toolset.
%endif %endif
#endregion #endregion Toolset package
#region LLDB packages #region LLDB packages
%if %{with lldb} %if %{with lldb}
@ -682,8 +688,10 @@ Obsoletes: python3-lldb < 18.9
%description -n python%{python3_pkgversion}-lldb %description -n python%{python3_pkgversion}-lldb
The package contains the LLDB Python module. The package contains the LLDB Python module.
%endif %endif
#endregion #endregion LLDB packages
#endregion packages
#region prep
%prep %prep
%if %{without snapshot_build} %if %{without snapshot_build}
# llvm # llvm
@ -721,7 +729,7 @@ The package contains the LLDB Python module.
llvm/tools/opt-viewer/*.py \ llvm/tools/opt-viewer/*.py \
llvm/utils/update_cc_test_checks.py llvm/utils/update_cc_test_checks.py
#endregion #endregion LLVM preparation
#region CLANG preparation #region CLANG preparation
@ -739,19 +747,21 @@ The package contains the LLDB Python module.
clang/tools/scan-build-py/bin/* \ clang/tools/scan-build-py/bin/* \
clang/tools/scan-build-py/libexec/* clang/tools/scan-build-py/libexec/*
#endregion #endregion CLANG preparation
#region COMPILER-RT preparation #region COMPILER-RT preparation
%py3_shebang_fix compiler-rt/lib/hwasan/scripts/hwasan_symbolize %py3_shebang_fix compiler-rt/lib/hwasan/scripts/hwasan_symbolize
#endregion #endregion COMPILER-RT preparation
#region LLDB preparation #region LLDB preparation
# Empty lldb/docs/CMakeLists.txt because we cannot build it # Empty lldb/docs/CMakeLists.txt because we cannot build it
echo "" > lldb/docs/CMakeLists.txt echo "" > lldb/docs/CMakeLists.txt
#endregion #endregion LLDB preparation
#endregion prep
#region build
%build %build
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le # TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking. # Decrease debuginfo verbosity to reduce memory consumption during final library linking.
@ -778,15 +788,12 @@ export ASMFLAGS="%{build_cflags}"
# We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the # We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the
# defaults used by Fedora's GCC. # defaults used by Fedora's GCC.
#region BEGIN: COPIED FROM CLANG
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things. # Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
# This is copied from clang.
%ifarch aarch64 %ifarch aarch64
%define _find_debuginfo_dwz_opts %{nil} %define _find_debuginfo_dwz_opts %{nil}
%endif %endif
#endregion
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/%{build_libdir}" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/%{build_libdir}"
cd llvm cd llvm
@ -797,7 +804,7 @@ pushd utils/lit
%py3_build %py3_build
popd popd
%endif %endif
#endregion #endregion LLVM lit
%if 0%{?rhel} == 8 %if 0%{?rhel} == 8
%undefine __cmake_in_source_build %undefine __cmake_in_source_build
@ -984,6 +991,7 @@ popd
%cmake_build --target runtimes %cmake_build --target runtimes
#region compat lib
cd .. cd ..
%if %{with bundle_compat_lib} %if %{with bundle_compat_lib}
@ -1005,7 +1013,10 @@ cd ..
%ninja_build -C ../llvm-compat-libs libclang-cpp.so %ninja_build -C ../llvm-compat-libs libclang-cpp.so
%endif %endif
#endregion compat lib
#endregion build
#region install
%install %install
#region LLVM installation #region LLVM installation
@ -1072,7 +1083,7 @@ done
mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake
cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake
#endregion #endregion LLVM installation
#region CLANG installation #region CLANG installation
@ -1173,7 +1184,7 @@ echo "--gcc-triple=%{_target_cpu}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{
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
%endif %endif
#endregion #endregion CLANG installation
#region COMPILER-RT installation #region COMPILER-RT installation
@ -1196,7 +1207,7 @@ ln -s %{compiler_rt_triple} %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{ll
%endif %endif
%endif %endif
#endregion #endregion COMPILER-RT installation
#region OPENMP installation #region OPENMP installation
@ -1219,7 +1230,7 @@ rm %{buildroot}%{install_bindir}/llvm-omp-device-info
rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
%endif %endif
#endregion #endregion OPENMP installation
#region LLD installation #region LLD installation
@ -1234,7 +1245,7 @@ touch %{buildroot}%{_bindir}/ld
install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1 install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1
%endif %endif
#endregion #endregion LLD installation
#region LLDB installation #region LLDB installation
%if %{with lldb} %if %{with lldb}
@ -1245,7 +1256,7 @@ liblldb=$(basename $(readlink -e %{buildroot}%{_libdir}/liblldb.so))
ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb
%endif %endif
#endregion #endregion LLDB installation
%if %{with compat_build} %if %{with compat_build}
# Add version suffix to binaries. Do this at the end so it includes any # Add version suffix to binaries. Do this at the end so it includes any
@ -1290,7 +1301,9 @@ install -m 0755 ../llvm-compat-libs/lib/libLLVM.so.%{compat_maj_ver}* %{buildroo
install -m 0755 ../llvm-compat-libs/lib/libclang.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} install -m 0755 ../llvm-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
%endif %endif
#endregion install
#region check
%check %check
# TODO(kkleine): Instead of deleting test files we should mark them as expected # TODO(kkleine): Instead of deleting test files we should mark them as expected
# to fail. See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail # to fail. See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail
@ -1361,26 +1374,26 @@ function test_list_to_regex()
# Add enclosing parenthesis # Add enclosing parenthesis
echo "($arr)" echo "($arr)"
} }
#endregion #endregion Helper functions
#region Test LLVM lit #region Test LLVM lit
# It's fine to always run this, even if we're not shipping python-lit. # It's fine to always run this, even if we're not shipping python-lit.
reset_test_opts reset_test_opts
%cmake_build --target check-lit %cmake_build --target check-lit
#endregion #endregion Test LLVM lit
#region Test LLVM #region Test LLVM
reset_test_opts reset_test_opts
# Xfail testing of update utility tools # Xfail testing of update utility tools
export LIT_XFAIL="tools/UpdateTestChecks" export LIT_XFAIL="tools/UpdateTestChecks"
%cmake_build --target check-llvm %cmake_build --target check-llvm
#endregion #endregion Test LLVM
#region Test CLANG #region Test CLANG
reset_test_opts reset_test_opts
export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c" export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c"
%cmake_build --target check-clang %cmake_build --target check-clang
#endregion #endregion Test Clang
#region Test Clang Tools #region Test Clang Tools
reset_test_opts reset_test_opts
@ -1389,7 +1402,7 @@ reset_test_opts
export LIT_XFAIL="$LIT_XFAIL;clang-tidy/checkers/altera/struct-pack-align.cpp" export LIT_XFAIL="$LIT_XFAIL;clang-tidy/checkers/altera/struct-pack-align.cpp"
%endif %endif
%cmake_build --target check-clang-tools %cmake_build --target check-clang-tools
#endregion #endregion Test Clang Tools
#region Test OPENMP #region Test OPENMP
reset_test_opts reset_test_opts
@ -1543,7 +1556,7 @@ export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_2.c"
export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
%cmake_build --target check-openmp %cmake_build --target check-openmp
#endregion #endregion Test OPENMP
%if %{with lldb} %if %{with lldb}
# Don't run LLDB tests on s390x because more than 150 tests are failing there # Don't run LLDB tests on s390x because more than 150 tests are failing there
@ -1552,17 +1565,17 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
## #region LLDB unit tests ## #region LLDB unit tests
## reset_test_opts ## reset_test_opts
## %%cmake_build --target check-lldb-unit ## %%cmake_build --target check-lldb-unit
## #endregion ## #endregion LLDB unit tests
## ##
## #region LLDB SB API tests ## #region LLDB SB API tests
## reset_test_opts ## reset_test_opts
## %%cmake_build --target check-lldb-api ## %%cmake_build --target check-lldb-api
## #endregion ## #endregion LLDB SB API tests
## ##
## #region LLDB shell tests ## #region LLDB shell tests
## reset_test_opts ## reset_test_opts
## %%cmake_build --target check-lldb-shell ## %%cmake_build --target check-lldb-shell
## #endregion ## #endregion LLDB shell tests
%endif %endif
%endif %endif
@ -1570,7 +1583,7 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
#region Test LLD #region Test LLD
reset_test_opts reset_test_opts
%cmake_build --target check-lld %cmake_build --target check-lld
#endregion #endregion Test LLD
%endif %endif
@ -1579,6 +1592,9 @@ reset_test_opts
cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir}
%endif %endif
#endregion check
#region misc
%ldconfig_scriptlets -n %{pkg_name-llvm}-libs %ldconfig_scriptlets -n %{pkg_name-llvm}-libs
%if %{without compat_build} %if %{without compat_build}
@ -1626,7 +1642,9 @@ if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld %{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld
fi fi
%endif %endif
#endregion misc
#region files
#region LLVM lit files #region LLVM lit files
%if %{with python_lit} %if %{with python_lit}
%files -n python%{python3_pkgversion}-lit %files -n python%{python3_pkgversion}-lit
@ -1636,7 +1654,7 @@ fi
%{python3_sitelib}/lit-*-info/ %{python3_sitelib}/lit-*-info/
%{_bindir}/lit %{_bindir}/lit
%endif %endif
#endregion #endregion LLVM lit files
#region LLVM files #region LLVM files
@ -1978,7 +1996,7 @@ fi
%{pkg_datadir}/.ninja_log %{pkg_datadir}/.ninja_log
%endif %endif
#endregion #endregion LLVM files
#region CLANG files #region CLANG files
@ -2175,7 +2193,7 @@ fi
%{python3_sitelib}/clang/ %{python3_sitelib}/clang/
%endif %endif
#endregion #endregion CLANG files
#region COMPILER-RT files #region COMPILER-RT files
@ -2209,7 +2227,7 @@ fi
%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple} %{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}
%endif %endif
#endregion #endregion COMPILER-RT files
#region OPENMP files #region OPENMP files
@ -2241,7 +2259,7 @@ fi
%{install_libdir}/libomptarget.so %{install_libdir}/libomptarget.so
%endif %endif
#endregion #endregion OPENMP files
#region LLD files #region LLD files
@ -2283,14 +2301,14 @@ fi
%{install_libdir}/liblldMinGW.so.* %{install_libdir}/liblldMinGW.so.*
%{install_libdir}/liblldWasm.so.* %{install_libdir}/liblldWasm.so.*
#endregion #endregion LLD files
#region Toolset files #region Toolset files
%if 0%{?rhel} %if 0%{?rhel}
%files -n %{pkg_name_llvm}-toolset %files -n %{pkg_name_llvm}-toolset
%license LICENSE.TXT %license LICENSE.TXT
%endif %endif
#endregion #endregion Toolset files
#region LLDB files #region LLDB files
%if %{with lldb} %if %{with lldb}
@ -2309,8 +2327,10 @@ fi
%files -n python%{python3_pkgversion}-lldb %files -n python%{python3_pkgversion}-lldb
%{python3_sitearch}/lldb %{python3_sitearch}/lldb
%endif %endif
#endregion #endregion LLDB files
#endregion files
#region changelog
%changelog %changelog
* Thu Sep 19 2024 Timm Bäder <tbaeder@redhat.com> - 19.1.0-1 * Thu Sep 19 2024 Timm Bäder <tbaeder@redhat.com> - 19.1.0-1
- Update to LLVM 19.1.0 - Update to LLVM 19.1.0
@ -3157,3 +3177,5 @@ fi
* Tue Oct 06 2015 Jan Vcelak <jvcelak@fedoraproject.org> 3.7.0-100 * Tue Oct 06 2015 Jan Vcelak <jvcelak@fedoraproject.org> 3.7.0-100
- initial version using cmake build system - initial version using cmake build system
#endregion changelog