| |
@@ -1,10 +1,32 @@
|
| |
- %global compat_build 0
|
| |
+ %bcond_with compat_build
|
| |
+ %bcond_without tests
|
| |
+ %bcond_with minimal_build
|
| |
+
|
| |
+ # A "full build" which is a normal build with all the sub-packages and
|
| |
+ # everything enabled.
|
| |
+ %global with_full_build 1
|
| |
+ %global with_sub_pkgs 1
|
| |
+
|
| |
+ %if %{with compat_build}
|
| |
+ %undefine with_full_build
|
| |
+ %undefine with_tests
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with minimal_build}
|
| |
+ %undefine with_full_build
|
| |
+ %undefine with_tests
|
| |
+ %undefine with_sub_pkgs
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{without full_build} && %{without compat_build} && %{without minimal_build}
|
| |
+ %{error:Must enable either full_build, compat_build, or minimal_build}
|
| |
+ %endif
|
| |
|
| |
%global maj_ver 11
|
| |
%global min_ver 0
|
| |
%global patch_ver 1
|
| |
%global rc_ver 1
|
| |
- %global baserelease 1
|
| |
+ %global baserelease 3
|
| |
|
| |
%global clang_tools_binaries \
|
| |
%{_bindir}/clang-apply-replacements \
|
| |
@@ -36,7 +58,7 @@
|
| |
%{_bindir}/clang-cl \
|
| |
%{_bindir}/clang-cpp \
|
| |
|
| |
- %if 0%{?compat_build}
|
| |
+ %if %{with compat_build}
|
| |
%global pkg_name clang%{maj_ver}.%{min_ver}
|
| |
# Install clang to same prefix as llvm, so that apps that use llvm-config
|
| |
# will also be able to find clang libs.
|
| |
@@ -45,13 +67,29 @@
|
| |
%global install_includedir %{install_prefix}/include
|
| |
%global install_libdir %{install_prefix}/lib
|
| |
|
| |
- %global pkg_bindir %{install_bindir}
|
| |
%global pkg_includedir %{_includedir}/llvm%{maj_ver}.%{min_ver}
|
| |
%global pkg_libdir %{install_libdir}
|
| |
- %else
|
| |
+
|
| |
+ %global llvm_pkg llvm%{maj_ver}.%{min_ver}
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with full_build}
|
| |
%global pkg_name clang
|
| |
- %global install_prefix /usr
|
| |
+ %global install_prefix %{_prefix}
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with minimal_build}
|
| |
+ %global pkg_name clang-minimal
|
| |
+ %global install_prefix %{buildroot}%{_prefix}
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with full_build} || %{with minimal_build}
|
| |
%global pkg_libdir %{_libdir}
|
| |
+ %global pkg_includedir %{_includedir}
|
| |
+ %global llvm_pkg llvm
|
| |
+ %if 0%{?__isa_bits} == 64
|
| |
+ %global llvm_libdir_suffix 64
|
| |
+ %endif
|
| |
%endif
|
| |
|
| |
%if 0%{?fedora} || 0%{?rhel} > 7
|
| |
@@ -60,8 +98,6 @@
|
| |
%bcond_with python3
|
| |
%endif
|
| |
|
| |
- %global build_install_prefix %{buildroot}%{install_prefix}
|
| |
-
|
| |
%ifarch ppc64le
|
| |
# Too many threads on ppc64 systems causes OOM errors.
|
| |
%global _smp_mflags -j8
|
| |
@@ -79,7 +115,7 @@
|
| |
URL: http://llvm.org
|
| |
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz
|
| |
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with full_build}
|
| |
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz
|
| |
Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig
|
| |
%endif
|
| |
@@ -94,46 +130,53 @@
|
| |
Patch16: 0001-clang-Fix-spurious-test-failure.patch
|
| |
Patch17: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
|
| |
|
| |
+ # MINIMAL PATCH ONLY
|
| |
+ Patch18: 0001-driver-Disable-linking-with-shared-libraries.patch
|
| |
+
|
| |
+ #---Packaging Dependencies-----------------------------------------------------#
|
| |
+
|
| |
+ # We need python3-devel for pathfix.py.
|
| |
+ BuildRequires: python3-devel
|
| |
+ # Needed for %%multilib_fix_c_header
|
| |
+ BuildRequires: multilib-rpm-config
|
| |
+ # For origin certification
|
| |
+ BuildRequires: gnupg2
|
| |
+
|
| |
+ #---Build Dependencies---------------------------------------------------------#
|
| |
+
|
| |
BuildRequires: gcc
|
| |
BuildRequires: gcc-c++
|
| |
BuildRequires: cmake
|
| |
BuildRequires: ninja-build
|
| |
- %if 0%{?compat_build}
|
| |
- BuildRequires: llvm%{maj_ver}.%{min_ver}-devel = %{version}
|
| |
- BuildRequires: llvm%{maj_ver}.%{min_ver}-static = %{version}
|
| |
- %else
|
| |
- BuildRequires: llvm-devel = %{version}
|
| |
- BuildRequires: llvm-test = %{version}
|
| |
+
|
| |
+ #---Library Dependencies-------------------------------------------------------#
|
| |
+
|
| |
+ BuildRequires: libxml2-devel
|
| |
+ BuildRequires: ncurses-devel
|
| |
# llvm-static is required, because clang-tablegen needs libLLVMTableGen, which
|
| |
# is not included in libLLVM.so.
|
| |
- BuildRequires: llvm-static = %{version}
|
| |
- BuildRequires: llvm-googletest = %{version}
|
| |
- %endif
|
| |
+ BuildRequires: %{llvm_pkg}-static = %{version}
|
| |
+ BuildRequires: %{llvm_pkg}-devel = %{version}
|
| |
+
|
| |
+ #---Misc Dependencies---------------------------------------------------------#
|
| |
|
| |
- BuildRequires: libxml2-devel
|
| |
BuildRequires: perl-generators
|
| |
- BuildRequires: ncurses-devel
|
| |
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
|
| |
# should BuildRequires: emacs if it packages emacs integration files.
|
| |
BuildRequires: emacs
|
| |
-
|
| |
- # These build dependencies are required for the test suite.
|
| |
- %if %with python3
|
| |
- # The testsuite uses /usr/bin/lit which is part of the python3-lit package.
|
| |
- BuildRequires: python3-lit
|
| |
- %endif
|
| |
-
|
| |
BuildRequires: python3-sphinx
|
| |
BuildRequires: libatomic
|
| |
|
| |
- # We need python3-devel for pathfix.py.
|
| |
- BuildRequires: python3-devel
|
| |
+ #---Test Dependencies----------------------------------------------------------#
|
| |
|
| |
- # Needed for %%multilib_fix_c_header
|
| |
- BuildRequires: multilib-rpm-config
|
| |
+ %if %{with tests}
|
| |
+ BuildRequires: llvm-googletest = %{version}
|
| |
+ BuildRequires: llvm-test = %{version}
|
| |
|
| |
- # For origin certification
|
| |
- BuildRequires: gnupg2
|
| |
+ %if %with python3
|
| |
+ # The testsuite uses /usr/bin/lit which is part of the python3-lit package.
|
| |
+ BuildRequires: python3-lit
|
| |
+ %endif
|
| |
|
| |
# scan-build uses these perl modules so they need to be installed in order
|
| |
# to run the tests.
|
| |
@@ -149,14 +192,21 @@
|
| |
BuildRequires: perl(Text::ParseWords)
|
| |
BuildRequires: perl(Sys::Hostname)
|
| |
|
| |
- Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
| |
+ %endif
|
| |
+
|
| |
+ #---Runtime Dependencies-------------------------------------------------------#
|
| |
|
| |
+ %if %{without minimal_build}
|
| |
+ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
| |
+ %endif
|
| |
# clang requires gcc, clang++ requires libstdc++-devel
|
| |
# - https://bugzilla.redhat.com/show_bug.cgi?id=1021645
|
| |
# - https://bugzilla.redhat.com/show_bug.cgi?id=1158594
|
| |
Requires: libstdc++-devel
|
| |
Requires: gcc-c++
|
| |
|
| |
+ #---Provides/Conflicts---------------------------------------------------------#
|
| |
+
|
| |
Provides: clang(major) = %{maj_ver}
|
| |
|
| |
Conflicts: compiler-rt < %{version}
|
| |
@@ -176,6 +226,8 @@
|
| |
enable sanitization and profiling options when building, and
|
| |
libomp-devel to enable -fopenmp.
|
| |
|
| |
+ %if %{with sub_pkgs}
|
| |
+
|
| |
%package libs
|
| |
Summary: Runtime library for clang
|
| |
Requires: %{name}-resource-filesystem%{?_isa} = %{version}
|
| |
@@ -190,12 +242,12 @@
|
| |
|
| |
%package devel
|
| |
Summary: Development header files for clang
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with full_build}
|
| |
Requires: %{name}%{?_isa} = %{version}-%{release}
|
| |
# The clang CMake files reference tools from clang-tools-extra.
|
| |
Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release}
|
| |
- Requires: %{name}-libs = %{version}-%{release}
|
| |
%endif
|
| |
+ Requires: %{name}-libs = %{version}-%{release}
|
| |
|
| |
%description devel
|
| |
Development header files for clang.
|
| |
@@ -207,7 +259,7 @@
|
| |
%description resource-filesystem
|
| |
This package owns the clang resouce directory: $libdir/clang/$version/
|
| |
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with full_build}
|
| |
%package analyzer
|
| |
Summary: A source code analysis framework
|
| |
License: NCSA and MIT
|
| |
@@ -248,15 +300,15 @@
|
| |
%description -n python3-clang
|
| |
%{summary}.
|
| |
|
| |
-
|
| |
%endif
|
| |
|
| |
+ %endif
|
| |
|
| |
%prep
|
| |
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'
|
| |
|
| |
- %if 0%{?compat_build}
|
| |
- %autosetup -n %{clang_srcdir} -p1
|
| |
+ %if %{with compat_build} || %{with minimal_build}
|
| |
+ %autosetup -n %{clang_srcdir} -p2
|
| |
%else
|
| |
|
| |
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE2}' --data='%{SOURCE1}'
|
| |
@@ -269,12 +321,12 @@
|
| |
|
| |
%setup -q -n %{clang_srcdir}
|
| |
|
| |
- %patch4 -p1 -b .gtest
|
| |
- %patch11 -p1 -b .libcxx-fix
|
| |
+ %patch4 -p2 -b .gtest
|
| |
+ %patch11 -p2 -b .libcxx-fix
|
| |
%patch13 -p2 -b .unwind-all
|
| |
%patch15 -p2 -b .no-install-static
|
| |
%patch16 -p2 -b .test-fix2
|
| |
- %patch17 -p1 -b .check-gcc_s
|
| |
+ %patch17 -p2 -b .check-gcc_s
|
| |
|
| |
mv ../%{clang_tools_srcdir} tools/extra
|
| |
|
| |
@@ -296,11 +348,7 @@
|
| |
%global _lto_cflags %(echo %{_lto_cflags} | sed 's/-ffat-lto-objects//')
|
| |
%endif
|
| |
|
| |
- %if 0%{?__isa_bits} == 64
|
| |
- sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/64/g' test/lit.cfg.py
|
| |
- %else
|
| |
- sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
|
| |
- %endif
|
| |
+ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/%{llvm_libdir_suffix}/g' test/lit.cfg.py
|
| |
|
| |
%ifarch s390 s390x %{arm} %ix86 ppc64le
|
| |
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
|
| |
@@ -312,35 +360,37 @@
|
| |
# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value
|
| |
# as nothing, so it sets the rpath to "" when installing.
|
| |
%cmake -G Ninja \
|
| |
- -DLLVM_PARALLEL_LINK_JOBS=1 \
|
| |
- -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
|
| |
- -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
| |
- -DPYTHON_EXECUTABLE=%{__python3} \
|
| |
- -DCMAKE_INSTALL_RPATH:BOOL=";" \
|
| |
+ %if 0%{debug_package}
|
| |
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
| |
+ %else
|
| |
+ -DCMAKE_BUILD_TYPE=Release \
|
| |
+ %endif
|
| |
%ifarch s390 s390x %{arm} %ix86 ppc64le
|
| |
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
|
| |
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
|
| |
%endif
|
| |
- %if 0%{?compat_build}
|
| |
+ %if %{with compat_build}
|
| |
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}.%{min_ver}-%{__isa_bits} \
|
| |
- -DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
| |
- -DCLANG_INCLUDE_TESTS:BOOL=OFF \
|
| |
- %else
|
| |
+ -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver}.%{min_ver} \
|
| |
+ %endif
|
| |
+ \
|
| |
+ %if %{with tests}
|
| |
-DCLANG_INCLUDE_TESTS:BOOL=ON \
|
| |
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
|
| |
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
|
| |
- %if 0%{?__isa_bits} == 64
|
| |
- -DLLVM_LIBDIR_SUFFIX=64 \
|
| |
%else
|
| |
- -DLLVM_LIBDIR_SUFFIX= \
|
| |
- %endif
|
| |
+ -DCLANG_INCLUDE_TESTS:BOOL=OFF \
|
| |
%endif
|
| |
- \
|
| |
- %if !0%{compat_build}
|
| |
- -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
|
| |
+ %if %{with minimal_build}
|
| |
+ -DCLANG_LINK_CLANG_DYLIB:BOOL=OFF \
|
| |
%else
|
| |
- -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver}.%{min_ver} \
|
| |
+ -DCLANG_LINK_CLANG_DYLIB:BOOL=ON \
|
| |
%endif
|
| |
+ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
| |
+ -DLLVM_PARALLEL_LINK_JOBS=1 \
|
| |
+ -DPYTHON_EXECUTABLE=%{__python3} \
|
| |
+ -DCMAKE_INSTALL_RPATH:BOOL=";" \
|
| |
+ -DLLVM_LIBDIR_SUFFIX="%{llvm_libdir_suffix}" \
|
| |
-DCLANG_ENABLE_ARCMT:BOOL=ON \
|
| |
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \
|
| |
-DCLANG_INCLUDE_DOCS:BOOL=ON \
|
| |
@@ -350,20 +400,23 @@
|
| |
-DLLVM_ENABLE_RTTI=ON \
|
| |
-DLLVM_BUILD_DOCS=ON \
|
| |
-DLLVM_ENABLE_SPHINX=ON \
|
| |
- -DCLANG_LINK_CLANG_DYLIB=ON \
|
| |
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
|
| |
\
|
| |
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
|
| |
-DBUILD_SHARED_LIBS=OFF \
|
| |
-DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}"
|
| |
|
| |
- %cmake_build
|
| |
+ %cmake_build %{?with_minimal_build:--target clang}
|
| |
|
| |
%install
|
| |
|
| |
+ %if %{with minimal_build}
|
| |
+ DESTDIR=%{buildroot} %ninja_build -C "%{__cmake_builddir}" install-clang install-clang-resource-headers
|
| |
+ %else
|
| |
%cmake_install
|
| |
+ %endif
|
| |
|
| |
- %if 0%{?compat_build}
|
| |
+ %if %{with compat_build}
|
| |
|
| |
# Remove binaries/other files
|
| |
rm -Rf %{buildroot}%{install_bindir}
|
| |
@@ -375,7 +428,9 @@
|
| |
mv %{buildroot}/%{install_includedir}/clang %{buildroot}/%{pkg_includedir}/
|
| |
mv %{buildroot}/%{install_includedir}/clang-c %{buildroot}/%{pkg_includedir}/
|
| |
|
| |
- %else
|
| |
+ %endif
|
| |
+
|
| |
+ %if %{with full_build}
|
| |
|
| |
# install clang python bindings
|
| |
mkdir -p %{buildroot}%{python3_sitelib}/clang/
|
| |
@@ -434,7 +489,7 @@
|
| |
rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
|
| |
|
| |
%check
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with tests}
|
| |
# requires lit.py from LLVM utilities
|
| |
# FIXME: Fix failing ARM tests
|
| |
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
|
| |
@@ -446,8 +501,18 @@
|
| |
|
| |
%endif
|
| |
|
| |
+ %if %{with minimal_build}
|
| |
+ %files
|
| |
+ %{_bindir}/clang
|
| |
+ %{_bindir}/clang-%{maj_ver}
|
| |
+ %{_bindir}/clang-cl
|
| |
+ %{_bindir}/clang++
|
| |
+ %{_bindir}/clang-cpp
|
| |
+ %{_libdir}/clang
|
| |
+ %endif
|
| |
+
|
| |
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with full_build}
|
| |
%files
|
| |
%license LICENSE.TXT
|
| |
%{clang_binaries}
|
| |
@@ -457,39 +522,33 @@
|
| |
%{_mandir}/man1/clang++-%{maj_ver}.1.gz
|
| |
%endif
|
| |
|
| |
+ %if %{with full_build} || %{with compat_build}
|
| |
%files libs
|
| |
- %if !0%{?compat_build}
|
| |
- %{_libdir}/clang/
|
| |
- %{_libdir}/*.so.*
|
| |
- %else
|
| |
%{pkg_libdir}/*.so.*
|
| |
- %{pkg_libdir}/clang/%{version}
|
| |
- %endif
|
| |
+ %{pkg_libdir}/clang/
|
| |
|
| |
%files devel
|
| |
- %if !0%{?compat_build}
|
| |
- %{_libdir}/*.so
|
| |
- %{_includedir}/clang/
|
| |
- %{_includedir}/clang-c/
|
| |
- %{_libdir}/cmake/*
|
| |
- %dir %{_datadir}/clang/
|
| |
- %else
|
| |
%{pkg_libdir}/*.so
|
| |
%{pkg_includedir}/clang/
|
| |
%{pkg_includedir}/clang-c/
|
| |
%{pkg_libdir}/cmake/
|
| |
+ %if %{with full_build}
|
| |
+ # Why does the devel package own this directory?
|
| |
+ %dir %{_datadir}/clang/
|
| |
%endif
|
| |
|
| |
+ # %%dir means the package owns the directory and not the contents of
|
| |
+ # the directory.
|
| |
%files resource-filesystem
|
| |
+ %dir %{pkg_libdir}/clang/
|
| |
%dir %{pkg_libdir}/clang/%{version}/
|
| |
%dir %{pkg_libdir}/clang/%{version}/include/
|
| |
%dir %{pkg_libdir}/clang/%{version}/lib/
|
| |
%dir %{pkg_libdir}/clang/%{version}/share/
|
| |
- %if !0%{?compat_build}
|
| |
%{pkg_libdir}/clang/%{maj_ver}
|
| |
%endif
|
| |
|
| |
- %if !0%{?compat_build}
|
| |
+ %if %{with full_build}
|
| |
%files analyzer
|
| |
%{_bindir}/scan-view
|
| |
%{_bindir}/scan-build
|
| |
@@ -525,6 +584,12 @@
|
| |
|
| |
%endif
|
| |
%changelog
|
| |
+ * Wed Dec 16 2020 Tom Stellard <tstellar@redhat.com> - 11.0.1-3.rc1
|
| |
+ - Add conditionals to build a clang-minimal package
|
| |
+
|
| |
+ * Sat Dec 12 2020 Tom Stellard <tstellar@redhat.com> - 11.0.1-2.rc1
|
| |
+ - Spec file cleanups and improvements
|
| |
+
|
| |
* Tue Dec 01 2020 sguelton@redhat.com - 11.0.1-1.rc1
|
| |
- llvm 11.0.1-rc1
|
| |
|
| |