commit:     9c1beee8e43ecd644bc1f7f473ea4e4a7098ceeb
Author:     Adel KARA SLIMANE <adel.ks <AT> zegrapher <DOT> com>
AuthorDate: Sat Oct 22 17:01:48 2022 +0000
Commit:     Piotr Karbowski <slashbeast <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 16:06:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c1beee8

app-admin/ryzen_smu: handle clang built kernels OOTB

If the kernel has been built with a different version of clang
than the default one, the emerge will fail as expected.

Signed-off-by: Adel KARA SLIMANE <adel.ks <AT> zegrapher.com>
Closes: https://github.com/gentoo/gentoo/pull/22143
Signed-off-by: Piotr Karbowski <slashbeast <AT> gentoo.org>

 app-admin/ryzen_smu/ryzen_smu-0.1.2_p20211205.ebuild | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/app-admin/ryzen_smu/ryzen_smu-0.1.2_p20211205.ebuild 
b/app-admin/ryzen_smu/ryzen_smu-0.1.2_p20211205.ebuild
index aa763072c39c..96e15892d055 100644
--- a/app-admin/ryzen_smu/ryzen_smu-0.1.2_p20211205.ebuild
+++ b/app-admin/ryzen_smu/ryzen_smu-0.1.2_p20211205.ebuild
@@ -26,7 +26,17 @@ pkg_setup() {
        linux-mod_pkg_setup
 
        BUILD_TARGETS="modules"
-       BUILD_PARAMS="CC=$(tc-getCC) KERNEL_BUILD=${KERNEL_DIR}"
+       BUILD_PARAMS="KERNEL_BUILD=${KERNEL_DIR}"
+       if linux_chkconfig_present CC_IS_CLANG; then
+         BUILD_PARAMS+=" CC=${CHOST}-clang"
+         if linux_chkconfig_present LD_IS_LLD; then
+           BUILD_PARAMS+=' LD=ld.lld'
+           if linux_chkconfig_present LTO_CLANG_THIN; then
+             # kernel enables cache by default leading to sandbox violations
+             BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= 
LDFLAGS_MODULE=--thinlto-cache-dir='
+           fi
+         fi
+       fi
 }
 
 src_install() {

Reply via email to