Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wireguard][1.0.20210219] - Updated package (and include wireguard-tools) #285

Merged
merged 13 commits into from
Mar 12, 2021
Merged
77 changes: 47 additions & 30 deletions package/wireguard/package
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
pkgnames=(wireguard)
pkgdesc="Fast, modern, secure VPN tunnel"
url=https://www.wireguard.com
_wireguardver=1.0.20201221
pkgver=$_wireguardver-1
timestamp=2020-12-21T11:54Z
pkgver=1.0.20210219-1
_wireguardtoolsver=1.0.20210223
timestamp=2021-02-19T14:08Z
section=utils
maintainer="Jonah Weissman <jonahrweissman+toltec@gmail.com>"
license=GPL-2.0
depends=(wireguard-tools)
license=GPL-2.0-only
makedepends=(build:bc build:lzop build:git)
flags=(nostrip)

Expand All @@ -24,46 +23,64 @@ _defconfigs=(
arch/arm/configs/zero-gravitas_defconfig
arch/arm/configs/zero-sugar_defconfig
)
_moddirs=(
4.9.84-zero-gravitas
4.14.78
)

image=base:v1.3.2
source=(https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-"$_wireguardver".zip)
sha256sums=(c74cedb10c9b830d937b5575e4b7d2625a8534d2c06a80368e5530db23e69d3b)
source=(
"https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-${pkgver%-*}.tar.xz"
"https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${_wireguardtoolsver}.tar.xz"
)
noextract=("wireguard-tools-${_wireguardtoolsver}.tar.xz")
sha256sums=(
99d35296b8d847a0d4db97a4dda96b464311a6354e75fe0bef6e7c4578690f00
1f72da217044622d79e0bab57779e136a3df795e3761a3fc1dc0941a9055877c
)

prepare() {
bsdtar -x \
--directory "$srcdir" \
--file "$srcdir/wireguard-tools-${_wireguardtoolsver}.tar.xz"
mv "$srcdir/wireguard-tools-${_wireguardtoolsver}" "$srcdir/wireguard-tools"
# the symlink at src/wg-quick/wg needs something to point to
touch "$srcdir/wireguard-tools/src/wg"
}

build() {
# we will save the generated files in .pc,
# so that they will not be deleted by `make mrproper`
mkdir .pc
git init
make -C wireguard-tools/src PLATFORM=linux "CC=${CROSS_COMPILE}cc"

mkdir pkg
git init linux
for i in $(seq 0 1); do
git fetch --depth=1 "$_kernelrepo" "${_kernelrevs[$i]}"
git checkout -f "${_kernelrevs[$i]}"
touch .scmversion
cp "${_defconfigs[$i]}" .config
echo "CONFIG_NET_FOU=m" >> .config
make olddefconfig
make modules
make modules_prepare
(
cd linux
git fetch --depth=1 "$_kernelrepo" "${_kernelrevs[$i]}"
git checkout -f "${_kernelrevs[$i]}"
make mrproper
touch .scmversion
cp "${_defconfigs[$i]}" .config
echo "CONFIG_NET_FOU=m" >> .config
make olddefconfig
make net/ipv4/udp_tunnel.ko
make net/ipv6/ip6_udp_tunnel.ko
make modules_prepare
)

# make wireguard.ko
KERNELDIR=$(pwd) make -C src/
export MOD_INSTALL_PATH=".pc/${_moddirs[$i]}"
install -D -m 644 net/ipv4/udp_tunnel.ko \
make -C src/ "KERNELDIR=$(realpath linux)"
KERNELRELEASE=$(cat linux/include/config/kernel.release)
export MOD_INSTALL_PATH="pkg/$KERNELRELEASE"
install -D -m 644 linux/net/ipv4/udp_tunnel.ko \
"$MOD_INSTALL_PATH/kernel/net/ipv4/udp_tunnel.ko"
install -D -m 644 net/ipv6/ip6_udp_tunnel.ko \
install -D -m 644 linux/net/ipv6/ip6_udp_tunnel.ko \
"$MOD_INSTALL_PATH/kernel/net/ipv6/ip6_udp_tunnel.ko"
install -D -m 644 src/wireguard.ko \
"$MOD_INSTALL_PATH/extra/wireguard.ko"
make mrproper
done
}

package() {
make -C "$srcdir/wireguard-tools/src" DESTDIR="$pkgdir" WITH_WGQUICK=yes \
WITH_SYSTEMDUNITS=yes WITH_BASHCOMPLETION=no install
mkdir -p "$pkgdir/lib/modules"
cp -r "$srcdir/.pc"/* "$pkgdir/lib/modules"
cp -r "$srcdir/pkg"/* "$pkgdir/lib/modules"
}

configure() {
Expand Down