db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / linux-rt / repos / extra-x86_64 / PKGBUILD
blob9ae3a321c9c69e9df30f07e7ff61dd0bbfce69ba
1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor:  Joakim Hernberg <jbh@alchemy.lu>
4 pkgbase=linux-rt
5 pkgver=6.2.0.3.realtime1
6 pkgrel=4
7 pkgdesc='Linux RT'
8 arch=(x86_64)
9 url="https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt/-/commits/v$pkgver"
10 license=(GPL2)
11 makedepends=(
12   bc
13   cpio
14   git
15   graphviz
16   imagemagick
17   libelf
18   pahole
19   perl
20   python-sphinx
21   tar
22   texlive-latexextra
23   xmlto
24   xz
26 options=(!strip)
27 source=(
28   git+https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt#tag=v$pkgver?signed
29   config
31 sha512sums=('SKIP'
32             'e079399cdd0b4916e931fda264eaef691e893f0aef085eb4af033f6766f373fbd4d13d1ae421664955c0febb4cb7b8a65a463156dab5c7256f537bd747cc94d7')
33 b2sums=('SKIP'
34         '99f4ce5e8ebde99652614730d9e7c65e275f8c1d2a01b97edf62b44852140fed7b8a53cc4e0b7d6d2783aaab6d10c7c6b0fe91d5456fd31baef2e284df659cbf')
35 validpgpkeys=(
36   '647F28654894E3BD457199BE38DBBDC86092693E'  # Greg Kroah-Hartman <gregkh@kernel.org>
37   '64254695FFF0AA4466CC19E67B96E8162A8CF5D1'  # Sebastian Andrzej Siewior
38   'C7E7849466FE2358343588377258734B41C31549'  # David Runge <dvzrv@archlinux.org>
39   '991F6E3F0765CF6295888586139B09DA5BF0D338'  # David Runge <dvzrv@archlinux.org>
42 export KBUILD_BUILD_HOST=archlinux
43 export KBUILD_BUILD_USER=$pkgbase
44 export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
46 prepare() {
47   cd $pkgbase
49   echo "Setting version..."
50   scripts/setlocalversion --save-scmversion
51   echo "-$pkgrel" > localversion.10-pkgrel
52   echo "${pkgbase#linux}" > localversion.20-pkgname
54   local src
55   for src in "${source[@]}"; do
56     src="${src%%::*}"
57     src="${src##*/}"
58     # picking up the RT patch
59     src="${src//patch.xz/patch}"
60     [[ $src = *.patch ]] || continue
61     echo "Applying patch $src..."
62     patch -Np1 < "../$src"
63   done
65   echo "Setting config..."
66   cp ../config .config
67   make olddefconfig
68   # make nconfig
70   make -s kernelrelease > version
71   echo "Prepared $pkgbase version $(<version)"
74 build() {
75   cd $pkgbase
76   make htmldocs all
79 _package() {
80   pkgdesc="The $pkgdesc kernel and modules"
81   depends=(coreutils initramfs kmod)
82   optdepends=('wireless-regdb: to set the correct wireless channels of your country'
83               'linux-firmware: firmware images needed for some devices')
84   provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE)
86   cd $pkgbase
87   local kernver="$(<version)"
88   local modulesdir="$pkgdir/usr/lib/modules/$kernver"
90   echo "Installing boot image..."
91   # systemd expects to find the kernel here to allow hibernation
92   # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
93   install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
95   # Used by mkinitcpio to name the kernel
96   echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
98   echo "Installing modules..."
99   make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
100     DEPMOD=/doesnt/exist modules_install  # Suppress depmod
102   # remove build and source links
103   rm "$modulesdir"/{source,build}
106 _package-headers() {
107   pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
108   depends=(pahole)
110   cd $pkgbase
111   local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
113   echo "Installing build files..."
114   install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
115     localversion.* version vmlinux
116   install -Dt "$builddir/kernel" -m644 kernel/Makefile
117   install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
118   cp -t "$builddir" -a scripts
120   # required when STACK_VALIDATION is enabled
121   install -Dt "$builddir/tools/objtool" tools/objtool/objtool
123   # required when DEBUG_INFO_BTF_MODULES is enabled
124   install -Dt "$builddir/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
126   echo "Installing headers..."
127   cp -t "$builddir" -a include
128   cp -t "$builddir/arch/x86" -a arch/x86/include
129   install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
131   install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
132   install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
134   # https://bugs.archlinux.org/task/13146
135   install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
137   # https://bugs.archlinux.org/task/20402
138   install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
139   install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
140   install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
142   # https://bugs.archlinux.org/task/71392
143   install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
145   echo "Installing KConfig files..."
146   find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
148   echo "Removing unneeded architectures..."
149   local arch
150   for arch in "$builddir"/arch/*/; do
151     [[ $arch = */x86/ ]] && continue
152     echo "Removing $(basename "$arch")"
153     rm -r "$arch"
154   done
156   echo "Removing documentation..."
157   rm -r "$builddir/Documentation"
159   echo "Removing broken symlinks..."
160   find -L "$builddir" -type l -printf 'Removing %P\n' -delete
162   echo "Removing loose objects..."
163   find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
165   echo "Stripping build tools..."
166   local file
167   while read -rd '' file; do
168     case "$(file -Sbi "$file")" in
169       application/x-sharedlib\;*)      # Libraries (.so)
170         strip -v $STRIP_SHARED "$file" ;;
171       application/x-archive\;*)        # Libraries (.a)
172         strip -v $STRIP_STATIC "$file" ;;
173       application/x-executable\;*)     # Binaries
174         strip -v $STRIP_BINARIES "$file" ;;
175       application/x-pie-executable\;*) # Relocatable binaries
176         strip -v $STRIP_SHARED "$file" ;;
177     esac
178   done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
180   echo "Stripping vmlinux..."
181   strip -v $STRIP_STATIC "$builddir/vmlinux"
183   echo "Adding symlink..."
184   mkdir -p "$pkgdir/usr/src"
185   ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
188 _package-docs() {
189   pkgdesc="Documentation for the $pkgdesc kernel"
191   cd $pkgbase
192   local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
194   echo "Installing documentation..."
195   local src dst
196   while read -rd '' src; do
197     dst="${src#Documentation/}"
198     dst="$builddir/Documentation/${dst#output/}"
199     install -Dm644 "$src" "$dst"
200   done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
202   echo "Adding symlink..."
203   mkdir -p "$pkgdir/usr/share/doc"
204   ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
207 pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
208 for _p in "${pkgname[@]}"; do
209   eval "package_$_p() {
210     $(declare -f "_package${_p#$pkgbase}")
211     _package${_p#$pkgbase}
212   }"
213 done
215 # vim:set ts=8 sts=2 sw=2 et: