VOOZH about

URL: https://pastebin.com/PCT1e4uZ

⇱ # Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>pkgbas - Pastebin.com


Untitled

a guest
Apr 19th, 2020
906
0
Never
Not a member of Pastebin yet? , it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. # Maintainer: Jan Alexander Steffens (heftig) <[email protected]>
  2. pkgbase=linux-milo
  3. pkgver=5.6.5.arch3
  4. pkgrel=1
  5. pkgdesc='Linux'
  6. _srctag=v${pkgver%.*}-${pkgver##*.}
  7. url="https://git.archlinux.org/linux.git/log/?h=$_srctag"
  8. arch=(x86_64)
  9. license=(GPL2)
  10. makedepends=(
  11. bc kmod libelf
  12. xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
  13. git
  14. )
  15. options=('!strip')
  16. _srcname=archlinux-linux
  17. source=(
  18. "$_srcname::git+https://git.archlinux.org/linux.git?signed#tag=$_srctag"
  19. config # the main kernel config file
  20. sphinx-workaround.patch
  21. )
  22. validpgpkeys=(
  23. 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
  24. '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
  25. '8218F88849AAC522E94CF470A5E9288C4FA415FA' # Jan Alexander Steffens (heftig)
  26. )
  27. sha256sums=('SKIP'
  28. 'dfd3310bc2d3c4adbaba5e4f2260a8a110706993be1c3e02a5ddfe88bf0c63ce'
  29. '8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c')
  30. export KBUILD_BUILD_HOST=archlinux
  31. export KBUILD_BUILD_USER=$pkgbase
  32. export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
  33. prepare() {
  34. cd $_srcname
  35. echo "Setting version..."
  36. scripts/setlocalversion --save-scmversion
  37. echo "-$pkgrel" > localversion.10-pkgrel
  38. echo "${pkgbase#linux}" > localversion.20-pkgname
  39. local src
  40. git revert 6c3a44ed3c553c324845744f30bcd1d3b07d61fd
  41. for src in "${source[@]}"; do
  42. src="${src%%::*}"
  43. src="${src##*/}"
  44. [[ $src = *.patch ]] || continue
  45. echo "Applying patch $src..."
  46. patch -Np1 < "../$src"
  47. done
  48. echo "Setting config..."
  49. cp ../config .config
  50. make olddefconfig
  51. make -s kernelrelease > version
  52. echo "Prepared $pkgbase version $(<version)"
  53. }
  54. build() {
  55. cd $_srcname
  56. make all
  57. make htmldocs
  58. }
  59. _package() {
  60. pkgdesc="The $pkgdesc kernel and modules"
  61. depends=(coreutils kmod initramfs)
  62. optdepends=('crda: to set the correct wireless channels of your country'
  63. 'linux-firmware: firmware images needed for some devices')
  64. provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
  65. replaces=(virtualbox-guest-modules-arch wireguard-arch)
  66. cd $_srcname
  67. local kernver="$(<version)"
  68. local modulesdir="$pkgdir/usr/lib/modules/$kernver"
  69. echo "Installing boot image..."
  70. # systemd expects to find the kernel here to allow hibernation
  71. # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  72. install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
  73. # Used by mkinitcpio to name the kernel
  74. echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
  75. echo "Installing modules..."
  76. make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
  77. # remove build and source links
  78. rm "$modulesdir"/{source,build}
  79. }
  80. _package-headers() {
  81. pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
  82. cd $_srcname
  83. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  84. echo "Installing build files..."
  85. install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
  86. localversion.* version vmlinux
  87. install -Dt "$builddir/kernel" -m644 kernel/Makefile
  88. install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
  89. cp -t "$builddir" -a scripts
  90. # add objtool for external module building and enabled VALIDATION_STACK option
  91. install -Dt "$builddir/tools/objtool" tools/objtool/objtool
  92. # add xfs and shmem for aufs building
  93. mkdir -p "$builddir"/{fs/xfs,mm}
  94. echo "Installing headers..."
  95. cp -t "$builddir" -a include
  96. cp -t "$builddir/arch/x86" -a arch/x86/include
  97. install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
  98. install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
  99. install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
  100. # http://bugs.archlinux.org/task/13146
  101. install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
  102. # http://bugs.archlinux.org/task/20402
  103. install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  104. install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  105. install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
  106. echo "Installing KConfig files..."
  107. find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
  108. echo "Removing unneeded architectures..."
  109. local arch
  110. for arch in "$builddir"/arch/*/; do
  111. [[ $arch = */x86/ ]] && continue
  112. echo "Removing $(basename "$arch")"
  113. rm -r "$arch"
  114. done
  115. echo "Removing documentation..."
  116. rm -r "$builddir/Documentation"
  117. echo "Removing broken symlinks..."
  118. find -L "$builddir" -type l -printf 'Removing %P\n' -delete
  119. echo "Removing loose objects..."
  120. find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
  121. echo "Stripping build tools..."
  122. local file
  123. while read -rd '' file; do
  124. case "$(file -bi "$file")" in
  125. application/x-sharedlib\;*) # Libraries (.so)
  126. strip -v $STRIP_SHARED "$file" ;;
  127. application/x-archive\;*) # Libraries (.a)
  128. strip -v $STRIP_STATIC "$file" ;;
  129. application/x-executable\;*) # Binaries
  130. strip -v $STRIP_BINARIES "$file" ;;
  131. application/x-pie-executable\;*) # Relocatable binaries
  132. strip -v $STRIP_SHARED "$file" ;;
  133. esac
  134. done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
  135. echo "Adding symlink..."
  136. mkdir -p "$pkgdir/usr/src"
  137. ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
  138. }
  139. _package-docs() {
  140. pkgdesc="Documentation for the $pkgdesc kernel"
  141. cd $_srcname
  142. local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
  143. echo "Installing documentation..."
  144. local src dst
  145. while read -rd '' src; do
  146. dst="${src#Documentation/}"
  147. dst="$builddir/Documentation/${dst#output/}"
  148. install -Dm644 "$src" "$dst"
  149. done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
  150. echo "Adding symlink..."
  151. mkdir -p "$pkgdir/usr/share/doc"
  152. ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
  153. }
  154. pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
  155. for _p in "${pkgname[@]}"; do
  156. eval "package_$_p() {
  157. $(declare -f "_package${_p#$pkgbase}")
  158. _package${_p#$pkgbase}
  159. }"
  160. done
  161. # vim:set ts=8 sts=2 sw=2 et:
Advertisement
Add Comment
Please, to add comment
Public Pastes
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.  OK, I Understand
👁 Image
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!