Skip to content

Commit bc51772

Browse files
Merge branch 'master' of github.com:safehousetech/wireguard-apple into task/bug-fixes
2 parents 6cbb0ed + 5117b33 commit bc51772

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

Sources/WireGuardKitC/module.modulemap

Lines changed: 0 additions & 4 deletions
This file was deleted.

Sources/WireGuardKitGo/Makefile

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PLATFORM_NAME ?= macosx
88
SDKROOT ?= $(shell xcrun --sdk $(PLATFORM_NAME) --show-sdk-path)
99
CONFIGURATION_BUILD_DIR ?= $(CURDIR)/out
1010
CONFIGURATION_TEMP_DIR ?= $(CURDIR)/.tmp
11+
CACHE_ROOT ?= $(CURDIR)/.cache
1112

1213
export PATH := $(PATH):/usr/local/bin:/opt/homebrew/bin
1314
export CC ?= clang
@@ -21,29 +22,36 @@ GOARCH_x86_64 := amd64
2122
GOOS_macosx := darwin
2223
GOOS_iphoneos := ios
2324

24-
GO_VERSION := 1.20.2
25+
GO_VERSION := 1.20.3
2526
GO_PLATFORM := $(shell uname -s | tr '[:upper:]' '[:lower:]')-$(GOARCH_$(shell uname -m))
2627
GO_TARBALL := go$(GO_VERSION).$(GO_PLATFORM).tar.gz
27-
GO_HASH_darwin-amd64 := c93b8ced9517d07e1cd4c362c6e2d5242cb139e29b417a328fbf19aded08764c
28-
GO_HASH_darwin-arm64 := 7343c87f19e79c0063532e82e1c4d6f42175a32d99f7a4d15e658e88bf97f885
28+
GO_HASH_darwin-amd64 := c1e1161d6d859deb576e6cfabeb40e3d042ceb1c6f444f617c3c9d76269c3565
29+
GO_HASH_darwin-arm64 := 86b0ed0f2b2df50fa8036eea875d1cf2d76cefdacf247c44639a1464b7e36b95
30+
GO_ROOT := $(BUILDDIR)/go-$(GO_VERSION)
31+
32+
33+
UNAME := $(shell uname -m)
34+
ifeq ($(UNAME), $(GOARCH_arm64))
35+
GOOS_iphonesimulator := ios
36+
endif
2937

3038
build: $(DESTDIR)/libwg-go.a
3139
version-header: $(DESTDIR)/wireguard-go-version.h
3240

33-
$(BUILDDIR)/$(GO_TARBALL):
34-
mkdir -p "$(@D)"
41+
$(CACHE_ROOT)/$(GO_TARBALL):
42+
mkdir -p "$(dir $@)"
3543
flock "$@.lock" -c ' \
3644
[ -f "$@" ] && exit 0; \
37-
curl -o "$@.tmp" "https://dl.google.com/go/$(GO_TARBALL)" && \
38-
echo "$(GO_HASH_$(GO_PLATFORM)) $@.tmp" | sha256sum -c && \
45+
wget -O "$@.tmp" "https://go.dev/dl/$(GO_TARBALL)" && \
46+
echo "$(GO_HASH_$(GO_PLATFORM)) $@.tmp" | sha256sum -c && \
3947
mv "$@.tmp" "$@"'
4048

41-
$(BUILDDIR)/go-$(GO_VERSION)/.prepared: $(BUILDDIR)/$(GO_TARBALL)
42-
mkdir -p "$(@D)"
49+
$(GO_ROOT)/.prepared: $(CACHE_ROOT)/$(GO_TARBALL)
50+
mkdir -p "$(dir $@)"
4351
flock "$@.lock" -c ' \
4452
[ -f "$@" ] && exit 0; \
45-
tar -C "$(@D)" --strip-components=1 -xzf "$^" && \
46-
patch -p1 -f -N -r- -d "$(@D)" < goruntime-boottime-over-monotonic.diff && \
53+
tar -C "$(dir $@)" --strip-components=1 -xzf "$^" && \
54+
patch -p1 -f -N -r- -d "$(dir $@)" < goruntime-boottime-over-monotonic.diff && \
4755
touch "$@"'
4856

