Skip to content

Commit

Permalink
Support Intel Mac architectures (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux authored Jul 14, 2024
1 parent 5a20b67 commit 7153aba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.20240326
0.0.20240714
2 changes: 1 addition & 1 deletion build-platforms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ function make_wg_go() {

make_wg_go "iphoneos" "arm64-apple-ios15.0"
make_wg_go "iphonesimulator" "arm64-apple-ios15.0-simulator"
make_wg_go "macosx" "arm64-apple-macos12.0"
make_wg_go "macosx" "arm64-apple-macos12.0 x86_64-apple-macos12.0"
make_wg_go "appletvos" "arm64-apple-tvos17.0"
make_wg_go "appletvsimulator" "arm64-apple-tvos17.0-simulator"
3 changes: 1 addition & 2 deletions create-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ fi
PLATFORMS_PATH="build"
FRAMEWORK_PATH="$1"

PLATFORMS=("iphoneos" "iphonesimulator" "macosx" "appletvos" "appletvsimulator")
for ARG in ${PLATFORMS[@]}; do
for ARG in `ls $PLATFORMS_PATH`; do
ARGS+="-library $PLATFORMS_PATH/$ARG/libwg-go.a "
ARGS+="-headers $PLATFORMS_PATH/$ARG/Headers "
done
Expand Down
4 changes: 1 addition & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ DESTDIR ?= $(CONFIGURATION_BUILD_DIR)
BUILDDIR ?= $(CONFIGURATION_TEMP_DIR)/wireguard-go-bridge

CFLAGS_PREFIX := -isysroot $(SDKROOT)
GOARCH_arm64 := arm64
GOARCH_x86_64 := amd64
GOOS_macosx := $(if $(IS_CATALYST),ios,darwin)
GOOS_iphoneos := ios
GOOS_iphonesimulator := ios
Expand All @@ -43,7 +41,7 @@ $(BUILDDIR)/libwg-go-$(1).a: export CGO_ENABLED := 1
$(BUILDDIR)/libwg-go-$(1).a: export CGO_CFLAGS := $(CFLAGS_PREFIX) -target $(TARGET)
$(BUILDDIR)/libwg-go-$(1).a: export CGO_LDFLAGS := $(CFLAGS_PREFIX) -target $(TARGET)
$(BUILDDIR)/libwg-go-$(1).a: export GOOS := $(GOOS_$(PLATFORM_NAME))
$(BUILDDIR)/libwg-go-$(1).a: export GOARCH := $(GOARCH_$(1))
$(BUILDDIR)/libwg-go-$(1).a: export GOARCH := $(subst x86_64,amd64,$(word 1, $(subst -, ,$(1))))
$(BUILDDIR)/libwg-go-$(1).a: $(GOROOT)/.prepared go.mod
go build -ldflags=-w -trimpath -v -o "$(BUILDDIR)/libwg-go-$(1).a" -buildmode c-archive
rm -f "$(BUILDDIR)/libwg-go-$(1).h"
Expand Down

0 comments on commit 7153aba

Please sign in to comment.