Skip to content

Instantly share code, notes, and snippets.

@n0toose
Created March 21, 2020 08:53
Show Gist options
  • Save n0toose/bc45c3d6c6fc34bfe0e3a3fc7cfa1a0d to your computer and use it in GitHub Desktop.
Save n0toose/bc45c3d6c6fc34bfe0e3a3fc7cfa1a0d to your computer and use it in GitHub Desktop.
Monolithic Wireguard PKGBUILD that I used for Arch Linux ARM (for the Raspberry Pi 4, which doesn't have a 5.6-based kernel right now)
# based on https://github.com/graysky's PKGBUILD
# https://archlinuxarm.org/forum/viewtopic.php?f=15&t=13957
pkgbase=wireguard
pkgname=(wireguard-module wireguard-tools)
pkgver=0.0.20191219
pkgrel=1
_pkgname=WireGuard
pkgdesc='next generation secure network tunnel'
arch=('x86_64' 'aarch64' 'armv7h')
url='http://www.wireguard.com/'
license=('GPL')
makedepends=('libmnl' 'linux-raspberrypi4-headers')
validpgpkeys=('AB9942E6D4A4CFC3412620A749FC7012A5DE03AE')
# for some reason, this wouldn't work for me, so i used makepkg -si --skippgpcheck
source=("https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${pkgver}.tar"{.xz,.asc})
sha256sums=('SKIP')
# look at ls `/usr/lib/modules`
_extramodules=4.19-raspberrypi4
prepare() {
cd WireGuard-${pkgver}/
find contrib/examples/ -name '.gitignore' -delete
# get currently installed KERNELDIR
export _RIGHTPATH=$(cat /usr/lib/modules/extramodules-$_extramodules/version)
}
build() {
cd WireGuard-${pkgver}/
make -C src KERNELDIR="/lib/modules/$_RIGHTPATH/build"
}
package_wireguard-module() {
provides=('WIREGUARD-MODULE')
cd "$_pkgname-$pkgver"
xz src/wireguard.ko
install -Dm644 src/wireguard.ko.xz "$pkgdir/usr/lib/modules/extramodules-$_extramodules/wireguard.ko.xz"
}
package_wireguard-tools() {
depends=('libmnl')
cd WireGuard-${pkgver}/
make -C src/tools/ \
DESTDIR="${pkgdir}/" \
WITH_BASHCOMPLETION=yes \
WITH_WGQUICK=yes \
WITH_SYSTEMDUNITS=yes install
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment