From ea1127046b2400f3655d1e43e691f44f708afa6b Mon Sep 17 00:00:00 2001
From: kali <kali@leap.se>
Date: Tue, 21 Jul 2020 22:21:45 +0200
Subject: [PATCH] [pkg] check for qtinstaller framework

---
 Makefile | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2ea94586..f867fcd3 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # (c) LEAP Encryption Access Project, 2019-2020
 #########################################################################
 
-.PHONY: all get build icon locales generate_locales clean
+.PHONY: all get build icon locales generate_locales clean check_qtifw HAS-qtifw
 
 XBUILD ?= no
 SKIP_CACHECK ?= no
@@ -28,6 +28,8 @@ SCRIPTS = branding/scripts
 
 all: icon locales helper build
 
+HAS_QTIFW := $(shell PATH=$(PATH) which binarycreator)
+
 
 #########################################################################
 # go build
@@ -79,12 +81,18 @@ else
 	@gui/build.sh
 endif
 
-build_installer: build
-	# TODO check for binarycreator in path
+build_installer: check_qtifw build
 	cp -r qtbuild/release/${PROVIDER}-vpn.app installer/packages/${PROVIDER}vpn/data/
 	cp build/bin/${PLATFORM}/bitmask-helper installer/packages/${PROVIDER}vpn/data/
 	cd installer && qmake && make
 
+check_qtifw: 
+ifdef HAS_QTIFW
+	@echo "[+] Found QTIFW"
+else
+	$(error "[!] Cannot find QTIFW. Please install it and add it to your PATH")
+endif
+
 # ----------- FIXME ------- old build, reuse or delete -----------------------------
 
 CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++"
@@ -113,6 +121,9 @@ _build_xbuild_done:
 # --------- FIXME -----------------------------------------------------------------------
 
 clean:
+	@rm -rf installer/*.app
+	@rm -rf installer/packages/${PROVIDER}vpn/data/*.app
+	@rm -rf installer/packages/${PROVIDER}vpn/data/bitmask-helper
 	@rm -rf build/
 	@unlink branding/assets/default
 
-- 
GitLab