Skip to content

Commit

Permalink
chore: Add $_use_gcc_suffix
Browse files Browse the repository at this point in the history
Use `$_use_gcc_suffix` instead of `$_use_lto_suffix` since LTO kernel is going to be the default now.
The latter variable will be preserved for users that still want to use it.

I have modified the if statement with the logic:
1. If using LTO + enabled LTO suffix -> cachyos-lto
2. If no LTO + no kCFI + enabled GCC suffix -> cachyos-gcc
3. All other combinations -> cachyos

The main rationale behind (2) is that kCFI isn't LTO but it also isn't gcc.

I have also moved $pkgbase outside of the if else condition because it is the same regardless of condition

Signed-off-by: Eric Naim <[email protected]>
  • Loading branch information
1Naim committed Oct 5, 2024
1 parent 75ee60a commit f10c3a9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions linux-cachyos/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ _use_auto_optimization=${_use_auto_optimization-y}
_use_llvm_lto=${_use_llvm_lto-thin}

# Use suffix -lto only when requested by the user
# Enabled by default.
# y - enable -lto suffix
# n - disable -lto suffix
# https://github.com/CachyOS/linux-cachyos/issues/36
_use_lto_suffix=${_use_lto_suffix-y}
_use_lto_suffix=${_use_lto_suffix-}

# Use suffix -gcc when requested by the user
# Enabled by default to show the difference between LTO kernels and GCC kernels
_use_gcc_suffix=${_use_gcc_suffix-y}

# KCFI is a proposed forward-edge control-flow integrity scheme for
# Clang, which is more suitable for kernel use than the existing CFI
Expand Down Expand Up @@ -148,13 +151,14 @@ _is_lto_kernel() {
_build_debug=${_build_debug-}

if [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] && [ "$_use_lto_suffix" = "y" ]; then
_pkgsuffix=cachyos
pkgbase="linux-$_pkgsuffix"

elif [ -n "$_use_llvm_lto" ] || [[ "$_use_lto_suffix" = "n" ]]; then
_pkgsuffix=cachyos-lto
elif [ "$_use_llvm_lto" = "none" ] && [ -z "_use_kcfi" ] && [ "$_use_gcc_suffix" = "y" ]; then
_pkgsuffix=cachyos-gcc
pkgbase="linux-$_pkgsuffix"
else
_pkgsuffix=cachyos
fi

pkgbase="linux-$_pkgsuffix"
_major=6.11
_minor=2
#_minorc=$((_minor+1))
Expand Down

0 comments on commit f10c3a9

Please sign in to comment.