-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_wireguard_go_bridge.sh
executable file
·42 lines (31 loc) · 1.23 KB
/
build_wireguard_go_bridge.sh
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
34
35
36
37
38
39
40
#!/bin/sh
# build_wireguard_go_bridge.sh - Builds WireGuardKitGo
#
# Figures out the directory where the wireguard-apple SPM package
# is checked out by Xcode (so that it works when building as well as
# archiving), then cd-s to the WireGuardKitGo directory
# and runs make there.
project_data_dir="$BUILD_DIR"
# The wireguard-apple README suggests using ${BUILD_DIR%Build/*}, which
# doesn't seem to work. So here, we do the equivalent in script.
while true; do
parent_dir=$(dirname "$project_data_dir")
basename=$(basename "$project_data_dir")
project_data_dir="$parent_dir"
if [ "$basename" = "Build" ]; then
break
fi
done
# The wireguard-apple README looks into
# SourcePackages/checkouts/wireguard-apple, but Xcode seems to place the
# sources in SourcePackages/checkouts/ so just playing it safe and
# trying both.
checkouts_dir="$project_data_dir"/SourcePackages/checkouts
if [ -e "$checkouts_dir"/wireguard-apple ]; then
checkouts_dir="$checkouts_dir"/wireguard-apple
fi
wireguard_go_dir="$checkouts_dir"/Sources/WireGuardKitGo
# To ensure we have Go in our path, we add where
# Homebrew generally installs executables
cd "$wireguard_go_dir" && /usr/bin/make