summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-08-06 17:57:18 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2019-08-06 19:39:52 +0200
commit503721070e709324adc7ba4037de33ed5079458f (patch)
treec1e7ef0733a06f172096f7b7cada1a6dd8148322 /Makefile
parent81e9e16e6feaa2833e3544d3fe8d04fda60d009f (diff)
[pkg] squash targets
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile112
1 files changed, 72 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index 4710267..9546aef 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,8 @@
+#########################################################################
+# Multiplatform build and packaging recipes for BitmaskVPN
+# (c) LEAP Encryption Access Project, 2019
+#########################################################################
+
.PHONY: all get build build_bitmaskd icon locales generate_locales clean
TAGS ?= gtk_3_18
@@ -15,6 +20,10 @@ SCRIPTS = "branding/scripts"
all: icon locales get build
+#########################################################################
+# go build
+#########################################################################
+
depends:
-@make depends$(UNAME)
go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray
@@ -34,6 +43,43 @@ get:
go get -tags $(TAGS) ./...
go get -tags "$(TAGS) bitmaskd" ./...
+build: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path)))
+
+build_%:
+ go build -tags $(TAGS) -ldflags "-X main.version=`git describe --tags`" -o $* ./cmd/$*
+ # FIXME does not work in osx
+ # strip $*
+ mkdir -p build/bin
+ mv $* build/bin/
+ mkdir -p build/${PROVIDER}/staging
+ ln -s ../../bin/$* build/${PROVIDER}/staging/$*
+
+test:
+ go test -tags "integration $(TAGS)" ./...
+
+build_bitmaskd:
+ go build -tags "$(TAGS) bitmaskd" -ldflags "-X main.version=`git describe --tags`" ./cmd/*
+
+build_win:
+ powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version" ./cmd/*'
+
+
+clean:
+ rm -f build/${PROVIDER}/bin/bitmask-*
+ unlink branding/assets/default
+
+#########################################################################
+# packaging templates
+#########################################################################
+
+prepare: prepare_templates gen_pkg_win gen_pkg_osx gen_pkg_snap gen_pkg_deb
+
+prepare_templates: generate relink_default tgz
+ mkdir -p build/${PROVIDER}/bin/
+ cp ${TEMPLATES}/makefile/Makefile build/${PROVIDER}/Makefile
+ VERSION=${VERSION} PROVIDER_CONFIG=${PROVIDER_CONFIG} ${SCRIPTS}/generate-vendor-make.py build/${PROVIDER}/vendor.mk
+ ${SCRIPTS}/check-ca-crt.py ${PROVIDER} ${PROVIDER_CONFIG}
+
generate:
go generate cmd/bitmask-vpn/main.go
@@ -43,13 +89,17 @@ ifneq (,$(wildcard ${DEFAULT_PROVIDER}))
endif
cd branding/assets && ln -s ${PROVIDER} default
-prepare: generate relink_default tgz
- mkdir -p build/${PROVIDER}/bin/
- cp ${TEMPLATES}/makefile/Makefile build/${PROVIDER}/Makefile
- VERSION=${VERSION} PROVIDER_CONFIG=${PROVIDER_CONFIG} ${SCRIPTS}/generate-vendor-make.py build/${PROVIDER}/vendor.mk
- ${SCRIPTS}/check-ca-crt.py ${PROVIDER} ${PROVIDER_CONFIG}
- # FIXME trouble in win - better get into repo
- #-@make icon
+TGZ_NAME = bitmask-vpn_${VERSION}-src
+TGZ_PATH = $(shell pwd)/build/${TGZ_NAME}
+tgz:
+ mkdir -p $(TGZ_PATH)
+ git archive HEAD | tar -x -C $(TGZ_PATH)
+ mkdir $(TGZ_PATH)/helpers
+ wget -O $(TGZ_PATH)/helpers/bitmask-root https://0xacab.org/leap/bitmask-dev/raw/master/src/leap/bitmask/vpn/helpers/linux/bitmask-root
+ chmod +x $(TGZ_PATH)/helpers/bitmask-root
+ wget -O $(TGZ_PATH)/helpers/se.leap.bitmask.policy https://0xacab.org/leap/bitmask-dev/raw/master/src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.policy
+ cd build/ && tar cvzf bitmask-vpn_$(VERSION).tgz ${TGZ_NAME}
+ rm -r $(TGZ_PATH)
gen_pkg_win:
mkdir -p build/${PROVIDER}/windows/
@@ -88,46 +138,28 @@ gen_pkg_deb:
cd build/${PROVIDER}/debian && python3 generate.py
cd build/${PROVIDER}/debian && rm app.desktop-template changelog-template rules-template control-template generate.py data.json && chmod +x rules
-gen_pkg_all: prepare gen_pkg_win gen_pkg_osx gen_pkg_snap gen_pkg_deb
-
-build: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path)))
-
-build_%:
- go build -tags $(TAGS) -ldflags "-X main.version=`git describe --tags`" -o $* ./cmd/$*
- # FIXME does not work in osx
- # strip $*
- mkdir -p build/bin
- mv $* build/bin/
- mkdir -p build/${PROVIDER}/staging
- ln -s ../../bin/$* build/${PROVIDER}/staging/$*
+#########################################################################
+# packaging action
+#########################################################################
-test:
- go test -tags "integration $(TAGS)" ./...
+pkg: pkg_win pkg_osx pkg_deb pkg_snap
-build_bitmaskd:
- go build -tags "$(TAGS) bitmaskd" -ldflags "-X main.version=`git describe --tags`" ./cmd/*
+pkg_win:
+ @make -C build/${PROVIDER} pkg_win
-build_win:
- powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version" ./cmd/*'
+pkg_osx:
+ @make -C build/${PROVIDER} pkg_osx
+pkg_deb:
+ @make -C build/${PROVIDER} pkg_deb
-TGZ_NAME = bitmask-vpn_${VERSION}-src
-TGZ_PATH = $(shell pwd)/build/${TGZ_NAME}
-tgz:
- mkdir -p $(TGZ_PATH)
- git archive HEAD | tar -x -C $(TGZ_PATH)
- mkdir $(TGZ_PATH)/helpers
- wget -O $(TGZ_PATH)/helpers/bitmask-root https://0xacab.org/leap/bitmask-dev/raw/master/src/leap/bitmask/vpn/helpers/linux/bitmask-root
- chmod +x $(TGZ_PATH)/helpers/bitmask-root
- wget -O $(TGZ_PATH)/helpers/se.leap.bitmask.policy https://0xacab.org/leap/bitmask-dev/raw/master/src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.policy
- cd build/ && tar cvzf bitmask-vpn_$(VERSION).tgz ${TGZ_NAME}
- rm -r $(TGZ_PATH)
+pkg_snap:
+ @make -C build/${PROVIDER} pkg_snap
-clean:
- make -C icon clean
- rm -f build/${PROVIDER}/bin/bitmask-*
- unlink branding/assets/default
+#########################################################################
+# icons & locales
+#########################################################################
icon:
make -C icon