Update PKGBUILD log messages

This commit is contained in:
JeremyStar™ 2024-03-11 00:26:37 +01:00
parent ad9b78dcb1
commit 338835c2e8
2 changed files with 92 additions and 68 deletions

View file

@ -130,16 +130,16 @@ prepare() {
cd ${_srcname}
### Add upstream patches
echo ":: prepare: Adding upstream patches"
echo ":: prepare: adding upstream patches"
patch -Np1 -i ../patch-${pkgver} || true
### Setting version
echo ":: prepare: setting version"
echo ":: prepare: updating version"
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
### Add Clear Linux patches
echo ":: prepare: Patching kernel with 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
@ -147,16 +147,16 @@ prepare() {
continue
fi
fi
echo ":: prepare: Applying patch ${i}..."
echo ":: prepare: applying patch ${i}..."
patch -Np1 -i "$srcdir/cl-linux/${i}" || true
done
### Copy config
echo ":: prepare: Copying kernel-optimized kconfig into kernel repository"
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"
echo ":: prepare: enabling LLVM support"
scripts/config -d LTO_NONE \
-e LTO \
-e LTO_CLANG \
@ -168,14 +168,14 @@ prepare() {
fi
if [ "$_debug" == "y" ]; then
echo ":: prepare: Enabling debugging features"
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"
echo ":: prepare: disabling debugging features"
scripts/config -d DEBUG_INFO \
-d DEBUG_INFO_BTF \
-d DEBUG_INFO_DWARF4 \
@ -183,13 +183,13 @@ prepare() {
-d DEBUG_INFO_BTF_MODULES
fi
echo ":: prepare: Running olddefconfig"
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 ":: prepare: Patching kernel with kernel_compiler_patch"
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
@ -206,30 +206,31 @@ prepare() {
# See https://aur.archlinux.org/packages/modprobed-db
if [ -n "$_localmodcfg" ]; then
if [ -e "$HOME/.config/modprobed.db" ]; then
echo ":: prepare: Executing localmodconfig"
echo ":: prepare: executing localmodconfig"
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else
echo ":: prepare: error: No modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
echo ":: prepare: error: no modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
fi
fi
echo ":: prepare: Writing version"
echo ":: prepare: writing kernel version"
make -s kernelrelease > version
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: Executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
echo ":: prepare: executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
[[ -z "$_makenconfig" ]] || (
echo ":: prepare: Executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
echo ":: prepare: executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
### Save configuration for later reuse
[[ -z "$_copyfinalconfig" ]] || (
echo ":: prepare: Copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
echo ":: prepare: copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
echo ":: prepare: prepare() finished"
}
build() {
@ -238,9 +239,12 @@ build() {
cd ${_srcname}
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
echo ":: build: build() finished"
}
_package() {
echo ":: _package: _package() called"
echo ":: _package: updating package information"
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
depends=('coreutils' 'kmod' 'initramfs')
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
@ -249,11 +253,12 @@ _package() {
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
install=linux.install
echo ":: _package: cding into \"${_srcname}\""
cd $_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
echo "Installing boot image..."
echo ":: _package: installing boot image"
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
@ -261,22 +266,27 @@ _package() {
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
echo ":: _package: installing modules"
ZSTD_CLEVEL=19 make ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod
# remove build link
rm "$modulesdir"/build
echo ":: _package: _package() finished"
}
_package-headers() {
echo ":: _package-headers: _package-headers() called"
echo ":: _package-headers: updating package information"
pkgdesc="${pkgdesc} This package includes various headers and scripts for building modules."
depends=(pahole)
echo ":: _package-headers: cding into \"${_srcname}\""
cd ${_srcname}
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing build files..."
echo ":: _package-headers: installing build files"
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
@ -291,7 +301,7 @@ _package-headers() {
install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
fi
echo "Installing headers..."
echo ":: _package-headers: installing headers"
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
@ -310,10 +320,10 @@ _package-headers() {
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
echo "Installing KConfig files..."
echo ":: _package-headers: installing KConfig files"
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
echo ":: _package-headers: removing unneeded architectures"
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
@ -321,16 +331,16 @@ _package-headers() {
rm -r "$arch"
done
echo "Removing documentation..."
echo ":: _package-headers: removing documentation"
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
echo ":: _package-headers: removing broken symlinks"
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
echo ":: _package-headers: removing loose objects"
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
echo "Stripping build tools..."
echo ":: _package-headers: stripping build tools"
local file
while read -rd '' file; do
case "$(file -Sib "$file")" in
@ -345,12 +355,14 @@ _package-headers() {
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
echo ":: _package-headers: stripping vmlinux"
strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
echo ":: _package-headers: adding symlink"
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
echo ":: _package-headers: _package-headers() finished"
}
pkgname=("$pkgbase" "$pkgbase-headers")

View file

@ -46,16 +46,16 @@ prepare() {
cd ${_srcname}
### Add upstream patches
echo ":: prepare: Adding upstream patches"
echo ":: prepare: adding upstream patches"
patch -Np1 -i ../patch-${pkgver} || true
### Setting version
echo ":: prepare: setting version"
echo ":: prepare: updating version"
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
### Add Clear Linux patches
echo ":: prepare: Patching kernel with 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
@ -63,16 +63,16 @@ prepare() {
continue
fi
fi
echo ":: prepare: Applying patch ${i}..."
echo ":: prepare: applying patch ${i}..."
patch -Np1 -i "$srcdir/cl-linux/${i}" || true
done
### Copy config
echo ":: prepare: Copying kernel-optimized kconfig into kernel repository"
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"
echo ":: prepare: enabling LLVM support"
scripts/config -d LTO_NONE \
-e LTO \
-e LTO_CLANG \
@ -84,14 +84,14 @@ prepare() {
fi
if [ "$_debug" == "y" ]; then
echo ":: prepare: Enabling debugging features"
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"
echo ":: prepare: disabling debugging features"
scripts/config -d DEBUG_INFO \
-d DEBUG_INFO_BTF \
-d DEBUG_INFO_DWARF4 \
@ -99,13 +99,13 @@ prepare() {
-d DEBUG_INFO_BTF_MODULES
fi
echo ":: prepare: Running olddefconfig"
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 ":: prepare: Patching kernel with kernel_compiler_patch"
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
@ -122,30 +122,31 @@ prepare() {
# See https://aur.archlinux.org/packages/modprobed-db
if [ -n "$_localmodcfg" ]; then
if [ -e "$HOME/.config/modprobed.db" ]; then
echo ":: prepare: Executing localmodconfig"
echo ":: prepare: executing localmodconfig"
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
else
echo ":: prepare: error: No modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
echo ":: prepare: error: no modprobed.db found at \"${HOME}/.config/modprobed.db\", skipping"
fi
fi
echo ":: prepare: Writing version"
echo ":: prepare: writing kernel version"
make -s kernelrelease > version
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: Executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
echo ":: prepare: executing xconfig"
make ${BUILD_FLAGS[*]} xconfig
)
[[ -z "$_makenconfig" ]] || (
echo ":: prepare: Executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
echo ":: prepare: executing nconfig"
make ${BUILD_FLAGS[*]} nconfig
)
### Save configuration for later reuse
[[ -z "$_copyfinalconfig" ]] || (
echo ":: prepare: Copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
echo ":: prepare: copying configuration file into kernel-optimized repository"
cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
)
echo ":: prepare: prepare() finished"
}
build() {
@ -154,9 +155,12 @@ build() {
cd ${_srcname}
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
echo ":: build: build() finished"
}
_package() {
echo ":: _package: _package() called"
echo ":: _package: updating package information"
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
depends=('coreutils' 'kmod' 'initramfs')
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
@ -165,11 +169,12 @@ _package() {
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
install=linux.install
echo ":: _package: cding into \"${_srcname}\""
cd $_srcname
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
echo "Installing boot image..."
echo ":: _package: installing boot image"
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
@ -177,22 +182,27 @@ _package() {
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
echo ":: _package: installing modules"
ZSTD_CLEVEL=19 make ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
DEPMOD=/doesnt/exist modules_install # Suppress depmod
# remove build link
rm "$modulesdir"/build
echo ":: _package: _package() finished"
}
_package-headers() {
echo ":: _package-headers: _package-headers() called"
echo ":: _package-headers: updating package information"
pkgdesc="${pkgdesc} This package includes various headers and scripts for building modules."
depends=(pahole)
echo ":: _package-headers: cding into \"${_srcname}\""
cd ${_srcname}
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing build files..."
echo ":: _package-headers: installing build files"
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
@ -207,7 +217,7 @@ _package-headers() {
install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
fi
echo "Installing headers..."
echo ":: _package-headers: installing headers"
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
@ -226,10 +236,10 @@ _package-headers() {
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
echo "Installing KConfig files..."
echo ":: _package-headers: installing KConfig files"
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
echo ":: _package-headers: removing unneeded architectures"
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
@ -237,16 +247,16 @@ _package-headers() {
rm -r "$arch"
done
echo "Removing documentation..."
echo ":: _package-headers: removing documentation"
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
echo ":: _package-headers: removing broken symlinks"
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
echo ":: _package-headers: removing loose objects"
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
echo "Stripping build tools..."
echo ":: _package-headers: stripping build tools"
local file
while read -rd '' file; do
case "$(file -Sib "$file")" in
@ -261,12 +271,14 @@ _package-headers() {
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
echo ":: _package-headers: stripping vmlinux"
strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
echo ":: _package-headers: adding symlink"
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
echo ":: _package-headers: _package-headers() finished"
}
pkgname=("$pkgbase" "$pkgbase-headers")