More detailed instructions

Vinh Quang Tran
2023-06-10 10:13:07 +07:00
parent 3968984392
commit 2a2e3834c9
+48 -21
@@ -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. # Requirements
Here the result: https://static.celogeek.com/KCC/M1/KindleComicConverter_osx_5.5.3b17.dmg - [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: # Steps
I use pyenv. 1. Create a new Python environment.
So for the repo
``` ```
pyenv install 3.9.16 python3.9 -m venv kindle
pyenv virtualenv 3.9.16 kindle ```
pyenv activate kindle
brew install pyqt@5 boost-python3 cmake 3. Activate new environment.
export PYTHONPATH=/opt/homebrew/Cellar/pyqt@5/5.15.7_1/lib/python3.9/site-packages
pip install -r requirements.txt ```
pip install pyinstaller 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 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 git clone https://github.com/p7zip-project/p7zip.git
cd p7zip cd p7zip
@@ -27,17 +52,17 @@ git checkout v17.04
make -j4 7z 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 bin
├── 7z ├── 7z
├── 7z.so ├── 7z.so
├── 7za
└── Codecs └── Codecs
└── Rar.so └── 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 git status
modified: other/osx/7z modified: other/osx/7z
@@ -45,18 +70,20 @@ git status
modified: other/osx/Rar.so 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 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 stash
git pull git pull
git stash pop git stash pop
rm -rf dist rm -rf dist
python setup.py build_binary python setup.py build_binary
``` ```