APKBUILD 2.48 KB
Newer Older
1 2 3 4 5 6 7
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>

# Jool version
# Keep _ver in sync with community/jool-tools!
# When changing _ver we *must* bump _rel!
_name=jool-modules
8
_ver=4.0.9
9
_rel=0
10 11 12 13 14 15 16 17 18 19 20 21

# For custom kernels set $FLAVOR.
_flavor="$FLAVOR"
_extra_flavors=""
if [ -z "$FLAVOR" ]; then
	_flavor=lts
	case $CARCH in
		x86 | x86_64) _extra_flavors="virt";;
	esac
fi

# Kernel version
22
# Keep in sync with main/linux-lts!
23
_kpkg=linux-$_flavor
24
_kver=5.4.53
25
_krel=0
26 27 28 29 30 31 32
_kpkgver="$_kver-r$_krel"

pkgname=$_name-$_flavor
pkgver=$_kver
pkgrel=$(( $_krel + $_rel ))
pkgdesc="SIIT and NAT64 for Linux (kernel modules for linux-$_flavor)"
url="https://jool.mx"
33
arch="all !armhf !mips !mips64"
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
license="GPL-2.0-or-later"
depends="$_kpkg=$_kpkgver"
makedepends="$_kpkg-dev=$_kpkgver linux-headers"
install_if="$_kpkg=$_kpkgver jool-tools"
source="https://github.com/NICMx/Jool/releases/download/v$_ver/jool-$_ver.tar.gz"
builddir="$srcdir/jool-$_ver"
options="!check"  # no tests provided

for _f in $_extra_flavors; do
	makedepends="$makedepends linux-$_f-dev=$_kpkgver"
	subpackages="$subpackages $_name-$_f:_extra"
done

prepare() {
	default_prepare

	if [ -z "$FLAVOR" ]; then
51
		(	. "$startdir"/../../main/linux-$_flavor/APKBUILD
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
			[ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver"
			[ "$_krel" != "$pkgrel" ] && die "please update _krel to $pkgrel"
			return 0
		)
	fi

	local flavor; for flavor in $_flavor $_extra_flavors; do
		cp -r "$builddir" "$srcdir"/$flavor
	done
}

build() {
	unset LDFLAGS

	local flavor; for flavor in $_flavor $_extra_flavors; do
		# building common first appears to fix a parallell build issue.
		make -C "$srcdir"/"$flavor"/src/mod/common \
			MODULES_DIR="/lib/modules/$_kver-$_krel-$flavor"
		make -C "$srcdir"/"$flavor"/src/mod \
			MODULES_DIR="/lib/modules/$_kver-$_krel-$flavor"
	done
}

package() {
	_modules_install "$_flavor" "$pkgdir"
}

_extra() {
	local flavor=${subpkgname##*-}
	depends="linux-$flavor=$_kpkgver"
	install_if="linux-$flavor=$_kpkgver jool-tools"
	pkgdesc="SIIT and NAT64 for Linux (kernel modules for linux-$flavor)"

	_modules_install "$flavor" "$subpkgdir"
}

_modules_install() {
	local flavor="$1"
	local destdir="$2"

	make -C "$srcdir"/$flavor/src/mod modules_install \
		MODULES_DIR=/lib/modules/$_kver-$_krel-$flavor \
		INSTALL_MOD_PATH="$destdir"
}

97
sha512sums="906b8e6af43c0bb15a9302cef0721a6112820e3c474285c8ae8e1d5c8eda815881cbdfd554a1a98c48b6ed138572b5a8001c5fe3443111888d1dbe685bb0df20  jool-4.0.9.tar.gz"