[OS-BUILD PATCHv2] [redhat] spec: Add %bcond_with toolchain_clang option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tom Stellard <tstellar@xxxxxxxxxx>

[redhat] spec: Add %bcond_with toolchain_clang option

This option can be enabled by passing --with toolchain_clang to rpmbuild
or mock.  Enabling this option will cause the kernel to be built with
clang instead of gcc.

Signed-off-by: Tom Stellard <tstellar@xxxxxxxxxx>

diff a/redhat/kernel.spec.template b/redhat/kernel.spec.template
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -6,6 +6,12 @@
 # Disable LTO in userspace packages.
 %global _lto_cflags %{nil}
 
+# Option to enable compiling with clang instead of gcc.
+%bcond_with toolchain_clang
+
+%if %{with toolchain_clang}
+%global toolchain clang
+%endif
 
 # Cross compile on copr for arm
 # See https://bugzilla.redhat.com/1879599
@@ -228,6 +234,10 @@ Summary: The Linux kernel
 %define make_opts -s
 %endif
 
+%if %{with toolchain_clang}
+%global make_opts %{make_opts} HOSTCC=clang CC=clang
+%endif
+
 # turn off debug kernel and kabichk for gcov builds
 %if %{with_gcov}
 %define with_debug 0
@@ -432,6 +442,14 @@ Summary: The Linux kernel
 %define with_configchecks 0
 %endif
 
+# Setting the compiler to clang enables some different config options
+# than what is expected, so disable this check for now.
+# TODO: What's the best way to fix this?  Do wee need a different set of
+# configs for clang?
+%if %{with toolchain_clang}
+%define with_configchecks 0
+%endif
+
 # To temporarily exclude an architecture from being built, add it to
 # %%nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
 # don't build kernel-headers then the new build system will no longer let
@@ -596,6 +614,10 @@ BuildRequires: xmlto
 BuildRequires: asciidoc
 %endif
 
+%if %{with toolchain_clang}
+BuildRequires: clang
+%endif
+
 # Because this is the kernel, it's hard to get a single upstream URL
 # to represent the base without needing to do a bunch of patching. This
 # tarball is generated from a src-git tree. If you want to see the

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/894
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux