summaryrefslogtreecommitdiff
path: root/gui/build.sh
diff options
context:
space:
mode:
authorkali <kali@win>2020-09-25 17:46:50 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-09-25 21:00:08 +0200
commit5d102497e80f17056ce97bcc58a4906cf8a05c28 (patch)
tree3052ed39a403fc4f73d7d73f60597caaca9d2a75 /gui/build.sh
parent5518645dfdfd1250dcabd98bda5d71d18eb4edcc (diff)
[bug] workaround for helper path in windows
Diffstat (limited to 'gui/build.sh')
-rw-r--r--gui/build.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/gui/build.sh b/gui/build.sh
new file mode 100644
index 0000000..1ded17e
--- /dev/null
+++ b/gui/build.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+set -e
+
+
+XBUILD=${XBUILD-no}
+WIN64="win64"
+GO=`which go`
+
+PROJECT=bitmask.pro
+TARGET_GOLIB=lib/libgoshim.a
+SOURCE_GOLIB=gui/backend.go
+
+RELEASE=qtbuild/release
+
+if [ "$TARGET" == "" ]
+then
+ TARGET=riseup-vpn
+fi
+
+if [ "$XBUILD" == "$WIN64" ]
+then
+ # TODO allow to override vars
+ QMAKE="`pwd`/../mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qmake"
+ PATH="`pwd`/../mxe/usr/bin"/:$PATH
+ CC=x86_64-w64-mingw32.static-gcc
+else
+ if [ "$QMAKE" == "" ]
+ then
+ QMAKE=`which qmake`
+ fi
+fi
+
+
+function init {
+ mkdir -p lib
+}
+
+function buildGoLib {
+ echo "[+] Using go in" $GO "[`go version`]"
+ $GO generate ./pkg/config/version/genver/gen.go
+ if [ "$XBUILD" == "no" ]
+ then
+ echo "[+] Building Go library with standard Go compiler"
+ CGO_ENABLED=1 go build -buildmode=c-archive -o $TARGET_GOLIB $SOURCE_GOLIB
+ fi
+ if [ "$XBUILD" == "$WIN64" ]
+ then
+ echo "[+] Building Go library with mxe"
+ echo "[+] Using cc:" $CC
+ CC=$CC CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-archive -o $TARGET_GOLIB $SOURCE_GOLIB
+ fi
+}
+
+function buildQmake {
+ echo "[+] Now building Qml app with Qt qmake"
+ echo "[+] Using qmake in:" $QMAKE
+ mkdir -p qtbuild
+ $QMAKE -o qtbuild/Makefile "CONFIG-=debug CONFIG+=release" $PROJECT
+}
+
+echo "[+] Building BitmaskVPN"
+
+lrelease bitmask.pro
+buildGoLib
+buildQmake
+make -C qtbuild clean
+make -C qtbuild -j4 all
+
+# i would expect that passing QMAKE_TARGET would produce the right output, but nope.
+mv qtbuild/release/bitmask $RELEASE/$TARGET
+strip $RELEASE/$TARGET
+echo "[+] Binary is in" $RELEASE/$TARGET