diff --git a/How-to-build-M1.md b/How-to-build-M1.md index 59b5b0e..0f81b4c 100644 --- a/How-to-build-M1.md +++ b/How-to-build-M1.md @@ -1,25 +1,50 @@ -Originally posted by @celogeek in https://github.com/darodi/kcc/issues/4#issuecomment-1364553511 +Based on @celogeek's instructions: https://github.com/darodi/kcc/issues/4#issuecomment-1364553511 -I figure out a way to build it on M1. -Here the result: https://static.celogeek.com/KCC/M1/KindleComicConverter_osx_5.5.3b17.dmg +# Requirements +- [Homebrew](https://brew.sh) installed +- Python 3.9-3.11. In this tutorial, we will use Python 3.9. If you use other versions, remember to change it in the commands. -So to do that: -I use pyenv. +# Steps +1. Create a new Python environment. -So for the repo ``` -pyenv install 3.9.16 -pyenv virtualenv 3.9.16 kindle -pyenv activate kindle +python3.9 -m venv kindle +``` -brew install pyqt@5 boost-python3 cmake -export PYTHONPATH=/opt/homebrew/Cellar/pyqt@5/5.15.7_1/lib/python3.9/site-packages -pip install -r requirements.txt -pip install pyinstaller +3. Activate new environment. + +``` +source kindle/bin/activate +``` +4. Install dependencies from Homebrew. Remember the `pyqt@5` version installed. At the time of writing, the latest version is `5.15.7_2`. + +``` +brew install pyqt@5 boost-python3 cmake node +``` + +5. Install `appdmg` for packaging. + +``` npm install -g appdmg ``` -You need a m1 compatible version of 7z: +6. Bind `pyqt@5` to Python. Change the version number of `pyqt@5` if necessary. + +``` +export PYTHONPATH=/opt/homebrew/Cellar/pyqt@5/5.15.7_2/lib/python3.9/site-packages +``` + +To check if `PyQt5` is correctly binded, run `pip freeze | grep PyQt5` and see if `PyQt5` shows up. + +7. In repo folder, install Python dependencies and `pyinstaller`. + +``` +pip install -r requirements.txt +pip install pyinstaller +``` + +8. Compile 7z. + ``` git clone https://github.com/p7zip-project/p7zip.git cd p7zip @@ -27,17 +52,17 @@ git checkout v17.04 make -j4 7z ``` -In the bin directory, you will have +9. Replace repo's 7z binaries and libraries with the one you compiled. In the `bin` directory of `p7zip`, you should have + ``` bin ├── 7z ├── 7z.so -├── 7za └── Codecs └── Rar.so ``` -Copy and replace those files into other/osx +Copy and replace those files into `kcc`'s `other/osx`. Running `git status` should give the following output. ``` git status modified: other/osx/7z @@ -45,18 +70,20 @@ git status modified: other/osx/Rar.so ``` +10. Build the app. The DMG file will show up in `dist` folder. + ``` -rm -rf dist python setup.py build_binary ``` -You should have in the dist directory the DMG that should works. +# Updating KCC + +In order to update KCC, run: -To update I think until we have a solution: ``` git stash git pull git stash pop rm -rf dist python setup.py build_binary -``` +``` \ No newline at end of file