From 4180b33667ecd8dbdda8e6e751115240bfbdaf2c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 23 Feb 2021 11:08:39 +0100 Subject: Dramatically simplified PKGBUILD, modelled from Archlinux one. --- PKGBUILD | 366 ++++++++++++++++++++++++++++----------------------------------- 1 file changed, 160 insertions(+), 206 deletions(-) (limited to 'PKGBUILD') diff --git a/PKGBUILD b/PKGBUILD index 49de4e0..c294deb 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,263 +1,217 @@ # AArch64 multi-platform with Pine64 support # Maintainer: Jaron Kent-Dobias # Contributor: Vasily Khoruzhick - -#buildarch=8 +# Contributor: Jan Alexander Steffens (heftig) pkgbase=linux-pinebook pkgver=5.10.17.pinebook1 -pkgrel=6 -_desc="AArch64 multi-platform with Pinebook support." +pkgrel=8 +pkgdesc='Pinebook Linx' _srctag=v${pkgver%.*}-${pkgver##*.} url="https://git.kent-dobias.com/system/linux/log/?h=$_srctag" -_kernelname=${pkgbase#linux} -arch=('aarch64') -license=('GPL2') -makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'dtc' 'clang' 'llvm' 'lld') +arch=(aarch64) +license=(GPL2) +makedepends=( + bc kmod libelf pahole + xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick + git + uboot-tools dtc + clang llvm lld +) options=('!strip') _srcname=pinebook-linux source=( - "$_srcname::git+https://git.kent-dobias.com/system/linux?signed#tag=$_srctag" - 'config' - 'linux.preset' - '99-linux.hook' - ) + "$_srcname::git+https://git.kent-dobias.com/system/linux?signed#tag=$_srctag" + config +) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig) 'D214744D04A2CC409C37D331534FC3B63E48F730' # Jaron Kent-Dobias - ) -md5sums=('SKIP' - '88b0fc5f5af4d3e633848659a66de9b1' - '1bcc6c5d103b31523c5077b7c89f2b79' - '1d4477026533efaa0358a40855d50a83') +) +sha256sums=('SKIP' + '65dec29913b046ec8ffd4d4a80cb03e17a7ac25d6cd36099e4235ef89648765c') 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 "${srcdir}/${_srcname}" +export ARCH=arm64 +export CROSS_COMPILE=aarch64-linux-gnu- - cat "${srcdir}/config" > ./.config +_make='make LLVM=1' + +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##*/}" + [[ $src = *.patch ]] || continue + echo "Applying patch $src..." + patch -Np1 < "../$src" + done - # add pkgrel to extraversion - sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile + echo "Setting config..." + cp ../config .config + $_make olddefconfig - # don't run depmod on 'make install'. We'll do this ourselves in packaging - sed -i '2iexit 0' scripts/depmod.sh + $_make -s kernelrelease > version + echo "Prepared $pkgbase version $(=0.7') - optdepends=('crda: to set the correct wireless channels of your country') - provides=('kernel26' "linux=${pkgver}") - replaces=('linux-armv8-rc') - conflicts=('linux') - backup=("etc/mkinitcpio.d/${pkgbase}.preset") - install=${pkgname}.install - - cd "${srcdir}/${_srcname}" - - KARCH=arm64 - - # get kernel version - _kernver="$(ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 kernelrelease)" - _basekernel=${_kernver%%-*} - _basekernel=${_basekernel%.*} - - mkdir -p "${pkgdir}"/{lib/modules,lib/firmware} - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 INSTALL_MOD_PATH="${pkgdir}" modules_install - ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make LLVM=1 INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install - cp arch/$KARCH/boot/Image{,.gz} "${pkgdir}/boot" - - # set correct depmod command for install - sed \ - -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \ - -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \ - -i "${startdir}/${pkgname}.install" - - # install mkinitcpio preset file for kernel - install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - sed \ - -e "1s|'linux.*'|'${pkgbase}'|" \ - -e "s|ALL_kver=.*|ALL_kver=\"${_kernver}\"|" \ - -i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" - - # install pacman hook for initramfs regeneration - sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/99-linux.hook" | - install -D -m644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/99-${pkgbase}.hook" + pkgdesc="The $pkgdesc kernel and modules" + depends=(coreutils kmod initramfs) + optdepends=('crda: to set the correct wireless channels of your country' + 'linux-firmware: firmware images needed for some devices') + provides=(linux VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE) + replaces=(virtualbox-guest-modules-arch wireguard-arch) + conflicts=(linux) - # remove build and source links - rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build} - # remove the firmware - rm -rf "${pkgdir}/lib/firmware" - # make room for external modules - ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules" - # add real version for building modules and running depmod from post_install/upgrade - mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}" - echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version" - - # Now we call depmod... - depmod -b "$pkgdir" -F System.map "$_kernver" - - # move module tree /lib -> /usr/lib - mkdir -p "${pkgdir}/usr" - mv "$pkgdir/lib" "$pkgdir/usr" - - # add vmlinux - install -D -m644 vmlinux "${pkgdir}/usr/lib/modules/${_kernver}/build/vmlinux" -} + cd $_srcname + local kernver="$(/dev/null | while read binary ; do - case "$(file -bi "${binary}")" in - *application/x-sharedlib*) # Libraries (.so) - /usr/bin/strip ${STRIP_SHARED} "${binary}";; - *application/x-archive*) # Libraries (.a) - /usr/bin/strip ${STRIP_STATIC} "${binary}";; - *application/x-executable*) # Binaries - /usr/bin/strip ${STRIP_BINARIES} "${binary}";; - esac - done + echo "Installing documentation..." + local src dst + while read -rd '' src; do + dst="${src#Documentation/}" + dst="$builddir/Documentation/${dst#output/}" + install -Dm644 "$src" "$dst" + done < <(find Documentation -name '.*' -prune -o ! -type d -print0) - # remove unneeded architectures - rm -rf "${pkgdir}"/usr/lib/modules/${_kernver}/build/arch/{alpha,arc,arm,arm26,avr32,blackfin,c6x,cris,frv,h8300,hexagon,ia64,m32r,m68k,m68knommu,metag,mips,microblaze,mn10300,openrisc,parisc,powerpc,ppc,s390,score,sh,sh64,sparc,sparc64,tile,unicore32,um,v850,x86,xtensa} + echo "Adding symlink..." + mkdir -p "$pkgdir/usr/share/doc" + ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase" } -pkgname=("${pkgbase}" "${pkgbase}-headers") -for _p in ${pkgname[@]}; do - eval "package_${_p}() { - _package${_p#${pkgbase}} +pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs") +for _p in "${pkgname[@]}"; do + eval "package_$_p() { + $(declare -f "_package${_p#$pkgbase}") + _package${_p#$pkgbase} }" done + +# vim:set ts=8 sts=2 sw=2 et: -- cgit v1.2.3-70-g09d2