diff options
-rw-r--r-- | community/wireguard-vanilla/APKBUILD | 97 | ||||
-rw-r--r-- | testing/wireguard-vanilla/APKBUILD | 67 |
2 files changed, 97 insertions, 67 deletions
diff --git a/community/wireguard-vanilla/APKBUILD b/community/wireguard-vanilla/APKBUILD new file mode 100644 index 0000000000..cbf2a8d7d0 --- /dev/null +++ b/community/wireguard-vanilla/APKBUILD @@ -0,0 +1,97 @@ +# Contributor: Stuart Cardall <developer@it-offshore.co.uk> +# Maintainer: Stuart Cardall <developer@it-offshore.co.uk> + +# wireguard version +_ver=0.0.20190406 +_rel=0 + +# kernel version +_kver=4.19.41 +_krel=0 + +_kpkgver="$_kver-r$_krel" + +# for custom kernels set $FLAVOR +if [ -z "$FLAVOR" ]; then + _flavor=vanilla + case $CARCH in + x86|x86_64) _extra_flavors="virt";; + esac +else + _flavor=$FLAVOR +fi + +pkgname=wireguard-$_flavor +pkgver=$_kver +pkgrel=1 +pkgrel=$(($pkgrel + $_krel)) + +pkgdesc="Next generation secure network tunnel: kernel modules for $_flavor" +arch="all" +url="https://www.wireguard.com" +license="GPL-2.0" +depends="linux-$_flavor=$_kpkgver" +makedepends=" + libmnl-dev + linux-$_flavor-dev=$_kpkgver + linux-firmware-none + " +install_if="wireguard-tools=$_ver-r$_rel linux-$_flavor=$_kpkgver" +options="!check" +source="https://git.zx2c4.com/WireGuard/snapshot/WireGuard-$_ver.tar.xz" +builddir="$srcdir"/WireGuard-$_ver + +for f in $_extra_flavors; do + makedepends="$makedepends linux-$f-dev=$_kpkgver" + subpackages="$subpackages wireguard-$f:_extra" +done + +prepare() { + default_prepare + if [ -z "$FLAVOR" ]; then + ( . "$startdir"/../../main/linux-$_flavor/APKBUILD + [ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver" + [ "$_krel" != "$pkgrel" ] && die "please update _krel to $pkgrel" + return 0 + ) + fi + if [ -z "$FLAVOR" ]; then + ( . "$startdir"/../../community/wireguard-tools/APKBUILD + [ "$_ver" != "$pkgver" ] && die "please update _ver to $pkgver" + [ "$_rel" != "$pkgrel" ] && die "please update _rel 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= kabi= + for flavor in $_flavor $_extra_flavors; do + kabi="$_kver-$_krel-$flavor" + make -C "$srcdir/$flavor"/src \ + KERNELDIR=/lib/modules/$kabi/build module + done +} + +package() { + local kabi="$_kver-$_krel-$_flavor" + install -Dm644 "$srcdir"/$_flavor/src/wireguard.ko \ + "$pkgdir/lib/modules/$kabi/extra/wireguard.ko" +} + +_extra() { + flavor=${subpkgname##*-} + depends="linux-$flavor=$_kpkgver" + install_if="wireguard-tools=$_ver-r$_rel linux-$flavor=$_kpkgver" + pkgdesc="Next generation secure network tunnel: kernel modules for $flavor" + local kabi="$_kver-$_krel-$flavor" + install -Dm644 "$srcdir"/virt/src/wireguard.ko \ + "$subpkgdir/lib/modules/$kabi/extra/wireguard.ko" +} + +sha512sums="e3035030299f5a6ae3ac0c2e35dc2d54745cda8f31185b21c6590f1ddcc9c7a83bf7b71cc71f6d48ed6dc8f2b31f3c704f8fa85685d4113f4c560f7eba7b7d5e WireGuard-0.0.20190406.tar.xz" diff --git a/testing/wireguard-vanilla/APKBUILD b/testing/wireguard-vanilla/APKBUILD deleted file mode 100644 index a98805485a..0000000000 --- a/testing/wireguard-vanilla/APKBUILD +++ /dev/null @@ -1,67 +0,0 @@ -# Contributor: Stuart Cardall <developer@it-offshore.co.uk> -# Maintainer: Stuart Cardall <developer@it-offshore.co.uk> - -# when changing _ver we *must* bump _rel -# we must also match up _toolsrel with wireguard-tools -_name=wireguard -_ver=0.0.20190406 -_rel=0 -_toolsrel=0 - -_flavor=${FLAVOR:-vanilla} -_kpkg=linux-$_flavor -_kver=4.19.41 -_krel=0 - -_kpkgver="$_kver-r$_krel" -_kabi="$_kver-$_krel-$_flavor" - -pkgname=$_name-$_flavor -pkgver=$_kver -pkgrel=$(( $_krel + $_rel )) - -pkgdesc="Next generation secure network tunnel: kernel modules for $_flavor" -arch='all' -url='https://www.wireguard.com' -license="GPL-2.0" -depends="$_kpkg=$_kpkgver" -makedepends="$_kpkg-dev=$_kpkgver libmnl-dev" -install_if="wireguard-tools=$_ver-r$_toolsrel $_kpkg=$_kpkgver" -options="!check" -source="https://git.zx2c4.com/WireGuard/snapshot/WireGuard-$_ver.tar.xz" -builddir="$srcdir"/WireGuard-$_ver - -prepare() { - default_prepare - # verify the kernel version - local _kapkbuild=../../main/linux-$_pkgver/APKBUILD - if [ -f $_kapkbuild ]; then - ( . $_kapkbuild - pkgname=$_name-$_flavor - [ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver" - [ "$_krel" != "$pkgrel" ] && die "please update _krel to $pkgrel" - return 0 - ) - fi -} - -build() { - cd "$builddir" - # only building module: see wireguard-tools for userspace - unset LDFLAGS - make -C src/ \ - KERNELDIR=/lib/modules/$_kabi/build \ - module -} - -package() { - cd "$builddir/src" - - local module= - for module in *.ko; do - install -v -D -m644 ${module} \ - "$pkgdir/lib/modules/$_kabi/extra/${module}" - done -} - -sha512sums="e3035030299f5a6ae3ac0c2e35dc2d54745cda8f31185b21c6590f1ddcc9c7a83bf7b71cc71f6d48ed6dc8f2b31f3c704f8fa85685d4113f4c560f7eba7b7d5e WireGuard-0.0.20190406.tar.xz" |