summaryrefslogtreecommitdiff
path: root/packages/linux-kernel/build-wireguard.sh
blob: e234933a49a71fcd26fcf715ed993f262de0ac42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
CWD=$(pwd)
KERNEL_VAR_FILE=${CWD}/kernel-vars

WIREGUARD_SRC=${CWD}/wireguard
if [ ! -d ${WIREGUARD_SRC} ]; then
    echo "WireGuard source not found"
    exit 1
fi

if [ ! -f ${KERNEL_VAR_FILE} ]; then
    echo "Kernel variable file '${KERNEL_VAR_FILE}' does not exist, run ./build_kernel.sh first"
    exit 1
fi

. ${KERNEL_VAR_FILE}
cd ${WIREGUARD_SRC}

# We need some WireGuard patches for building, it's easier to have them here
# and make use of the upstream repository instead of maintaining a full fork,
# saving time/resources is essential :-)
PATCH_DIR=${CWD}/patches/wireguard
for patch in $(ls ${PATCH_DIR})
do
    echo "I: Apply WireGuard patch: ${PATCH_DIR}/${patch}"
    patch -p1 < ${PATCH_DIR}/${patch}
done

# set compatibility level to 9
echo 9 > debian/compat

echo "I: Build Debian WireGuard package"
KERNELDIR=$KERNEL_DIR dpkg-buildpackage -b -us -uc -tc -d