From 4190826c52914bbb82044f53fbebdf54f2c78541 Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Thu, 6 Apr 2023 15:48:58 +0800 Subject: [PATCH 1/2] make `argv[0]` in AppImage reliable to fix configuration file path (#109) --- packages/appimage/01-in-docker.sh | 12 ++++++++---- packages/appimage/AppRun.sh | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 packages/appimage/AppRun.sh diff --git a/packages/appimage/01-in-docker.sh b/packages/appimage/01-in-docker.sh index 59b171df..6d2ce65c 100755 --- a/packages/appimage/01-in-docker.sh +++ b/packages/appimage/01-in-docker.sh @@ -2,6 +2,9 @@ set -xe +VERSION=$(sed -nr -e '/APP_VERSION\s*=/ s/APP_VERSION\s*=\s*(([0-9]+\.)*[0-9]+)\s*/\1/p' /build/RedPanda-CPP/Red_Panda_CPP.pro) +APPIMAGE_FILE=RedPandaIDE-$VERSION-$CARCH.AppImage + # build RedPanda C++ mkdir -p /build/redpanda-build cd /build/redpanda-build @@ -13,18 +16,19 @@ make install INSTALL_ROOT=/build/RedPandaIDE.AppDir # setup AppImage resource cd /build/RedPandaIDE.AppDir -ln -s usr/bin/RedPandaIDE AppRun ln -s usr/share/applications/redpandaide.desktop redpandaide.desktop ln -s usr/share/icons/hicolor/scalable/apps/redpandaide.svg redpandaide.svg -cp /build/RedPanda-CPP/platform/linux/redpandaide.png .DirIcon +# following files may come from Windows filesystem, use `install` to preseve file permission +install -m755 /build/RedPanda-CPP/packages/appimage/AppRun.sh AppRun +install -m644 /build/RedPanda-CPP/platform/linux/redpandaide.png .DirIcon # copy dependency cp /usr/local/bin/alacritty usr/bin # create AppImage cd /build -appimagetool --appimage-extract-and-run RedPandaIDE.AppDir RedPandaIDE-$CARCH.AppImage +appimagetool --appimage-extract-and-run RedPandaIDE.AppDir $APPIMAGE_FILE # copy back to host mkdir -p /build/RedPanda-CPP/dist -cp RedPandaIDE-$CARCH.AppImage /build/RedPanda-CPP/dist +cp $APPIMAGE_FILE /build/RedPanda-CPP/dist diff --git a/packages/appimage/AppRun.sh b/packages/appimage/AppRun.sh new file mode 100755 index 00000000..fcf3e05e --- /dev/null +++ b/packages/appimage/AppRun.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# AppImage runtime set `argv[0]` to AppImage file, which is not reliable. +# Qt framework expects reliable `argv[0]` to locate configuration files. +# This wrapper fixes `argv[0]`. + +exec "$(dirname "$0")/usr/bin/RedPandaIDE" "$@" From d253f7e83ec19a09ecdff635e02c2a34bbd7fcc6 Mon Sep 17 00:00:00 2001 From: AlexN-114 Date: Thu, 13 Apr 2023 04:20:30 +0200 Subject: [PATCH 2/2] Update projectcompiler.cpp (#111) Fixes a problem with generating "Makfile.win" --- RedPandaIDE/compiler/projectcompiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 3837dbf5..b4535601 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -467,12 +467,12 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file) } } - if (fileType==FileType::CppSource || fileType==FileType::CppSource) { + if (fileType==FileType::CSource || fileType==FileType::CppSource) { if (mOnlyCheckSyntax) { if (unit->compileCpp()) writeln(file, "\t$(CPP) -c " + genMakePath1(shortFileName) + " $(CXXFLAGS) " + encodingStr); else - writeln(file, "\t(CC) -c " + genMakePath1(shortFileName) + " $(CFLAGS) " + encodingStr); + writeln(file, "\t$(CC) -c " + genMakePath1(shortFileName) + " $(CFLAGS) " + encodingStr); } else { if (unit->compileCpp()) writeln(file, "\t$(CPP) -c " + genMakePath1(shortFileName) + " -o " + objFileName2 + " $(CXXFLAGS) " + encodingStr);