Update PKGBUILD messages + make PKGBUILD verboser

This commit is contained in:
JeremyStar™ 2024-03-10 21:08:15 +01:00
parent ffe930b722
commit 2737464478
2 changed files with 66 additions and 26 deletions

View file

@ -125,18 +125,21 @@ export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
echo ":: prepare: prepare() called"
echo ":: prepare: cding into \"${_srcname}\""
cd ${_srcname}
### Add upstream patches
echo "Add upstream patches"
echo ":: prepare: Adding upstream patches"
patch -Np1 -i ../patch-${pkgver} || true
### Setting version
echo "Setting version..."
echo ":: prepare: setting version"
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
### Add Clear Linux patches
echo ":: prepare: Patching kernel with Clear Linux patches"
for i in $(grep '^Patch' ${srcdir}/cl-linux/linux.spec |\
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
if [ -n "$_use_llvm_lto" ]; then
@ -144,15 +147,16 @@ prepare() {
continue
fi
fi
echo "Applying patch ${i}..."
echo ":: prepare: Applying patch ${i}..."
patch -Np1 -i "$srcdir/cl-linux/${i}" || true
done
### Copy config
echo "Copying config..."
echo ":: prepare: Copying kernel-optimized kconfig into kernel repository"
cp -Tf "${startdir}/kconfig" ./.config
if [ -n "$_use_llvm_lto" ]; then
echo ":: prepare: Enabling LLVM support"
scripts/config -d LTO_NONE \
-e LTO \
-e LTO_CLANG \
@ -164,12 +168,14 @@ prepare() {
fi
if [ "$_debug" == "y" ]; then
echo ":: prepare: Enabling debugging features"
scripts/config -e DEBUG_INFO \
-e DEBUG_INFO_BTF \
-e DEBUG_INFO_DWARF4 \
-e PAHOLE_HAS_SPLIT_BTF \
-e DEBUG_INFO_BTF_MODULES
elif [ "$_debug" == "n" ]; then
echo ":: prepare: Disabling debugging features"
scripts/config -d DEBUG_INFO \
-d DEBUG_INFO_BTF \
-d DEBUG_INFO_DWARF4 \
@ -177,19 +183,22 @@ prepare() {
-d DEBUG_INFO_BTF_MODULES
fi
echo ":: prepare: Running olddefconfig"
make ${BUILD_FLAGS[*]} olddefconfig
diff -u $srcdir/cl-linux/config .config || :
# https://github.com/graysky2/kernel_compiler_patch
# make sure to apply after olddefconfig to allow the next section
echo "Patching to enable GCC optimization for other uarchs..."
echo ":: prepare: Patching kernel with kernel_compiler_patch"
patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-6.1.79-6.8-rc3.patch"
if [ -n "$_subarch" ]; then
# user wants a subarch so apply choice defined above interactively via 'yes'
echo ":: prepare: selecting sub architecture (automatic)"
yes "$_subarch" | make ${BUILD_FLAGS[*]} oldconfig
else
# no subarch defined so allow user to pick one
echo ":: prepare: selecting sub architecture (intervention required)"
make ${BUILD_FLAGS[*]} oldconfig
fi
@ -197,26 +206,37 @@ prepare() {
# See https://aur.archlinux.org/packages/modprobed-db
if [ -n "$_localmodcfg" ]; then
if [ -e "$HOME/.config/modprobed.db" ]; then
echo "Running Steven Rostedt's make localmodconfig now"
echo ":: prepare: Executing localmodconfig"
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else
echo "No modprobed.db data found"
exit
echo ":: prepare: error: No modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
fi
fi
echo ":: prepare: Writing version"
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
[[ -z "$_makexconfig" ]] || make ${BUILD_FLAGS[*]} xconfig
[[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: Executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
[[ -z "$_makenconfig" ]] || (
echo ":: prepare: Executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
### Save configuration for later reuse
[[ -z "$_copyfinalconfig" ]] || cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
[[ -z "$_copyfinalconfig" ]] || (
echo ":: prepare: Copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
}
build() {
echo ":: build: build() called"
echo ":: build: cding into \"${_srcname}\""
cd ${_srcname}
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
}

View file

@ -41,18 +41,21 @@ export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
echo ":: prepare: prepare() called"
echo ":: prepare: cding into \"${_srcname}\""
cd ${_srcname}
### Add upstream patches
echo "Add upstream patches"
echo ":: prepare: Adding upstream patches"
patch -Np1 -i ../patch-${pkgver} || true
### Setting version
echo "Setting version..."
echo ":: prepare: setting version"
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
### Add Clear Linux patches
echo ":: prepare: Patching kernel with Clear Linux patches"
for i in $(grep '^Patch' ${srcdir}/cl-linux/linux.spec |\
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
if [ -n "$_use_llvm_lto" ]; then
@ -60,15 +63,16 @@ prepare() {
continue
fi
fi
echo "Applying patch ${i}..."
echo ":: prepare: Applying patch ${i}..."
patch -Np1 -i "$srcdir/cl-linux/${i}" || true
done
### Copy config
echo "Copying config..."
echo ":: prepare: Copying kernel-optimized kconfig into kernel repository"
cp -Tf "${startdir}/kconfig" ./.config
if [ -n "$_use_llvm_lto" ]; then
echo ":: prepare: Enabling LLVM support"
scripts/config -d LTO_NONE \
-e LTO \
-e LTO_CLANG \
@ -80,12 +84,14 @@ prepare() {
fi
if [ "$_debug" == "y" ]; then
echo ":: prepare: Enabling debugging features"
scripts/config -e DEBUG_INFO \
-e DEBUG_INFO_BTF \
-e DEBUG_INFO_DWARF4 \
-e PAHOLE_HAS_SPLIT_BTF \
-e DEBUG_INFO_BTF_MODULES
elif [ "$_debug" == "n" ]; then
echo ":: prepare: Disabling debugging features"
scripts/config -d DEBUG_INFO \
-d DEBUG_INFO_BTF \
-d DEBUG_INFO_DWARF4 \
@ -93,19 +99,22 @@ prepare() {
-d DEBUG_INFO_BTF_MODULES
fi
echo ":: prepare: Running olddefconfig"
make ${BUILD_FLAGS[*]} olddefconfig
diff -u $srcdir/cl-linux/config .config || :
# https://github.com/graysky2/kernel_compiler_patch
# make sure to apply after olddefconfig to allow the next section
echo "Patching to enable GCC optimization for other uarchs..."
echo ":: prepare: Patching kernel with kernel_compiler_patch"
patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-6.1.79-6.8-rc3.patch"
if [ -n "$_subarch" ]; then
# user wants a subarch so apply choice defined above interactively via 'yes'
echo ":: prepare: selecting sub architecture (automatic)"
yes "$_subarch" | make ${BUILD_FLAGS[*]} oldconfig
else
# no subarch defined so allow user to pick one
echo ":: prepare: selecting sub architecture (intervention required)"
make ${BUILD_FLAGS[*]} oldconfig
fi
@ -113,26 +122,37 @@ prepare() {
# See https://aur.archlinux.org/packages/modprobed-db
if [ -n "$_localmodcfg" ]; then
if [ -e "$HOME/.config/modprobed.db" ]; then
echo "Running Steven Rostedt's make localmodconfig now"
echo ":: prepare: Executing localmodconfig"
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else
echo "No modprobed.db data found"
exit
echo ":: prepare: error: No modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
fi
fi
echo ":: prepare: Writing version"
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
[[ -z "$_makexconfig" ]] || make ${BUILD_FLAGS[*]} xconfig
[[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: Executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
[[ -z "$_makenconfig" ]] || (
echo ":: prepare: Executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
### Save configuration for later reuse
[[ -z "$_copyfinalconfig" ]] || cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
[[ -z "$_copyfinalconfig" ]] || (
echo ":: prepare: Copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
}
build() {
echo ":: build: build() called"
echo ":: build: cding into \"${_srcname}\""
cd ${_srcname}
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
}