diff options
author | Scott B | 2021-11-09 03:24:49 -0800 |
---|---|---|
committer | Scott B | 2021-11-10 23:57:55 -0800 |
commit | 4c206e6a2aedefd00ed6e653e37cb2d2cd54a1c0 (patch) | |
tree | c70e035482e82639f2b04a7d237869a7572b18e1 | |
parent | e956059106b356518d6168d302bac8d2133fb74d (diff) | |
download | aur-4c206e6a2aedefd00ed6e653e37cb2d2cd54a1c0.tar.gz |
pkgbuild: cleanup clang build feature
Mostly shell code cleanup, the compiler check up top is much more robust
and the other references can be simplified. Clang built packages are now
easily identified by '+clang' appended to the pkgver.
DKMS hasn't released a version yet that's compatible with LLVM built
kernels so most people are going to want to beware of these unless
they've modified their local DKMS scripts.
-rw-r--r-- | PKGBUILD | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -56,9 +56,10 @@ if [ -z ${use_tracers+x} ]; then fi ## Choose between GCC and CLANG config (default is GCC) -if [ -z ${_compiler+x} ]; then - _compiler=gcc -fi +case "${_compiler,,}" in + "clang" | "gcc") _compiler=${_compiler,,} ;; # tolower, simplifes later checks + *) _compiler=gcc ;; # default to GCC +esac ## Compress modules with ZSTD (to save disk space) #if [ -z ${_compress_modules+x} ]; then @@ -95,7 +96,8 @@ makedepends=( bc kmod libelf pahole cpio perl tar xz zstd "gcc>=11.0" ) -if [ "${_compiler}" = "clang" ]; then +if [ "$_compiler" = "clang" ]; then + pkgver="${pkgver}+clang" makedepends+=(clang llvm lld python) _LLVM=1 fi @@ -244,9 +246,10 @@ prepare() { # Applying configuration cp -vf CONFIGS/xanmod/${_compiler}/config .config # enable LTO_CLANG_THIN - if [ "${_compiler}" = "clang" ]; then - scripts/config --disable LTO_CLANG_FULL - scripts/config --enable LTO_CLANG_THIN + if [ "$_compiler" = "clang" ]; then + msg2 "Enabling Clang ThinLTO ..." + scripts/config --disable LTO_CLANG_FULL \ + --enable LTO_CLANG_THIN fi # CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team @@ -259,7 +262,7 @@ prepare() { # User set. See at the top of this file if [ "$use_tracers" = "n" ]; then msg2 "Disabling FUNCTION_TRACER/GRAPH_TRACER only if we are not compiling with clang..." - if [ "${_compiler}" = "gcc" ]; then + if [ "$_compiler" = "gcc" ]; then scripts/config --disable CONFIG_FUNCTION_TRACER \ --disable CONFIG_STACK_TRACER fi |