diff options
-rw-r--r-- | Makefile | 112 | ||||
-rw-r--r-- | branding/README.rst (renamed from branding/README.txt) | 43 | ||||
-rw-r--r-- | docker/Dockerfile | 25 | ||||
-rw-r--r-- | docker/Makefile | 10 | ||||
-rw-r--r-- | pkg/config/config.go | 2 |
5 files changed, 129 insertions, 63 deletions
@@ -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 diff --git a/branding/README.txt b/branding/README.rst index c3d9482..86423cc 100644 --- a/branding/README.txt +++ b/branding/README.rst @@ -8,21 +8,16 @@ BitmaskVPN for your provider. Configure -------------------------------------------------------------------------------- -- Copy or edit the file at 'branding/config/vendor.conf'. Add all the needed variables. -- Copy your provider CA certificate to the same folder: 'branding/config/<provider>-ca.crt' -- Make sure that the folder 'branding/assets/<provider>' exists. Copy there all the needed assets. +* Copy or edit the file at 'branding/config/vendor.conf'. Add all the needed variables. +* Copy your provider CA certificate to the same folder: 'branding/config/<provider>-ca.crt' +* Make sure that the folder 'branding/assets/<provider>' exists. Copy there all the needed assets. Checkout -------------------------------------------------------------------------------- -git clone https://0xacab.org/leap/bitmask-vpn -cd bitmask-vpn -git pull --tags - -Build --------------------------------------------------------------------------------- - -make build + git clone https://0xacab.org/leap/bitmask-vpn + cd bitmask-vpn + git pull --tags Package @@ -32,21 +27,25 @@ NOTE: Some of the following scripts need network access, since they will check whether the configuration published by your provider matches what is configured before the build. -Run: +Run:: + + PROVIDER=example make prepare + +You can also specify a custom config file:: -PROVIDER=example make prepare_all + PROVIDER=example PROVIDER_CONFIG=/path/to/vendor.conf make prepare -You can also specify a cusom config file: +Then you need to build the package:: -PROVIDER=example PROVIDER_CONFIG=/path/to/vendor.conf make prepare_all -make build + make build -After this, you will find the build scripts ready in the following folder: +Then you can build all the packages:: -cd build/example + make pkg -make package_win -make package_osx -make package_snap -make package_deb +Alternatively, you can build only for an specific os:: + make pkg_win + make pkg_osx + make pkg_snap + make pkg_deb diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..89df450 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +# An image to build and package the Bitmask Lite (RiseupVPN and other branded builds) +# (c) LEAP Encryption Access Project 2018 +FROM ubuntu:disco + +MAINTAINER LEAP Encryption Access Project <info@leap.se> +LABEL Description="An image to build Bitmask Lite" Vendor="LEAP" Version="1.1" + +RUN apt update && apt upgrade -y + +# Install all the deps for building and packaging bitmask-vpn + +RUN apt install -y --no-install-recommends \ + build-essential \ + make \ + git curl wget \ + golang libappindicator3-dev libgtk-3-dev \ + mingw-w64 upx-ucl python snapcraft \ + unzip \ + devscripts fakeroot debhelper dh-golang golang-golang-x-text-dev + +# we need nsis >= 3.0 +RUN echo 'deb http://archive.ubuntu.com/ubuntu cosmic universe' >> /etc/apt/sources.list +RUN apt update +RUN apt install -y --no-install-recommends -t cosmic nsis + diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 0000000..3cd76f1 --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,10 @@ +IMAGE=bitmask-vpn + +build: + docker build -t 0xacab.org:4567/leap/docker/$(IMAGE):latest . +push: + docker push 0xacab.org:4567/leap/docker/$(IMAGE):latest +prune: + docker system prune +login: + docker login 0xacab.org:4567 diff --git a/pkg/config/config.go b/pkg/config/config.go index dd13c8b..0841e26 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,6 +1,6 @@ // Code generated by go generate; DO NOT EDIT. // This file was generated by vendorize.py -// At 2019-07-30 21:50:50 +// At 2019-08-06 16:59:01 package config |