5.15.7-3 (clr 5.15.6-1105) add option to build with clang/llvm

This commit is contained in:
Josip Ponjavic 2021-12-09 18:07:16 +01:00
parent 3d0ceaae4a
commit 3e56de3110
2 changed files with 33 additions and 9 deletions

View file

@ -1,7 +1,7 @@
pkgbase = linux-clear pkgbase = linux-clear
pkgdesc = Clear Linux pkgdesc = Clear Linux
pkgver = 5.15.7 pkgver = 5.15.7
pkgrel = 2 pkgrel = 3
url = https://github.com/clearlinux-pkgs/linux url = https://github.com/clearlinux-pkgs/linux
arch = x86_64 arch = x86_64
license = GPL2 license = GPL2

View file

@ -71,6 +71,9 @@ _subarch=
# a new kernel is released, but again, convenient for package bumps. # a new kernel is released, but again, convenient for package bumps.
_use_current= _use_current=
# Enable compiling with LLVM
_use_llvm_lto=
### IMPORTANT: Do no edit below this line unless you know what you're doing ### IMPORTANT: Do no edit below this line unless you know what you're doing
_major=5.15 _major=5.15
@ -79,12 +82,15 @@ _srcname=linux-${_major}
_clr=${_major}.6-1105 _clr=${_major}.6-1105
pkgbase=linux-clear pkgbase=linux-clear
pkgver=${_major}.${_minor} pkgver=${_major}.${_minor}
pkgrel=2 pkgrel=3
pkgdesc='Clear Linux' pkgdesc='Clear Linux'
arch=('x86_64') arch=('x86_64')
url="https://github.com/clearlinux-pkgs/linux" url="https://github.com/clearlinux-pkgs/linux"
license=('GPL2') license=('GPL2')
makedepends=('bc' 'cpio' 'git' 'kmod' 'libelf' 'pahole' 'xmlto') makedepends=('bc' 'cpio' 'git' 'kmod' 'libelf' 'pahole' 'xmlto')
if [ -n "$_use_llvm_lto" ]; then
makedepends+=(clang llvm lld python)
fi
options=('!strip') options=('!strip')
_gcc_more_v='20210914' _gcc_more_v='20210914'
source=( source=(
@ -97,6 +103,13 @@ source=(
"0001-sysctl-add-sysctl-to-disallow-unprivileged-CLONE_NEW.patch::https://raw.githubusercontent.com/xanmod/linux-patches/8ba6612318090567422d49ccc79bc7bbe5484cfc/linux-5.15.y-xanmod/userns/0001-sysctl-add-sysctl-to-disallow-unprivileged-CLONE_NEW.patch" "0001-sysctl-add-sysctl-to-disallow-unprivileged-CLONE_NEW.patch::https://raw.githubusercontent.com/xanmod/linux-patches/8ba6612318090567422d49ccc79bc7bbe5484cfc/linux-5.15.y-xanmod/userns/0001-sysctl-add-sysctl-to-disallow-unprivileged-CLONE_NEW.patch"
) )
if [ -n "$_use_llvm_lto" ]; then
BUILD_FLAGS=(
LLVM=1
LLVM_IAS=1
)
fi
export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
@ -196,7 +209,18 @@ prepare() {
# Library routines # Library routines
scripts/config --enable FONT_TER16x32 scripts/config --enable FONT_TER16x32
make olddefconfig if [ -n "$_use_llvm_lto" ]; then
scripts/config --disable LTO_NONE \
--enable LTO \
--enable LTO_CLANG \
--enable ARCH_SUPPORTS_LTO_CLANG \
--enable ARCH_SUPPORTS_LTO_CLANG_THIN \
--enable HAS_LTO_CLANG \
--enable LTO_CLANG_THIN \
--enable HAVE_GCC_PLUGINS
fi
make ${BUILD_FLAGS[*]} olddefconfig
diff -u $srcdir/$pkgbase/config .config || : diff -u $srcdir/$pkgbase/config .config || :
# https://github.com/graysky2/kernel_compiler_patch # https://github.com/graysky2/kernel_compiler_patch
@ -206,10 +230,10 @@ prepare() {
if [ -n "$_subarch" ]; then if [ -n "$_subarch" ]; then
# user wants a subarch so apply choice defined above interactively via 'yes' # user wants a subarch so apply choice defined above interactively via 'yes'
yes "$_subarch" | make oldconfig yes "$_subarch" | make ${BUILD_FLAGS[*]} oldconfig
else else
# no subarch defined so allow user to pick one # no subarch defined so allow user to pick one
make oldconfig make ${BUILD_FLAGS[*]} oldconfig
fi fi
### Optionally use running kernel's config ### Optionally use running kernel's config
@ -232,17 +256,17 @@ prepare() {
if [ -n "$_localmodcfg" ]; then if [ -n "$_localmodcfg" ]; then
if [ -e $HOME/.config/modprobed.db ]; then if [ -e $HOME/.config/modprobed.db ]; then
echo "Running Steven Rostedt's make localmodconfig now" echo "Running Steven Rostedt's make localmodconfig now"
make LSMOD=$HOME/.config/modprobed.db localmodconfig make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else else
echo "No modprobed.db data found" echo "No modprobed.db data found"
exit exit
fi fi
fi fi
make -s kernelrelease > version make ${BUILD_FLAGS[*]} -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)" echo "Prepared $pkgbase version $(<version)"
[[ -z "$_makenconfig" ]] || make nconfig [[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig
### Save configuration for later reuse ### Save configuration for later reuse
cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}" cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
@ -250,7 +274,7 @@ prepare() {
build() { build() {
cd ${_srcname} cd ${_srcname}
make all make ${BUILD_FLAGS[*]} all
} }
_package() { _package() {