From 29e514d384a40b135923f76aca2406b6a3091198 Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Tue, 6 Aug 2019 15:36:31 -0400
Subject: [PATCH] [pkg] Add cross compilation for win and osx

---
 Makefile                             | 8 ++++++++
 branding/templates/makefile/Makefile | 2 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 494ba36d..7b980b13 100644
--- a/Makefile
+++ b/Makefile
@@ -63,6 +63,14 @@ build_bitmaskd:
 build_win:
 	powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version" ./cmd/*'
 
+CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++"
+build_cross_win:
+	$(CROSS_WIN_FLAGS) $(MAKE) build
+
+CROSS_OSX_FLAGS = MACOSX_DEPLOYMENT_TARGET=10.10 CGO_ENABLED=1 GOOS=darwin CC="o64-clang"
+build_cross_osx:
+	$(CROSS_OSX_FLAGS) $(MAKE) build
+
 
 clean:
 	@rm -rf build/
diff --git a/branding/templates/makefile/Makefile b/branding/templates/makefile/Makefile
index 1b1bd704..9612190d 100755
--- a/branding/templates/makefile/Makefile
+++ b/branding/templates/makefile/Makefile
@@ -21,8 +21,6 @@ DEB_VERSION = $(shell echo ${VERSION} | cut -d '-' -f 1,2)
 # -----------------------------------------------------------------------------
 # Windows 
 # -----------------------------------------------------------------------------
-CROSS_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++"
-
 openvpn_win:
 	if not exist staging\openvpn mkdir staging\openvpn
 	wget https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe -O staging/openvpn/tap-windows.exe
-- 
GitLab