-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jason A. Donenfeld <[email protected]>
- Loading branch information
Showing
7 changed files
with
86 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,9 @@ | |
# Copyright (C) 2018-2019 Jason A. Donenfeld <[email protected]>. All Rights Reserved. | ||
|
||
# These are generally passed to us by xcode, but we set working defaults for standalone compilation too. | ||
ARCHS ?= x86_64 #TODO: add arm64 to this list once we support apple silicon | ||
SDK_NAME ?= macosx | ||
SDKROOT ?= $(shell xcrun --sdk $(SDK_NAME) --show-sdk-path) | ||
ARCHS ?= x86_64 arm64 | ||
PLATFORM_NAME ?= macosx | ||
SDKROOT ?= $(shell xcrun --sdk $(PLATFORM_NAME) --show-sdk-path) | ||
CONFIGURATION_BUILD_DIR ?= $(CURDIR)/out | ||
CONFIGURATION_TEMP_DIR ?= $(CURDIR)/.tmp | ||
|
||
|
@@ -17,6 +17,8 @@ BUILDDIR ?= $(CONFIGURATION_TEMP_DIR)/wireguard-go-bridge | |
CFLAGS_PREFIX := $(if $(DEPLOYMENT_TARGET_CLANG_FLAG_NAME),-$(DEPLOYMENT_TARGET_CLANG_FLAG_NAME)=$($(DEPLOYMENT_TARGET_CLANG_ENV_NAME)),) -isysroot $(SDKROOT) -arch | ||
GOARCH_arm64 := arm64 | ||
GOARCH_x86_64 := amd64 | ||
GOOS_macosx := darwin | ||
GOOS_iphoneos := ios | ||
|
||
build: $(DESTDIR)/libwg-go.a | ||
version-header: $(DESTDIR)/wireguard-go-version.h | ||
|
@@ -34,16 +36,16 @@ define libwg-go-a | |
$(BUILDDIR)/libwg-go-$(1).a: export CGO_ENABLED := 1 | ||
$(BUILDDIR)/libwg-go-$(1).a: export CGO_CFLAGS := $(CFLAGS_PREFIX) $(ARCH) | ||
$(BUILDDIR)/libwg-go-$(1).a: export CGO_LDFLAGS := $(CFLAGS_PREFIX) $(ARCH) | ||
$(BUILDDIR)/libwg-go-$(1).a: export GOOS := darwin | ||
$(BUILDDIR)/libwg-go-$(1).a: export GOOS := $(GOOS_$(PLATFORM_NAME)) | ||
$(BUILDDIR)/libwg-go-$(1).a: export GOARCH := $(GOARCH_$(1)) | ||
$(BUILDDIR)/libwg-go-$(1).a: $(GOROOT)/.prepared go.mod | ||
go build -tags ios -ldflags=-w -trimpath -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive | ||
go build -ldflags=-w -trimpath -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive | ||
rm -f "$(BUILDDIR)/libwg-go-$(1).h" | ||
endef | ||
$(foreach ARCH,$(ARCHS),$(eval $(call libwg-go-a,$(ARCH)))) | ||
|
||
$(DESTDIR)/wireguard-go-version.h: $(GOROOT)/.prepared go.mod | ||
go list -m golang.zx2c4.com/wireguard | sed -n 's/.*v\([0-9.]*\).*/#define WIREGUARD_GO_VERSION "\1"/p' > "$@" | ||
$(DESTDIR)/wireguard-go-version.h: go.mod $(GOROOT)/.prepared | ||
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' "$<" > "$@" | ||
|
||
$(DESTDIR)/libwg-go.a: $(foreach ARCH,$(ARCHS),$(BUILDDIR)/libwg-go-$(ARCH).a) | ||
@mkdir -vp "$(DESTDIR)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
module golang.zx2c4.com/wireguard/ios | ||
module golang.zx2c4.com/wireguard/apple | ||
|
||
go 1.15 | ||
go 1.16 | ||
|
||
require ( | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect | ||
golang.org/x/net v0.0.0-20201216054612-986b41b23924 // indirect | ||
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 | ||
golang.zx2c4.com/wireguard v0.0.20201119-0.20201223215156-09728dc6b340 | ||
golang.org/x/sys v0.0.0-20210308170721-88b6017d0656 | ||
golang.zx2c4.com/wireguard v0.0.0-20210307162820-f4695db51c39 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | ||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= | ||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= | ||
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= | ||
golang.org/x/net v0.0.0-20201216054612-986b41b23924 h1:QsnDpLLOKwHBBDa8nDws4DYNc/ryVW2vCpxCs09d4PY= | ||
golang.org/x/net v0.0.0-20201216054612-986b41b23924/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= | ||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo= | ||
golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210305215415-5cdee2b1b5a0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210308170721-88b6017d0656 h1:FuBaiPCiXkq4v+JY5JEGPU/HwEZwpVyDbu/KBz9fU+4= | ||
golang.org/x/sys v0.0.0-20210308170721-88b6017d0656/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= | ||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||
golang.zx2c4.com/wireguard v0.0.20201119-0.20201223215156-09728dc6b340 h1:X6jrf2sUEj3n+q2oB/I3C088vQFKREz2UzgVJ8wENtI= | ||
golang.zx2c4.com/wireguard v0.0.20201119-0.20201223215156-09728dc6b340/go.mod h1:ITsWNpkFv78VPB7f8MiyuxeEMcHR4jfxHGCJLPP3GHs= | ||
golang.zx2c4.com/wireguard v0.0.0-20210307162820-f4695db51c39 h1:yv331J9aB1fuvxzneUKsRnWyhwK+aj495rADUXSP7Uk= | ||
golang.zx2c4.com/wireguard v0.0.0-20210307162820-f4695db51c39/go.mod h1:ojGPy+9W6ZSM8anL+xC67fvh8zPQJwA6KpFOHyDWLX4= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From aa85e0f90c9031ff5be32296e9fed1637a2eceae Mon Sep 17 00:00:00 2001 | ||
From 516dc0c15ff1ab781e0677606b5be72919251b3e Mon Sep 17 00:00:00 2001 | ||
From: "Jason A. Donenfeld" <[email protected]> | ||
Date: Wed, 9 Dec 2020 14:07:06 +0100 | ||
Subject: [PATCH] runtime: use libc_mach_continuous_time in nanotime on Darwin | ||
|
@@ -18,23 +18,23 @@ Change-Id: Ia3282e8bd86f95ad2b76427063e60a005563f4eb | |
3 files changed, 3 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go | ||
index 06474434c9..6f7ca37122 100644 | ||
index 4a3f2fc453..4a69403b32 100644 | ||
--- a/src/runtime/sys_darwin.go | ||
+++ b/src/runtime/sys_darwin.go | ||
@@ -469,7 +469,7 @@ func setNonblock(fd int32) { | ||
@@ -440,7 +440,7 @@ func setNonblock(fd int32) { | ||
//go:cgo_import_dynamic libc_usleep usleep "/usr/lib/libSystem.B.dylib" | ||
|
||
//go:cgo_import_dynamic libc_mach_timebase_info mach_timebase_info "/usr/lib/libSystem.B.dylib" | ||
-//go:cgo_import_dynamic libc_mach_absolute_time mach_absolute_time "/usr/lib/libSystem.B.dylib" | ||
+//go:cgo_import_dynamic libc_mach_continuous_time mach_continuous_time "/usr/lib/libSystem.B.dylib" | ||
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" | ||
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" | ||
//go:cgo_import_dynamic libc_sigaction sigaction "/usr/lib/libSystem.B.dylib" | ||
//go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "/usr/lib/libSystem.B.dylib" | ||
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s | ||
index 825852d673..5a8b994fb1 100644 | ||
index 630fb5df64..4499c88802 100644 | ||
--- a/src/runtime/sys_darwin_amd64.s | ||
+++ b/src/runtime/sys_darwin_amd64.s | ||
@@ -109,7 +109,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 | ||
@@ -114,7 +114,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 | ||
PUSHQ BP | ||
MOVQ SP, BP | ||
MOVQ DI, BX | ||
|
@@ -44,10 +44,10 @@ index 825852d673..5a8b994fb1 100644 | |
MOVL timebase<>+machTimebaseInfo_numer(SB), SI | ||
MOVL timebase<>+machTimebaseInfo_denom(SB), DI // atomic read | ||
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s | ||
index 585d4f2c64..c556d88730 100644 | ||
index 96d2ed1076..f046545395 100644 | ||
--- a/src/runtime/sys_darwin_arm64.s | ||
+++ b/src/runtime/sys_darwin_arm64.s | ||
@@ -135,7 +135,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) | ||
@@ -143,7 +143,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) | ||
|
||
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$40 | ||
MOVD R0, R19 | ||
|
@@ -57,5 +57,5 @@ index 585d4f2c64..c556d88730 100644 | |
MOVW timebase<>+machTimebaseInfo_numer(SB), R20 | ||
MOVD $timebase<>+machTimebaseInfo_denom(SB), R21 | ||
-- | ||
2.29.2 | ||
2.30.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters