Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package build for Qt6 for MacOS #2195

Open
vkbo opened this issue Jan 16, 2025 · 7 comments
Open

Update package build for Qt6 for MacOS #2195

vkbo opened this issue Jan 16, 2025 · 7 comments
Labels
packaging Component: Packaging and installing

Comments

@vkbo
Copy link
Owner

vkbo commented Jan 16, 2025

Update the MacOS package to build for PyQt6/Qt6.

This requires extra attention to the cleanup of redundant dependencies, and also needs to validate that Enchant spell checking still works on MacOS. I know there has been an issue with it.

@vkbo vkbo added the packaging Component: Packaging and installing label Jan 16, 2025
@vkbo vkbo added this to the Release 2.7 Beta 1 milestone Jan 16, 2025
@vkbo
Copy link
Owner Author

vkbo commented Jan 16, 2025

Is this something you can look at, @Ryex?

I still don't have access to MacOS, and my VM no longer works,

The main branch has moved to use PyQt6 and Qt6.

@Ryex
Copy link
Contributor

Ryex commented Jan 29, 2025

sorry for the slow response. I did get a VM working a few months back, I can try to take a look

@vkbo
Copy link
Owner Author

vkbo commented Jan 29, 2025

Great! I have given up on getting a VM working. Any tips? 😃

@Ryex
Copy link
Contributor

Ryex commented Jan 30, 2025

Great! I have given up on getting a VM working. Any tips? 😃

I'm using a docker container that automates the qemu setup.
https://github.com/sickcodes/Docker-OSX

manages to get it working on windows but I know it works on linux too.

@Ryex
Copy link
Contributor

Ryex commented Jan 30, 2025

Well, I can confirm that spellcheck works as expected

Image

I did however have to patch the build file to properly remove the unneeded parts of qt

diff --git a/setup/macos/build.sh b/setup/macos/build.sh
index dc23601d..878a09b0 100755
--- a/setup/macos/build.sh
+++ b/setup/macos/build.sh
@@ -9,6 +9,11 @@ PYTHON="$1"
 ARCH="$2"
 CONDA="$3"
 
+TIMESTAMP=$(date "+%s")
+
+CONDA_ENV_NAME="novelWriter_${CONDA}_${TIMESTAMP}"
+CONDA_PATH="$HOME/miniconda_novelWriter_${ARCH}_${TIMESTAMP}"
+
 echo "Python Version: $PYTHON"
 echo "Architecture: $ARCH"
 echo "Miniconda Architecture: $CONDA"
@@ -90,13 +95,13 @@ pushd "$BUILD_DIR"/ || exit 1
 
 echo "Downloading Miniconda ..."
 curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$CONDA.sh
-bash Miniconda3-latest-MacOSX-$CONDA.sh -b -p ~/miniconda -f
+bash Miniconda3-latest-MacOSX-$CONDA.sh -b -p$CONDA_PATH -f
 rm Miniconda3-latest-MacOSX-$CONDA.sh 
-export PATH="$HOME/miniconda/bin:$PATH"
+export PATH="$CONDA_PATH/bin:$PATH"
 
 echo "Creating Conda env ..."
-conda create -n novelWriter -c conda-forge python=$PYTHON --yes
-source activate novelWriter
+conda create -n $CONDA_ENV_NAME -c conda-forge python=$PYTHON --yes
+source activate $CONDA_ENV_NAME
 
 echo "Installing dictionaries ..."
 conda install -c conda-forge enchant hunspell-en --yes
@@ -119,7 +124,7 @@ mkdir novelWriter.app/Contents/MacOS novelWriter.app/Contents/Resources novelWri
 cp $SRC_DIR/setup/macos/Info.plist novelWriter.app/Contents/Info.plist
 
 echo "Copying miniconda env to bundle ..."
-cp -R ~/miniconda/envs/novelWriter/* novelWriter.app/Contents/Resources/
+cp -R $CONDA_PATH/envs/$CONDA_ENV_NAME/* novelWriter.app/Contents/Resources/
 
 echo "Copying novelWriter to bundle ..."
 FILES_COPY=(
@@ -166,13 +171,27 @@ rm -rf lib/python3.1
 
 # Remove web engine
 rm lib/python3.*/site-packages/PyQt6/QtWebEngine* || true
-rm -r lib/python3.*/site-packages/PyQt6/Qt/translations/qtwebengine* || true
-rm lib/python3.*/site-packages/PyQt6/Qt/resources/qtwebengine* || true
-rm -r lib/python3.*/site-packages/PyQt6/Qt/qml/QtWebEngine* || true
-rm -r lib/python3.*/site-packages/PyQt6/Qt/plugins/webview/libqtwebview* || true
-rm lib/python3.*/site-packages/PyQt6/Qt/libexec/QtWebEngineProcess* || true
-rm lib/python3.*/site-packages/PyQt6/Qt/lib/libQt5WebEngine* || true
-
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/translations/qtwebengine* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/plugins/webview/libqtwebview* || true
+
+# Remove unneeded QtQuick/Decaritive components
+rm lib/python3.*/site-packages/PyQt6/QtQml* || true
+rm lib/python3.*/site-packages/PyQt6/QtQuick* || true
+rm lib/python3.*/site-packages/PyQt6/WebChannel* || true
+rm lib/python3.*/site-packages/PyQt6/WebSockets* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/translations/qtdeclarative* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/translations/qtwebsockets* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/qml || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/plugins/qmlls || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/plugins/qmllint || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/lib/QtQml* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/lib/QtQuick* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/lib/QtWebChannel* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/lib/QtWebSockets* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/bindings/QtQml* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/bindings/QtQuick* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/bindings/QtWebChannel* || true
+rm -r lib/python3.*/site-packages/PyQt6/Qt6/bindings/QtWebSockets* || true
 popd || exit 1
 popd || exit 1
 
@@ -192,3 +211,5 @@ create-dmg --volname "novelWriter $VERSION" --volicon $SRC_DIR/setup/macos/novel
 pushd $RLS_DIR || exit 1
 shasum -a 256 novelWriter-"${VERSION}"-$ARCH.dmg | tee novelWriter-"${VERSION}"-$ARCH.dmg.sha256
 popd || exit 1
+
+rm -r $CONDA_PATH

@Ryex
Copy link
Contributor

Ryex commented Jan 30, 2025

also, just to note
building the manual on macOS requires some dependencies

brew install texlive
pip3 install Sphinx sphinx_design

@vkbo
Copy link
Owner Author

vkbo commented Jan 30, 2025

Well, I can confirm that spellcheck works as expected

Great!

I did however have to patch the build file to properly remove the unneeded parts of qt

Yes, have a look at the build code for Windows in /utils where I do the same.

also, just to note building the manual on macOS requires some dependencies

Have a look at the MacOS build action. All the assets required for a release are built on Linux. There is no need to do this in the MacOS job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging Component: Packaging and installing
Projects
None yet
Development

No branches or pull requests

2 participants