4957
define libwg-go-a
@@ -52,16 +60,16 @@ $(BUILDDIR)/libwg-go-$(1).a: export CGO_CFLAGS := $(CFLAGS_PREFIX) $(ARCH)
5260
$(BUILDDIR)/libwg-go-$(1).a: export CGO_LDFLAGS := $(CFLAGS_PREFIX) $(ARCH)
5361
$(BUILDDIR)/libwg-go-$(1).a: export GOOS := $(GOOS_$(PLATFORM_NAME))
5462
$(BUILDDIR)/libwg-go-$(1).a: export GOARCH := $(GOARCH_$(1))
55-
$(BUILDDIR)/libwg-go-$(1).a: $(BUILDDIR)/go-$(GO_VERSION)/.prepared go.mod
63+
$(BUILDDIR)/libwg-go-$(1).a: $(GO_ROOT)/.prepared go.mod
5664
go build -ldflags=-w -trimpath -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive
5765
$(RM) "$(BUILDDIR)/libwg-go-$(1).h"
5866
endef
5967
$(foreach ARCH,$(ARCHS),$(eval $(call libwg-go-a,$(ARCH))))
6068

61-
$(DESTDIR)/wireguard-go-version.h: $(BUILDDIR)/go-$(GO_VERSION)/.prepared go.mod
69+
$(DESTDIR)/wireguard-go-version.h: go.mod $(GO_ROOT)/.prepared
6270
sed -E -n 's/.*golang\.zx2c4\.com\/wireguard +v[0-9.]+-[0-9]+-([0-9a-f]{8})[0-9a-f]{4}.*/#define WIREGUARD_GO_VERSION "\1"/p' "$<" > "$@"
6371

64-
$(DESTDIR)/llibwg-go.a: export PATH := $(BUILDDIR)/go-$(GO_VERSION)/bin/:$(PATH)
72+
$(DESTDIR)/libwg-go.so: export PATH := $(GO_ROOT)/bin/:$(PATH)
6573
$(DESTDIR)/libwg-go.a: $(foreach ARCH,$(ARCHS),$(BUILDDIR)/libwg-go-$(ARCH).a)
6674
@mkdir -vp "$(DESTDIR)"
6775
$(LIPO) -create -output "$@" $^

Sources/WireGuardKitGo/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ require (
1313
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
1414
)
1515

16-
replace golang.zx2c4.com/wireguard => github.com/safehousetech/wireguard-go v0.0.20200321-0.20230312122755-9baf4cf4bcfe
16+
replace golang.zx2c4.com/wireguard => github.com/safehousetech/wireguard-go v0.0.20200321-0.20230605164738-ea0487879628

Sources/WireGuardKitGo/go.sum

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
github.com/safehousetech/wireguard-go v0.0.20200321-0.20230312122755-9baf4cf4bcfe h1:bJa/tvY3WzosYZDRKLdcny+LHgyZAI6vb5G1x+w4ZwY=
2-
github.com/safehousetech/wireguard-go v0.0.20200321-0.20230312122755-9baf4cf4bcfe/go.mod h1:/cGaDZu50FGgriJHC1uFoOXocaYvRYIMnqhPodJKFiQ=
1+
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
2+
github.com/safehousetech/wireguard-go v0.0.20200321-0.20230605164738-ea0487879628 h1:ugc7fiwXc+pwFyWGM9r938G1xrByo/lwDmvI/wMRTDU=
3+
github.com/safehousetech/wireguard-go v0.0.20200321-0.20230605164738-ea0487879628/go.mod h1:tqur9LnfstdR9ep2LaJT4lFUl0EjlHtge+gAjmsHUG4=
34
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
45
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
56
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
67
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
78
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
89
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10+
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
911
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
1012
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
13+
gvisor.dev/gvisor v0.0.0-20221203005347-703fd9b7fbc0 h1:Wobr37noukisGxpKo5jAsLREcpj61RxrWYzD8uwveOY=

0 commit comments

Comments
 (0)