From c42e380e9b1ad99aa0920442460e5292b4065d47 Mon Sep 17 00:00:00 2001 From: jinjiaodawang Date: Mon, 12 Feb 2024 17:18:34 +0800 Subject: [PATCH 1/2] fix_building_issues_under_macos --- README.md | 22 +++++++++++++++++++--- build_mac.sh | 11 +++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) mode change 100644 => 100755 build_mac.sh diff --git a/README.md b/README.md index dbdaff5a9..00ee21f42 100644 --- a/README.md +++ b/README.md @@ -151,13 +151,29 @@ build_windows.bat ``` ### Mac -1. Install Xcode and Qt 5. -2. Clone the repository and build: +1. Uninstall previous Qt6 installed by Homebrew +2. Install Xcode. +3. Install Qt6. +``` +pip install aqtinstall +cd /path/to/qt +aqt install-qt mac desktop 6.6.1 clang_64 -m all +export Qt6_DIR=/path/to/qt/6.6.1/macos/ +export QT_PLUGIN_PATH=/path/to/qt/6.6.1/macos/plugins +export PKG_CONFIG_PATH=/path/to/qt/6.6.1/macos/lib/pkgconfig +export QML2_IMPORT_PATH=/path/to/qt/6.6.1/macos/qml +export PATH="/path/to/qt/6.6.1/macos/bin:$PATH" +``` +4. Clone the repository, build and install: ``` git clone --recursive https://github.com/ahrm/sioyek cd sioyek chmod +x build_mac.sh -./build_mac.sh +setopt PIPE_FAIL PRINT_EXIT_VALUE ERR_RETURN SOURCE_TRACE XTRACE +MAKE_PARALLEL=8 ./build_mac.sh + +mv build/sioyek.app /Applications/ +sudo codesign --force --sign - --deep /Applications/sioyek.app ``` ## Donation diff --git a/build_mac.sh b/build_mac.sh old mode 100644 new mode 100755 index 38b7e7af2..c2f8587fd --- a/build_mac.sh +++ b/build_mac.sh @@ -34,5 +34,16 @@ cp pdf_viewer/keys.config build/sioyek.app/Contents/MacOS/keys.config cp pdf_viewer/keys_user.config build/sioyek.app/Contents/MacOS/keys_user.config cp tutorial.pdf build/sioyek.app/Contents/MacOS/tutorial.pdf +# Capture the current PATH +CURRENT_PATH=$(echo $PATH) + +# Define the path to the Info.plist file inside the app bundle +INFO_PLIST="build/sioyek.app/Contents/Info.plist" + +# Add LSEnvironment key with PATH to Info.plist +/usr/libexec/PlistBuddy -c "Add :LSEnvironment dict" "$INFO_PLIST" || echo "LSEnvironment already exists" +/usr/libexec/PlistBuddy -c "Add :LSEnvironment:PATH string $CURRENT_PATH" "$INFO_PLIST" || /usr/libexec/PlistBuddy -c "Set :LSEnvironment:PATH $CURRENT_PATH" "$INFO_PLIST" + macdeployqt build/sioyek.app -dmg zip -r sioyek-release-mac.zip build/sioyek.dmg +codesign --force --deep --sign - build/sioyek.app From bac3f9e2e83f51183c5088e2cd4eaeed8c7f9cd8 Mon Sep 17 00:00:00 2001 From: jinjiaodawang Date: Mon, 12 Feb 2024 17:22:44 +0800 Subject: [PATCH 2/2] remove_codesign_from_build_script --- build_mac.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_mac.sh b/build_mac.sh index c2f8587fd..cac27e27e 100755 --- a/build_mac.sh +++ b/build_mac.sh @@ -46,4 +46,3 @@ INFO_PLIST="build/sioyek.app/Contents/Info.plist" macdeployqt build/sioyek.app -dmg zip -r sioyek-release-mac.zip build/sioyek.dmg -codesign --force --deep --sign - build/sioyek.app