Skip to content
Snippets Groups Projects
Unverified Commit 50372107 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[pkg] squash targets

parent 81e9e16e
No related branches found
No related tags found
No related merge requests found
#########################################################################
# Multiplatform build and packaging recipes for BitmaskVPN
# (c) LEAP Encryption Access Project, 2019
#########################################################################
.PHONY: all get build build_bitmaskd icon locales generate_locales clean .PHONY: all get build build_bitmaskd icon locales generate_locales clean
TAGS ?= gtk_3_18 TAGS ?= gtk_3_18
...@@ -15,6 +20,10 @@ SCRIPTS = "branding/scripts" ...@@ -15,6 +20,10 @@ SCRIPTS = "branding/scripts"
all: icon locales get build all: icon locales get build
#########################################################################
# go build
#########################################################################
depends: depends:
-@make depends$(UNAME) -@make depends$(UNAME)
go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray go get -u golang.org/x/text/cmd/gotext github.com/cratonica/2goarray
...@@ -34,6 +43,43 @@ get: ...@@ -34,6 +43,43 @@ get:
go get -tags $(TAGS) ./... go get -tags $(TAGS) ./...
go get -tags "$(TAGS) bitmaskd" ./... 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: generate:
go generate cmd/bitmask-vpn/main.go go generate cmd/bitmask-vpn/main.go
...@@ -43,13 +89,17 @@ ifneq (,$(wildcard ${DEFAULT_PROVIDER})) ...@@ -43,13 +89,17 @@ ifneq (,$(wildcard ${DEFAULT_PROVIDER}))
endif endif
cd branding/assets && ln -s ${PROVIDER} default cd branding/assets && ln -s ${PROVIDER} default
prepare: generate relink_default tgz TGZ_NAME = bitmask-vpn_${VERSION}-src
mkdir -p build/${PROVIDER}/bin/ TGZ_PATH = $(shell pwd)/build/${TGZ_NAME}
cp ${TEMPLATES}/makefile/Makefile build/${PROVIDER}/Makefile tgz:
VERSION=${VERSION} PROVIDER_CONFIG=${PROVIDER_CONFIG} ${SCRIPTS}/generate-vendor-make.py build/${PROVIDER}/vendor.mk mkdir -p $(TGZ_PATH)
${SCRIPTS}/check-ca-crt.py ${PROVIDER} ${PROVIDER_CONFIG} git archive HEAD | tar -x -C $(TGZ_PATH)
# FIXME trouble in win - better get into repo mkdir $(TGZ_PATH)/helpers
#-@make icon 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: gen_pkg_win:
mkdir -p build/${PROVIDER}/windows/ mkdir -p build/${PROVIDER}/windows/
...@@ -88,46 +138,28 @@ gen_pkg_deb: ...@@ -88,46 +138,28 @@ gen_pkg_deb:
cd build/${PROVIDER}/debian && python3 generate.py 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 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 #########################################################################
# packaging action
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: pkg: pkg_win pkg_osx pkg_deb pkg_snap
go test -tags "integration $(TAGS)" ./...
build_bitmaskd: pkg_win:
go build -tags "$(TAGS) bitmaskd" -ldflags "-X main.version=`git describe --tags`" ./cmd/* @make -C build/${PROVIDER} pkg_win
build_win: pkg_osx:
powershell -Command '$$version=git describe --tags; go build -ldflags "-H windowsgui -X main.version=$$version" ./cmd/*' @make -C build/${PROVIDER} pkg_osx
pkg_deb:
@make -C build/${PROVIDER} pkg_deb
TGZ_NAME = bitmask-vpn_${VERSION}-src pkg_snap:
TGZ_PATH = $(shell pwd)/build/${TGZ_NAME} @make -C build/${PROVIDER} pkg_snap
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)
clean: #########################################################################
make -C icon clean # icons & locales
rm -f build/${PROVIDER}/bin/bitmask-* #########################################################################
unlink branding/assets/default
icon: icon:
make -C icon make -C icon
......
...@@ -8,21 +8,16 @@ BitmaskVPN for your provider. ...@@ -8,21 +8,16 @@ BitmaskVPN for your provider.
Configure Configure
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Copy or edit the file at 'branding/config/vendor.conf'. Add all the needed variables. * 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' * 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. * Make sure that the folder 'branding/assets/<provider>' exists. Copy there all the needed assets.
Checkout Checkout
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
git clone https://0xacab.org/leap/bitmask-vpn git clone https://0xacab.org/leap/bitmask-vpn
cd bitmask-vpn cd bitmask-vpn
git pull --tags git pull --tags
Build
--------------------------------------------------------------------------------
make build
Package Package
...@@ -32,21 +27,25 @@ NOTE: Some of the following scripts need network access, since they will check ...@@ -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 whether the configuration published by your provider matches what is configured
before the build. 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 Alternatively, you can build only for an specific os::
make package_osx
make package_snap
make package_deb
make pkg_win
make pkg_osx
make pkg_snap
make pkg_deb
# 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
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
// Code generated by go generate; DO NOT EDIT. // Code generated by go generate; DO NOT EDIT.
// This file was generated by vendorize.py // This file was generated by vendorize.py
// At 2019-07-30 21:50:50 // At 2019-08-06 16:59:01
package config package config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment