From 5710ad8079b2f39be35a21cd2550b53a1ba431c4 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 15 May 2020 09:00:49 -0400 Subject: [PATCH] ft: AppImage --- .gitignore | 3 +- AppRun | 5 +++ Makefile | 40 ++++++++++++++----- start-docker.sh => build-linux.sh | 2 +- ...-in-docker.sh => docker-linux-app-image.sh | 4 +- 5 files changed, 40 insertions(+), 14 deletions(-) create mode 100755 AppRun rename start-docker.sh => build-linux.sh (85%) rename build-in-docker.sh => docker-linux-app-image.sh (91%) diff --git a/.gitignore b/.gitignore index e50f09fd82..97567a7a98 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ noBackup/ .vscode bin/ vendor/.nimble -*.AppImage \ No newline at end of file +*.AppImage +tmp \ No newline at end of file diff --git a/AppRun b/AppRun new file mode 100755 index 0000000000..839782f2a2 --- /dev/null +++ b/AppRun @@ -0,0 +1,5 @@ +#!/bin/bash +APPDIR="$(dirname "$(readlink -f "${0}")")" +export LD_LIBRARY_PATH=${APPDIR}/usr/lib/:$LD_LIBRARY_PATH + +exec "${APPDIR}/usr/bin/nim_status_client" "$@" \ No newline at end of file diff --git a/Makefile b/Makefile index ee8d2a3efb..6567103d99 100644 --- a/Makefile +++ b/Makefile @@ -59,13 +59,13 @@ deps: | deps-common update: | update-common -DEPLOYQT := linuxdeployqt-continuous-x86_64.AppImage +DOTHERSIDE := vendor/DOtherSide/build/lib/libDOtherSide.so -$(DEPLOYQT): - wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/$(DEPLOYQT) - chmod +x $(DEPLOYQT) +APPIMAGETOOL := appimagetool-x86_64.AppImage -DOTHERSIDE := vendor/DOtherSide/build/lib/libDOtherSideStatic.a +$(APPIMAGETOOL): + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/$(APPIMAGETOOL) + chmod +x $(APPIMAGETOOL) $(DOTHERSIDE): | deps echo -e $(BUILD_MSG) "DOtherSide" @@ -85,23 +85,45 @@ $(STATUSGO): | deps build-linux: $(DOTHERSIDE) $(STATUSGO) src/nim_status_client.nim | deps echo -e $(BUILD_MSG) "$@" && \ - $(ENV_SCRIPT) nim c -L:$(STATUSGO) -d:ssl -L:-lm -L:-Lvendor/DOtherSide/build/lib/ $(NIM_PARAMS) --outdir:./bin src/nim_status_client.nim + $(ENV_SCRIPT) nim c -d:nimDebugDlOpen -L:$(STATUSGO) -d:ssl -L:-lm $(NIM_PARAMS) -L:-LlibDOtherSide.so --outdir:./bin src/nim_status_client.nim build-macos: $(DOTHERSIDE) $(STATUSGO) src/nim_status_client.nim | deps echo -e $(BUILD_MSG) "$@" && \ - $(ENV_SCRIPT) nim c -L:$(STATUSGO) -d:ssl -L:-lm -L:"-framework Foundation -framework Security -framework IOKit -framework CoreServices" -L:-Lvendor/DOtherSide/build/lib/ $(NIM_PARAMS) --outdir:./bin src/nim_status_client.nim + $(ENV_SCRIPT) nim c -d:nimDebugDlOpen -L:$(STATUSGO) -d:ssl -L:-lm -L:"-framework Foundation -framework Security -framework IOKit -framework CoreServices" $(NIM_PARAMS) -L:-LlibDOtherSide.so --outdir:./bin src/nim_status_client.nim APPIMAGE := NimStatusClient-x86_64.AppImage -$(APPIMAGE): $(DEFAULT_TARGET) $(DEPLOYQT) nim-status.desktop +$(APPIMAGE): $(DEFAULT_TARGET) $(APPIMAGETOOL) nim-status.desktop rm -rf tmp/dist mkdir -p tmp/dist/usr/bin + mkdir -p tmp/dist/usr/lib + mkdir -p tmp/dist/usr/qml + + # General Files cp bin/nim_status_client tmp/dist/usr/bin cp nim-status.desktop tmp/dist/. cp status.svg tmp/dist/status.svg cp -R ui tmp/dist/usr/. + + # Libraries + cp vendor/DOtherSide/build/lib/libDOtherSide* tmp/dist/usr/lib/. + + # QML Plugins due to bug with linuxdeployqt finding qmlimportscanner + # This list is obtained with qmlimportscanner -rootPath ui/ -importPath /opt/qt/5.12.6/gcc_64/qml/ + mkdir -p tmp/dist/usr/qml/Qt/labs/ + mkdir -p tmp/dist/usr/qml/QtQuick + cp -R /opt/qt/5.12.6/gcc_64/qml/Qt/labs/platform tmp/dist/usr/qml/Qt/labs/. + cp -R /opt/qt/5.12.6/gcc_64/qml/QtQuick.2 tmp/dist/usr/qml/. + cp -R /opt/qt/5.12.6/gcc_64/qml/QtGraphicalEffects tmp/dist/usr/qml/. + cp -R /opt/qt/5.12.6/gcc_64/qml/QtQuick/{Controls,Controls.2,Extras,Layouts,Templates.2,Window.2} tmp/dist/usr/qml/QtQuick/. + echo -e $(BUILD_MSG) "AppImage" - ./$(DEPLOYQT) tmp/dist/nim-status.desktop -no-translations -no-copy-copyright-files -appimage + linuxdeployqt tmp/dist/nim-status.desktop -no-translations -no-copy-copyright-files -qmldir=tmp/dist/usr/ui -bundle-non-qt-libs + + rm tmp/dist/AppRun + cp AppRun tmp/dist/. + + ./$(APPIMAGETOOL) tmp/dist appimage: $(APPIMAGE) diff --git a/start-docker.sh b/build-linux.sh similarity index 85% rename from start-docker.sh rename to build-linux.sh index 743b288664..dfec84a0af 100755 --- a/start-docker.sh +++ b/build-linux.sh @@ -5,4 +5,4 @@ docker run -it --rm --device /dev/fuse \ --cap-add SYS_ADMIN \ --privileged \ a12e/docker-qt:5.12-gcc_64 \ - sh build-in-docker.sh + sh docker-linux-app-image.sh diff --git a/build-in-docker.sh b/docker-linux-app-image.sh similarity index 91% rename from build-in-docker.sh rename to docker-linux-app-image.sh index c46ee192da..dbe4170c35 100755 --- a/build-in-docker.sh +++ b/docker-linux-app-image.sh @@ -8,7 +8,7 @@ sudo apt update sudo apt install -y --fix-missing cmake build-essential git libpcre3-dev libssl-dev git rm -Rf tmp -make -j2 clean +make clean # Installing GO # Probably should be part of a dockerfile @@ -24,6 +24,4 @@ export LD_LIBRARY_PATH="$(echo /opt/qt/*/gcc_64/lib/)" make appimage -rm -f linuxdeployqt-continuous-x86_64.AppImage - rm -Rf tmp \ No newline at end of file