# Maintainer: Joakim Hernberg # Contributor: David Runge _pkgver=4.19.106 _rtpatchver=46 pkgbase=linux-rt-lts pkgver=${_pkgver}.${_rtpatchver} pkgrel=2 pkgdesc='Linux RT LTS' arch=('x86_64') url="https://wiki.linuxfoundation.org/realtime/start" license=('GPL2') makedepends=('bc' 'git' 'graphviz' 'imagemagick' 'kmod' 'libelf' 'python-sphinx' 'python-sphinx_rtd_theme' 'xmlto') options=('!strip') _srcname=linux-${_pkgver} source=( "https://www.kernel.org/pub/linux/kernel/v4.x/linux-${_pkgver}.tar.xz" "https://www.kernel.org/pub/linux/kernel/v4.x/linux-${_pkgver}.tar.sign" "https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patch-${_pkgver}-rt${_rtpatchver}.patch.xz" "https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patch-${_pkgver}-rt${_rtpatchver}.patch.sign" 'config' '0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch' ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig) '64254695FFF0AA4466CC19E67B96E8162A8CF5D1' # Sebastian Andrzej Siewior '5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73' # Steven Rostedt 'E644E2F1D45FA0B2EAA02F33109F098506FF0B14' # Thomas Gleixner ) sha256sums=('63c8bd76a9b282e18112f8ff9e3fd41e3d1df9f9b7248ea1a370b05a827e9cda' 'SKIP' '4b16c051cbf28c76a1b34d1b24ea4dcb9be28bdb640eab0c01f24b090e828a07' 'SKIP' '285708f83ef8aa4bc25643b2abd1a1aa7313f368d7221fa1c4bb6512b7a63236' 'a13581d3c6dc595206e4fe7fcf6b542e7a1bdbe96101f0f010fc5be49f99baf2') export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare() { cd $_srcname echo "Setting version..." scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" # picking up the RT patch src="${src//patch.xz/patch}" [[ $src = *.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done # removing cdomain configuration (incompatible with python-sphinx >= 3.0.0): # https://github.com/sphinx-doc/sphinx/issues/7421 sed -e "s/'cdomain',//" -i Documentation/conf.py echo "Setting config..." cp ../config .config make olddefconfig # make menuconfig # CLI menu for configuration make -s kernelrelease > version echo "Prepared $pkgbase version $( 5.3 mkdir "$builddir/.tmp_versions" echo "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 install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h # http://bugs.archlinux.org/task/13146 install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h # http://bugs.archlinux.org/task/20402 install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h echo "Installing KConfig files..." find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \; echo "Removing unneeded architectures..." local arch for arch in "$builddir"/arch/*/; do [[ $arch = */x86/ ]] && continue echo "Removing $(basename "$arch")" rm -r "$arch" done echo "Removing documentation..." rm -r "$builddir/Documentation" echo "Removing broken symlinks..." find -L "$builddir" -type l -printf 'Removing %P\n' -delete echo "Removing loose objects..." find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete echo "Stripping build tools..." local file while read -rd '' file; do case "$(file -bi "$file")" in application/x-sharedlib\;*) # Libraries (.so) strip -v $STRIP_SHARED "$file" ;; application/x-archive\;*) # Libraries (.a) strip -v $STRIP_STATIC "$file" ;; application/x-executable\;*) # Binaries strip -v $STRIP_BINARIES "$file" ;; application/x-pie-executable\;*) # Relocatable binaries strip -v $STRIP_SHARED "$file" ;; esac done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0) echo "Adding symlink..." mkdir -p "$pkgdir/usr/src" ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase" echo "Fixing permissions..." chmod -Rc u=rwX,go=rX "$pkgdir" } _package-docs() { pkgdesc="Documentation for the $pkgdesc kernel" cd $_srcname local builddir="$pkgdir/usr/lib/modules/$(