summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@win>2021-12-14 18:18:16 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-12-14 18:21:32 +0100
commit5d9788388c9cf176a331d1fddc708420d88c4ce5 (patch)
treec85e59d6e63c72201d63067a82a7e6ef07603046
parenta36b1312503d0f5d3e27bd4e296c0c9adb5e492b (diff)
[pkg] bugfixes windows
-rw-r--r--Makefile19
-rwxr-xr-xgui/build.sh7
-rw-r--r--gui/handlers.h4
-rw-r--r--gui/main.cpp19
-rw-r--r--gui/main.qml13
5 files changed, 46 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 8bd0469..d0d4040 100644
--- a/Makefile
+++ b/Makefile
@@ -110,6 +110,16 @@ endif
lib/%.a: $(PKGFILES)
@XBUILD=no CC=${CC} CXX=${CXX} MAKE=${MAKE} AR=${AR} LD=${LD} ./gui/build.sh --just-golib
+# FIXME move platform detection above! no place to uname here, just use $PLATFORM
+#
+MINGGW =
+ifeq ($(UNAME), MINGW64_NT-10.0)
+MINGW = yes
+endif
+ifeq ($(UNAME), MINGW64_NT-10.0-19042)
+MINGW = yes
+endif
+
relink_vendor:
@echo "============RELINK VENDOR============="
@echo "PLATFORM: ${PLATFORM} (${UNAME})"
@@ -117,7 +127,7 @@ relink_vendor:
@echo "PROVIDER: ${PROVIDER}"
ifeq ($(PLATFORM), windows)
@rm -rf providers/assets || true
-ifeq ($(UNAME), MINGW64_NT-10.0)
+ifeq ($(MINGW), yes)
ifeq ($(VENDOR_PATH), providers)
@cp -r providers/${PROVIDER}/assets providers/assets || true
endif
@@ -131,7 +141,6 @@ ifeq ($(VENDOR_PATH), providers)
@ln -s ${PROVIDER}/assets providers/assets || true
endif
endif
-
@echo "============RELINK VENDOR============="
build_golib: lib/libgoshim.a
@@ -226,11 +235,11 @@ endif
@cp "/c/Program Files/OpenVPN/bin/openvpn.exe" ${INST_DATA}
@cp "/c/Program Files/OpenVPN/bin/"*.dll ${INST_DATA}
ifeq (${RELEASE}, yes)
- #@windeployqt --release --qmldir gui/qml ${INST_DATA}${TARGET}.exe
+ #@windeployqt --release --qmldir gui/components ${INST_DATA}${TARGET}.exe
#FIXME -- cannot find platform plugin
- @windeployqt --qmldir gui/qml ${INST_DATA}${TARGET}.exe
+ @windeployqt --qmldir gui/components ${INST_DATA}${TARGET}.exe
else
- @windeployqt --qmldir gui/qml ${INST_DATA}${TARGET}.exe
+ @windeployqt --qmldir gui/components ${INST_DATA}${TARGET}.exe
endif
# TODO stage it to shave some time
@wget ${TAP_WINDOWS} -O ${INST_DATA}/tap-windows.exe
diff --git a/gui/build.sh b/gui/build.sh
index 18d97e1..a9a95fd 100755
--- a/gui/build.sh
+++ b/gui/build.sh
@@ -39,6 +39,11 @@ then
MAKEFLAGS=
fi
+if [ "$CC" == "cc" ]
+then
+ CC="gcc"
+fi
+
if [ "$XBUILD" == "$WIN64" ]
then
# TODO allow to override vars
@@ -60,7 +65,7 @@ function init {
function buildGoLib {
echo "[+] Using go in" $GO "[`go version`]"
- $GO generate -mod=vendor ./pkg/config/version/genver/gen.go || echo "[!] Error on go generate"
+ "$GO" generate -mod=vendor ./pkg/config/version/genver/gen.go || echo "[!] Error on go generate"
if [ "$PLATFORM" == "Darwin" ]
then
diff --git a/gui/handlers.h b/gui/handlers.h
index 82678c0..60ec9d8 100644
--- a/gui/handlers.h
+++ b/gui/handlers.h
@@ -6,6 +6,10 @@
#include "qjsonmodel.h"
#include "lib/libgoshim.h"
+#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN) || defined(__MINGW32__)
+#define OS_WIN
+#endif
+
GoString toGoStr(QString s);
class QJsonWatch : public QObject {
diff --git a/gui/main.cpp b/gui/main.cpp
index 976f2cd..fe96caa 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -46,13 +46,14 @@ QString getAppName(QJsonValue info, QString provider) {
return "BitmaskVPN";
}
-void catchUnixSignals(std::initializer_list<int> quitSignals) {
- auto handler = [](int sig) -> void {
- printf("\nCatched signal(%d): quitting\n", sig);
- Quit();
- QApplication::quit();
- };
+auto handler = [](int sig) -> void {
+ printf("\nCatched signal(%d): quitting\n", sig);
+ Quit();
+ QApplication::quit();
+};
+#ifndef OS_WIN
+void catchUnixSignals(std::initializer_list<int> quitSignals) {
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
@@ -66,6 +67,7 @@ void catchUnixSignals(std::initializer_list<int> quitSignals) {
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
}
+#endif
int main(int argc, char **argv) {
Backend backend;
@@ -80,7 +82,12 @@ int main(int argc, char **argv) {
app.setQuitOnLastWindowClosed(false);
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
+#ifdef OS_WIN
+ signal(SIGINT, handler);
+ signal(SIGTERM, handler);
+#else
catchUnixSignals({SIGINT, SIGTERM});
+#endif
/* load providers json */
QFile providerJson (":/providers.json");
diff --git a/gui/main.qml b/gui/main.qml
index 56220f5..f6660df 100644
--- a/gui/main.qml
+++ b/gui/main.qml
@@ -156,17 +156,22 @@ ApplicationWindow {
}
function loadTheme() {
- let arr = flavor.split("/")
+ var arr
+ if (Qt.platform.os == "windows") {
+ arr = flavor.split("\\")
+ } else {
+ arr = flavor.split("/")
+ }
var providerFlavor = arr[arr.length-1]
console.debug("flavor: " + providerFlavor)
- if (providerFlavor == "riseup-vpn") {
+ if (providerFlavor.startsWith("riseup-vpn")) {
return "themes/Riseup.qml"
- } else if (providerFlavor== "calyx-vpn") {
+ } else if (providerFlavor.startsWith("calyx-vpn")) {
return "themes/Calyx.qml"
} else {
// we should do a Default theme, with a fallback
// mechanism
- return "Riseup.qml"
+ return "themes/Riseup.qml"
}
}