Skip to content

Commit

Permalink
PKGBUILD: Make LTO a hard dependency when building with clang
Browse files Browse the repository at this point in the history
In hindsight, there's not much to be gained by compiling clang without LTO. Faster compile times can be achieved
but the additional time it takes using LTO hardly matters on modern computers.

Forcing this on also makes it simple for the build script we use because the clang-specific features aren't
available on GCC (obviously).

Also refactored the pkgsuffix conditions to use _is_lto_kernel instead to make it cleaner.

Suggested-by: Vasiliy Stelmachenok <[email protected]>
Signed-off-by: Eric Naim <[email protected]>
  • Loading branch information
1Naim committed Dec 6, 2024
1 parent bc598bd commit 909b415
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions linux-cachyos/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ _autofdo_profile_name=${_autofdo_profile_name-}


# ATTENTION: Do not modify after this line
_is_clang_kernel() {
[[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] || [ -n "$_use_kcfi" ] || [ -n "$_autofdo" ]
_is_lto_kernel() {
[[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]]
return $?
}

if [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] && [ "$_use_lto_suffix" = "y" ]; then
if _is_lto_kernel && [ "$_use_lto_suffix" = "y" ]; then
_pkgsuffix=cachyos-lto
elif [ "$_use_llvm_lto" = "none" ] && [ -z "$_use_kcfi" ] && [ "$_use_gcc_suffix" = "y" ]; then
elif ! _is_lto_kernel && [ "$_use_gcc_suffix" = "y" ]; then
_pkgsuffix=cachyos-gcc
else
_pkgsuffix=cachyos
Expand Down Expand Up @@ -212,7 +212,7 @@ source=(
"${_patchsource}/all/0001-cachyos-base-all.patch")

# LLVM makedepends
if _is_clang_kernel; then
if _is_lto_kernel; then
makedepends+=(clang llvm lld)
source+=("${_patchsource}/misc/dkms-clang.patch")
BUILD_FLAGS=(
Expand Down

0 comments on commit 909b415

Please sign in to comment.