diff --git a/clang.spec b/clang.spec index ea5e0ae..1562258 100644 --- a/clang.spec +++ b/clang.spec @@ -1,24 +1,32 @@ %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 %{without full_build} && %{without compat_build} -%{error:Must enable either full_build or compat_build} +%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 2 +%global baserelease 3 %global clang_tools_binaries \ %{_bindir}/clang-apply-replacements \ @@ -68,6 +76,14 @@ %if %{with full_build} %global pkg_name clang %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 @@ -114,6 +130,9 @@ Patch15: 0001-clang-Don-t-install-static-libraries.patch 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. @@ -177,7 +196,9 @@ BuildRequires: perl(Sys::Hostname) #---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 @@ -205,6 +226,8 @@ Install compiler-rt if you want the Blocks C language extension or to 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} @@ -277,13 +300,14 @@ Requires: python3 %description -n python3-clang %{summary}. +%endif %endif %prep %{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}' -%if %{with compat_build} +%if %{with compat_build} || %{with minimal_build} %autosetup -n %{clang_srcdir} -p2 %else @@ -357,6 +381,11 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/%{llvm_libdir_suffix}/g' test/lit.cfg.py %else -DCLANG_INCLUDE_TESTS:BOOL=OFF \ %endif +%if %{with minimal_build} + -DCLANG_LINK_CLANG_DYLIB:BOOL=OFF \ +%else + -DCLANG_LINK_CLANG_DYLIB:BOOL=ON \ +%endif -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ -DLLVM_PARALLEL_LINK_JOBS=1 \ -DPYTHON_EXECUTABLE=%{__python3} \ @@ -371,18 +400,21 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/%{llvm_libdir_suffix}/g' test/lit.cfg.py -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 %{with compat_build} @@ -469,6 +501,16 @@ false %endif +%if %{with minimal_build} +%files +%{_bindir}/clang +%{_bindir}/clang-%{maj_ver} +%{_bindir}/clang-cl +%{_bindir}/clang++ +%{_bindir}/clang-cpp +%{_libdir}/clang +%endif + %if %{with full_build} %files @@ -480,6 +522,7 @@ false %{_mandir}/man1/clang++-%{maj_ver}.1.gz %endif +%if %{with full_build} || %{with compat_build} %files libs %{pkg_libdir}/*.so.* %{pkg_libdir}/clang/ @@ -503,6 +546,7 @@ false %dir %{pkg_libdir}/clang/%{version}/lib/ %dir %{pkg_libdir}/clang/%{version}/share/ %{pkg_libdir}/clang/%{maj_ver} +%endif %if %{with full_build} %files analyzer @@ -540,6 +584,9 @@ false %endif %changelog +* Wed Dec 16 2020 Tom Stellard - 11.0.1-3.rc1 +- Add conditionals to build a clang-minimal package + * Sat Dec 12 2020 Tom Stellard - 11.0.1-2.rc1 - Spec file cleanups and improvements