summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-04 11:55:52 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-12 20:02:47 +0200
commitc0e71902b79ec1b7036d456fcbaa40836afce80f (patch)
tree265adf7f47fa50e4d26ab4cf1b2b478e61601596 /build.sh
parent3b6e3d9b79f93991dfa460abfc9b45bb33f19383 (diff)
[pkg] add qt build script
Signed-off-by: kali kaneko (leap communications) <kali@leap.se>
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..667457c
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,56 @@
+#!/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
+
+
+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
+ QMAKE=`which qmake`
+fi
+
+
+function init {
+ mkdir -p lib
+}
+
+function buildGoLib {
+ echo "[+] Using go in" $GO "[`go version`]"
+ 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:" $QMAKE
+ mkdir -p qtbuild
+ $QMAKE -o qtbuild/Makefile "CONFIG-=debug CONFIG+=release" $PROJECT
+}
+
+echo "[+] Building minimal qml example..."
+
+buildGoLib
+buildQmake
+make -C qtbuild clean
+make -C qtbuild -j4 all