archrelease: copy trunk to community-any
[arch-community.git] / netfilter-fullconenat / trunk / PKGBUILD
blob6d564c5faaeb7e7ed46666ae21097610410117a8
1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Contributor: Edward Pacman <edward@edward-p.xyz>
4 pkgname=netfilter-fullconenat
5 pkgver=r73.0cf3b48
6 pkgrel=291
7 pkgdesc="A kernel module that turns MASQUERADE into full cone SNAT"
8 arch=('x86_64')
9 url="https://github.com/Chion82/netfilter-full-cone-nat"
10 license=('GPL2')
11 depends=("linux")
12 makedepends=('linux-headers' 'git')
13 _commit=0cf3b48fd7d2fa81d0297d1fff12bbd0580fc435  # master
14 source=("${pkgname}::git+https://github.com/Chion82/netfilter-full-cone-nat#commit=${_commit}"
15         0001-Linux-5.15.patch
16         0002-Linux-6.1.patch)
17 sha256sums=('SKIP'
18             'a67c52bb58fac8113b4bc9640b626baa1d9e533c9bb8a2019153490d223b918a'
19             'b164406e56c84b4659f6b17be47dc5314fff74a92d1a3028c629dc91576abf94')
21 pkgver() {
22   cd ${pkgname}
23   ( set -o pipefail
24     git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
25     printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
26   )
29 prepare() {
30   cd ${pkgname}
31   echo "obj-m = xt_FULLCONENAT.o" > Kbuild
32   git apply -3 ../0001-Linux-5.15.patch
33   git apply -3 ../0002-Linux-6.1.patch
36 build() {
37   cd ${pkgname}
38   make -C /usr/src/linux M=$PWD modules
41 package() {
42   local extradir=/usr/lib/modules/$(</usr/src/linux/version)/extramodules
43   install -Dt "${pkgdir}${extradir}" -m644 ${pkgname}/*.ko
44   find "${pkgdir}" -name '*.ko' -exec strip --strip-debug {} +
45   find "${pkgdir}" -name '*.ko' -exec xz {} +
47   echo "xt_FULLCONENAT" | \
48     install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules-load.d/${pkgname}.conf"