summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorarchdevlab2024-01-10 22:54:52 -0500
committerarchdevlab2024-01-10 22:54:52 -0500
commitbbbf52b6d727487b0d6b998533e9724916456deb (patch)
tree73588d10abd8be0e7aec75373112ce8f3fd0f9ec /PKGBUILD
parent10abe10ad26683325489f57a82e7f59fea4efde2 (diff)
downloadaur-bbbf52b6d727487b0d6b998533e9724916456deb.tar.gz
adopt package and update
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD368
1 files changed, 207 insertions, 161 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 28bb70fc1824..2aa6154e100d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,172 +1,212 @@
-# Maintainer: graysky <therealgraysky AT protonmail DOT com>
-# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+#Maintainer: archdevlab <https://github.com/archdevlab>
+#Credits: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
+#Credits: Andreas Radke <andyrtr@archlinux.org>
+#Credits: graysky <therealgraysky AT protonmail DOT com>
-### BUILD OPTIONS
-# Any/all of the next three variables may be set to ANYTHING
-# that is not null to enable their respective build options
+################################# Arch ################################
-# Tweak kernel options prior to a build via nconfig
-_makenconfig=
+ARCH=x86
-# Only compile select modules to reduce the number of modules built
-#
-# To keep track of which modules are needed for your specific system/hardware,
-# give module_db a try: https://aur.archlinux.org/packages/modprobed-db
-# This PKGBUILD reads the database kept if it exists
-# More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db
-_localmodcfg=
+################################# Grep GCC version ################################
+
+_gccversion=$(gcc -dumpversion)
+
+################################# CC/CXX/HOSTCC/HOSTCXX ################################
+
+#Set compiler to build the kernel
+#Set '1' to build with GCC
+#Set '2' to build with CLANG and LLVM
+#Default is empty. It will build with GCC. To build with different compiler just use : env _compiler=(1 or 2) makepkg -s
+if [ -z ${_compiler+x} ]; then
+ _compiler=
+fi
+
+if [[ "$_compiler" = "1" ]]; then
+ _compiler=1
+ BUILD_FLAGS=(CC=gcc CXX=g++ HOSTCC=gcc HOSTCXX=g++)
+elif [[ "$_compiler" = "2" ]]; then
+ _compiler=2
+ BUILD_FLAGS=(CC=clang CXX=clang++ HOSTCC=clang HOSTCXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1)
+else
+ _compiler=1
+ BUILD_FLAGS=(CC=gcc CXX=g++ HOSTCC=gcc HOSTCXX=g++)
+fi
+
+###################################################################################
pkgbase=linux-rc
+pkgver=6.7rc8
+_pkgver=6.7-rc8
pkgrel=1
-_srcname=linux-6.3
-_major=6.3
-### on initial release this is null otherwise it is the current stable subversion
-### ie 1,2,3 corresponding $_major.1, $_major.3 etc
-_minor=5
-_minorc=$((_minor+1))
-### on initial release this is just $_major
-[[ -z $_minor ]] && _fullver=$_major || _fullver=$_major.$_minor
-#_fullver=$_major.$_minor
-_rcver=1
-_rcpatch=patch-${_major}.${_minorc}-rc${_rcver}
-pkgver=${_major}.${_minorc}rc${_rcver}
+commit=79425d7496066714f38535eb4f37df529668e83a
arch=(x86_64)
-url="https://www.kernel.org/"
+url='https://www.kernel.org/'
license=(GPL2)
-makedepends=(
- bc
- cpio
- gettext
- git
- libelf
- pahole
- python
- perl
- tar
- xz
-)
-options=('!strip')
-_modprobeddb=
-source=(
- https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/"$_rcpatch".{xz,sign}
- # https://lkml.org/lkml/2019/8/23/712
- #"$_rcpatch.patch::https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=$_srcname.y&id2=v${_major}.${_minor}"
- https://www.kernel.org/pub/linux/kernel/v5.x/linux-$_fullver.tar.{xz,sign}
- config # the main kernel config file
- 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
-)
-validpgpkeys=(
- 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
- '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
- 'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig)
- 'C7E7849466FE2358343588377258734B41C31549' # David Runge <dvzrv@archlinux.org>
-)
-b2sums=('a18e5f933756f496b3073361d0669814041593a22657206dd801bd97801a405f89e92cdd363cecd21b41dd353d3205f16a8e1197df5d1e3aa6421e50a463583a'
- 'SKIP'
- '646a94591eae93db9301a11e5300579c8cce7d2a544727cb88efed86d05ba070a247498d9c83d7b7cdbead4e7d46537134c877813aa7f188dd36b403c58d0c11'
- 'SKIP'
- 'f6f53ed92891b063ae6874764ad370f5de2d115dcf7a5d5d35f4fa678947235abb023b156c6563c068a313654a856807298f1935d78238f698e38b9bcd4db6e6'
- '726829c8cf3753fa3f397f85ca828d99b8130c6d83790996ece927a46215fb843f10186aa5ae5b9904e46f0afa68b6ae3c10508370edafbbc2a0e43a35050271')
-
-_make() {
- test -s version
- make KERNELRELEASE="$(<version)" "$@"
-}
+makedepends=(bc cpio gettext git libelf pahole perl python tar xz kmod xmlto)
+makepends+=(graphviz imagemagick python-sphinx texlive-latexextra) # htmldocs
+makedepends+=(bison flex zstd make patch gcc gcc-libs glibc binutils)
+if [[ "$_compiler" = "2" ]]; then
+ makedepends+=(clang llvm llvm-libs lld python)
+fi
+options=(!strip)
-prepare() {
- # hacky work around for rc1 not getting extracted
- # https://bbs.archlinux.org/viewtopic.php?id=265115
- if [[ ! -f "$srcdir/$_rcpatch" ]]; then
- xz -dc "$SRCDEST/$_rcpatch.xz" > "$_rcpatch"
- fi
+archlinuxpath=https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/$commit
- cd linux-${_fullver}
- msg2 "Setting version..."
- echo "-$pkgrel" > localversion.10-pkgrel
- echo "${pkgbase#linux}" > localversion.20-pkgname
+source=(#https://github.com/torvalds/linux/archive/refs/tags/v${_pkgver}.tar.gz
+ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-${_pkgver}.tar.gz
+ ${archlinuxpath}/config
+ # Arch patches
+ 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch)
- msg2 "Applying $_rcpatch..."
- patch -Np1 <"../$_rcpatch"
+export KBUILD_BUILD_HOST=archlinux
+export KBUILD_BUILD_USER=$pkgbase
+export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
- make defconfig
- make -s kernelrelease > version
- make mrproper
+prepare(){
+ cd ${srcdir}/linux-$_pkgver
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
- [[ $src = 0*.patch ]] || continue
- echo "Applying patch $src..."
+ [[ $src = *.patch ]] || continue
+ msg "Applying patch $src..."
patch -Np1 < "../$src"
done
- echo "Setting config..."
- cp ../config .config
+ plain ""
+
+ # Copy the config file first
+ # Copy "${srcdir}"/config to "${srcdir}"/linux-${_pkgver}/.config
+ msg "Copy "${srcdir}"/config to "${srcdir}"/linux-$_pkgver/.config"
+ cp "${srcdir}"/config .config
+
+ sleep 2s
+
+ plain ""
+
+ # # Remove gcc-plugin if gcc version = 13.0.0
+ # if [[ "$_gccversion" = "13.0.0" ]]; then
+ #
+ # msg "Remove GCC_PLUGINS"
+ # scripts/config --disable CONFIG_HAVE_GCC_PLUGINS
+ # scripts/config --disable CONFIG_GCC_PLUGINS
+ #
+ # sleep 2s
+ # plain ""
+ # fi
+
+ # Set LTO with CLANG/LLVM
+ if [[ "$_compiler" = "2" ]]; then
+
+ msg "Enable THIN LTO"
+ scripts/config --enable CONFIG_LTO
+ scripts/config --enable CONFIG_LTO_CLANG
+ scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG
+ scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN
+ scripts/config --disable CONFIG_LTO_NONE
+ scripts/config --enable CONFIG_HAS_LTO_CLANG
+ scripts/config --disable CONFIG_LTO_CLANG_FULL
+ scripts/config --enable CONFIG_LTO_CLANG_THIN
+ scripts/config --enable CONFIG_HAVE_GCC_PLUGINS
+
+ #msg "Enable FULL LTO"
+ #scripts/config --enable CONFIG_LTO
+ #scripts/config --enable CONFIG_LTO_CLANG
+ #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG
+ #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN
+ #scripts/config --disable CONFIG_LTO_NONE
+ #scripts/config --enable CONFIG_HAS_LTO_CLANG
+ #scripts/config --enable CONFIG_LTO_CLANG_FULL
+ #scripts/config --disable CONFIG_LTO_CLANG_THIN
+ #scripts/config --enable CONFIG_HAVE_GCC_PLUGINS
+
+ #msg "Disable LTO"
+ #scripts/config --enable CONFIG_LTO_NONE
+
+ sleep 2s
+ plain ""
+ fi
+ msg "Apply some Archlinux config"
- # non-interactively apply ck1 default options
- # this isn't redundant if we want a clean selection of subarch below
- make olddefconfig
- diff -u ../config .config || :
- # make nconfig
+ msg2 "Compress modules by default (following Arch's kernel)"
+ scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD
- make -s kernelrelease > version
- msg2 "Prepared $pkgbase version $(<version)"
+ sleep 2s
+
+ msg2 "CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team"
+ scripts/config --enable CONFIG_STACK_VALIDATION
+
+ sleep 2s
+
+ msg2 "Enable IKCONFIG following Arch's philosophy"
+ scripts/config --enable CONFIG_IKCONFIG
+ scripts/config --enable CONFIG_IKCONFIG_PROC
+
+ sleep 2s
+
+ msg2 "Enable FUNCTION_TRACER/GRAPH_TRACER"
+ scripts/config --enable CONFIG_FUNCTION_TRACER
+ scripts/config --enable CONFIG_STACK_TRACER
+
+ sleep 2s
- ### Optionally load needed modules for the make localmodconfig
- # See https://aur.archlinux.org/packages/modprobed-db
- if [ -n "$_localmodcfg" ]; then
- if [ -f $HOME/.config/modprobed.db ]; then
- echo "Running Steven Rostedt's make localmodconfig now"
- make LSMOD="$HOME/.config/modprobed.db" localmodconfig
- else
- echo "No modprobed.db data found"
- exit
- fi
- fi
+ msg2 "Enable CONFIG_USER_NS_UNPRIVILEGED"
+ scripts/config --enable CONFIG_USER_NS
- echo "Prepared $pkgbase version $(<version)"
+ sleep 2s
- [[ -z "$_makenconfig" ]] || make nconfig
+ plain ""
- # save configuration for later reuse
- cat .config > "${startdir}/config.last"
+ msg "Supress depmod"
+ sed -i '2iexit 0' scripts/depmod.sh
- # uncomment if you want to build with distcc
- ### sed -i '/HAVE_GCC_PLUGINS/d' arch/x86/Kconfig
+ sleep 2s
+
+ plain ""
+
+ # Setting localversion
+ msg "Setting localversion..."
+ # --save-scmversion as been removed in upstream
+ # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/scripts/setlocalversion?h=v6.3-rc1&id=f6e09b07cc12a4d104bb19fe7566b0636f60c413
+ # scripts/setlocalversion --save-scmversion
+ echo "-${pkgbase}" > localversion
+
+ plain ""
+
+ # Config
+ make ARCH=${ARCH} ${BUILD_FLAGS[*]} olddefconfig
+
+ plain ""
+
+ make -s kernelrelease > version
+ msg "Prepared $pkgbase version $(<version)"
+
+ plain ""
}
-build() {
- cd linux-${_fullver}
- make all
+build(){
+ cd ${srcdir}/linux-$_pkgver
+
+ msg "make -j$(nproc) all..."
+ make ARCH=${ARCH} ${BUILD_FLAGS[*]} -j$(nproc) all
}
-_package() {
- pkgdesc="The release candidate kernel and modules"
- depends=(
- coreutils
- initramfs
- kmod
- )
- optdepends=(
- 'wireless-regdb: to set the correct wireless channels of your country'
- 'linux-firmware: firmware images needed for some devices'
- )
- provides=(
- KSMBD-MODULE
- VIRTUALBOX-GUEST-MODULES
- WIREGUARD-MODULE
- )
- replaces=(
- virtualbox-guest-modules-arch
- wireguard-arch
- )
-
- cd linux-${_fullver}
- local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
-
- echo "Installing boot image..."
+_package(){
+ pkgdesc='The Linux kernel and modules - Release Candidate version'
+ depends=(coreutils initramfs kmod)
+ optdepends=('wireless-regdb: to set the correct wireless channels of your country'
+ 'linux-firmware: firmware images needed for some devices')
+ provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
+ replaces=(virtualbox-guest-modules-arch wireguard-arch)
+
+ cd ${srcdir}/linux-$_pkgver
+
+ local kernver="$(<version)"
+ local modulesdir="${pkgdir}"/usr/lib/modules/${kernver}
+
+ msg "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"
@@ -174,24 +214,24 @@ _package() {
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
- echo "Installing modules..."
- _make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
- DEPMOD=/doesnt/exist modules_install # Suppress depmod
+ msg "Installing modules..."
+ ZSTD_CLEVEL=19 make ARCH=${ARCH} ${BUILD_FLAGS[*]} INSTALL_MOD_PATH="${pkgdir}"/usr INSTALL_MOD_STRIP=1 -j$(nproc) modules_install
# remove build and source links
- rm "$modulesdir"/{source,build}
+ msg "Remove build dir and source dir..."
+ rm -rf "$modulesdir"/{source,build}
}
-_package-headers() {
- pkgdesc="Headers and scripts for building modules for the linux-rc kernel"
- depends=(pahole "$pkgbase") # added to keep kernel and headers packages matched
+_package-headers(){
+ pkgdesc="Headers and scripts for building modules for the $pkgbase package"
+ depends=("${pkgbase}" pahole)
- cd linux-${_fullver}
- local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
+ cd ${srcdir}/linux-$_pkgver
- echo "Installing build files..."
- install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
- localversion.* version vmlinux
+ local builddir="$pkgdir"/usr/lib/modules/"$(<version)"/build
+
+ msg "Installing build files..."
+ install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map *localversion* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts
@@ -200,9 +240,11 @@ _package-headers() {
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
# required when DEBUG_INFO_BTF_MODULES is enabled
- install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
+ if [ -f tools/bpf/resolve_btfids/resolve_btfids ]; then
+ install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
+ fi
- echo "Installing headers..."
+ msg "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
@@ -221,27 +263,27 @@ _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..."
+ msg "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
- echo "Removing unneeded architectures..."
+ msg "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
- echo "Removing $(basename "$arch")"
+ msg2 "Removing $(basename "$arch")"
rm -r "$arch"
done
- echo "Removing documentation..."
+ msg "Removing documentation..."
rm -r "$builddir/Documentation"
- echo "Removing broken symlinks..."
+ msg "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
- echo "Removing loose objects..."
+ msg "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
- echo "Stripping build tools..."
+ msg "Stripping build tools..."
local file
while read -rd '' file; do
case "$(file -Sib "$file")" in
@@ -256,15 +298,19 @@ _package-headers() {
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
- echo "Stripping vmlinux..."
+ msg "Stripping vmlinux..."
strip -v $STRIP_STATIC "$builddir/vmlinux"
- echo "Adding symlink..."
+ msg "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
-pkgname=("$pkgbase" "$pkgbase-headers")
+sha256sums=('4306cbb1b33b2fd67a86d9a3e4faba9a95413398c3d9cf57991ee97800a0640a'
+ '45a44ff0e957cd562d2ceb60c1c90fc19c19e808209cebb46bfacfccfb56ad96'
+ 'f936aae4d832ac87db8fbb9effb066dd368d092f71dd7135d1548babdb7d10c8')
+
+pkgname=($pkgbase $pkgbase-headers)
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")