BasioMeusPuga / Lector

Qt based ebook reader
GNU General Public License v3.0
1.51k stars 208 forks source link

please make an appimage of this #81

Open datamaskinen opened 5 years ago

datamaskinen commented 5 years ago

please make an appimage of this

https://github.com/AppImage/appimage.github.io#how-to-submit-appimages-to-the-catalog

probonopd commented 5 years ago

Until there is an official one from @BasioMeusPuga, you can make one yourself:

#! /bin/bash

sudo apt -y install git

export VERSION=$(wget -q "https://api.github.com/repos/BasioMeusPuga/Lector/commits?sha=master" -O - | grep sha | head -n 1 | cut -d '"' -f 4 | head -c 7
)

export APPNAME=lector
export PIP_REQUIREMENTS="-e git+https://github.com/BasioMeusPuga/Lector#egg=$APPNAME"
export CONDA_CHANNELS="conda-forge"
export CONDA_PACKAGES="pyqt;beautifulsoup4"  # Only use this if the package is in a Conda channel (e.g., conda-forge); can also be used for dependencies if the main application has no depends.txt

wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget -c "https://raw.githubusercontent.com/TheAssassin/linuxdeploy-plugin-conda/master/linuxdeploy-plugin-conda.sh"
chmod +x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-conda.sh

rm -r AppDir || true

wget -c "https://github.com/BasioMeusPuga/Lector/raw/master/lector/resources/raw/lector.desktop"
sed -i -e 's|Icon=L|Icon=l|g' lector.desktop # FIXME

cat > AppRun <<\EOF
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
exec "$HERE/usr/conda/bin/python" "$HERE/usr/conda/bin/lector" "$@"
EOF
chmod +x AppRun

wget -c "https://raw.githubusercontent.com/BasioMeusPuga/Lector/ed5bc0b2b9b92a506d4eb2144e349075caf3a8c0/lector/resources/raw/Lector.png" -O app.png
convert app.png -resize 512x512 $APPNAME.png

./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin conda -i $APPNAME.png -d $(readlink -f "$APPNAME.desktop") --custom-apprun AppRun --output appimage

It is not yet optimized for size but it launches for me on Xubuntu 18.04.

datamaskinen commented 5 years ago

Oh super nice of you to help me here .... that makes my life a lot easier

probonopd commented 5 years ago

If @BasioMeusPuga is interested, we could make and upload official builds using Travis CI automatically.

datamaskinen commented 5 years ago

Hehe ... sorry ... acidently deleted my last input so i'll repost it :)

On Kubuntu 18.04 output for build

-- Deploying files into AppDir root directory -- Deploying custom AppRun: AppRun Deploying file AppRun to AppDir/AppRun Copying file AppRun to AppDir/AppRun Deploying desktop file: AppDir/usr/share/applications/lector.desktop Deploying desktop file to AppDir root: AppDir/usr/share/applications/lector.desktop Creating symlink for file AppDir/usr/share/applications/lector.desktop in/as AppDir ERROR: Could not find suitable icon for Icon entry: Lector

probonopd commented 5 years ago

Corrected above. Please refresh the page.

datamaskinen commented 5 years ago

Ok .... it works perfectly .... Wonderful ...

probonopd commented 5 years ago

Well, not that perfectly yet actually. But we are working on it. Thanks for your patience.

BasioMeusPuga commented 5 years ago

So I have the following issues:

That said, this is really great work. I'd love to be able to generate builds / submit them to AppImagehub. Please point me in the direction of what I'm expected to know. I'm afraid I'm totally ignorant of the packaging ritual.

datamaskinen commented 5 years ago

python-poppler-qt5 is missing in this appimage as well .... I think it all comes down to a decision of what to include in the app image ....

(seems like the script uses apt ... )

probonopd commented 5 years ago

For the moment, I'm afraid I can't get this to work this on my Arch machine.

Please run from the command line and post any output. There is a known issue at the moment which needs to be solved:

This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".

Is the build process distro dependent while the end result universal?

Yes, once we have a well-built working version. Currently it is still a work-in-progress.

python-poppler-qt5 is missing in this appimage as well

I could not find it on https://anaconda.org/search?q=poppler so I postponed this topic for now, until we have something that starts to be usable.

That said, this is really great work. I'd love to be able to generate builds / submit them to AppImagehub. Please point me in the direction of what I'm expected to know. I'm afraid I'm totally ignorant of the packaging ritual.

Great! Right now, the post important point is to find out why this happens...

probonopd commented 5 years ago

OK; we seem to be getting somewhere. The latest build at least launches, but there are a couple of issue that possibly need to be fixed/changed in the source code of the application:

  1. It is trying to access files from a build-time path (/home/travis/...) which is not available at runtime, can this be changed in the Lector source code?
xkbcommon: ERROR: failed to add default include path /home/travis/build/probonopd/Lector/AppDir/usr/conda/lib
Qt: Failed to create XKB context!
Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ':' as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .
  1. It is trying to load the icons for the buttons (only) from /usr/... rather than from a location relative to itself. Can this be changed in the Lector source code?

  2. We still need to bundle python-poppler-qt5. We need out to find how to do this.

probonopd commented 5 years ago

Turns out that 1. and 2. seem to be fixed when using PyQt5 from PyPI directly. Thanks @TheAssassin for the hint.

probonopd commented 5 years ago

Trying to address 3., running into

[conda/stdout]   Downloading https://files.pythonhosted.org/packages/af/e7/aa451d4ca0910472c4442d8aa6ef44300852926d85ad033b029a22157027/python-poppler-qt5-0.24.2.tar.gz
[conda/stdout]     Complete output from command python setup.py egg_info:
[conda/stdout]     Traceback (most recent call last):
[conda/stdout]       File "<string>", line 1, in <module>
[conda/stdout]       File "/tmp/pip-install-u7l85tln/python-poppler-qt5/setup.py", line 42, in <module>
[conda/stdout]         import sipdistutils
[conda/stdout]     ModuleNotFoundError: No module named 'sipdistutils'
[conda/stdout]     
[conda/stdout]     ----------------------------------------
[conda/stderr] Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-u7l85tln/python-poppler-qt5/
ERROR: Failed to run plugin: conda (exit code: 1) 

Seems to be a known issue: https://github.com/wbsoft/python-poppler-qt5/issues/14

probonopd commented 5 years ago

Strange. WIth a workaround for the above and QT_SELECT=5 it does not compile,

[conda/stdout] Collecting PyQt5
[conda/stdout]   Downloading https://files.pythonhosted.org/packages/d4/bf/d884da8e2f7096d201c891d515eb6813a8e85df5eb6f5e12e867bf1d831c/PyQt5-5.11.3-5.11.2-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl (117.8MB)
[conda/stdout] Collecting python-poppler-qt5
[conda/stdout]   Downloading https://files.pythonhosted.org/packages/af/e7/aa451d4ca0910472c4442d8aa6ef44300852926d85ad033b029a22157027/python-poppler-qt5-0.24.2.tar.gz
[conda/stdout]     Complete output from command python setup.py egg_info:
[conda/stdout]     Package poppler-qt5 was not found in the pkg-config search path.
[conda/stdout]     Perhaps you should add the directory containing `poppler-qt5.pc'
[conda/stdout]     to the PKG_CONFIG_PATH environment variable
[conda/stdout]     No package 'poppler-qt5' found
[conda/stdout]     running egg_info
[conda/stdout]     creating pip-egg-info/python_poppler_qt5.egg-info
[conda/stdout]     writing pip-egg-info/python_poppler_qt5.egg-info/PKG-INFO
[conda/stdout]     writing dependency_links to pip-egg-info/python_poppler_qt5.egg-info/dependency_links.txt
[conda/stdout]     writing top-level names to pip-egg-info/python_poppler_qt5.egg-info/top_level.txt
[conda/stdout]     writing manifest file 'pip-egg-info/python_poppler_qt5.egg-info/SOURCES.txt'
[conda/stdout]     qmake: could not find a Qt installation of '5'
[conda/stdout]     Failed to determine Qt version (Command '['qmake', '-query', 'QT_VERSION']' returned non-zero exit status 1.).
[conda/stdout]     
[conda/stdout]     ----------------------------------------
[conda/stderr] Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-5jodmg78/python-poppler-qt5/
ERROR: Failed to run plugin: conda (exit code: 1) 

Any ideas @TheAssassin?

TheAssassin commented 5 years ago

You need the system package, I guess?

probonopd commented 5 years ago

System package of qmake? And why? Wouldn't that lead to an unhealthy mix of different Qt versions?

TheAssassin commented 5 years ago

I meant the poppler-qt5 package.

probonopd commented 5 years ago

As in sudo apt -y install python-poppler-qt5? Help me understand your line of thought...

TheAssassin commented 5 years ago

poppler is a C(++?) library.

[conda/stdout]     Package poppler-qt5 was not found in the pkg-config search path.
[conda/stdout]     Perhaps you should add the directory containing `poppler-qt5.pc'

This implies you need to install a system library.

probonopd commented 5 years ago

Ah, libpoppler-dev then. Makes sense 👍

TheAssassin commented 5 years ago

...

libpoppler-qt5-dev/bionic-updates,bionic-security 0.62.0-2ubuntu2.5 amd64 PDF rendering library -- development files (Qt 5 interface)

probonopd commented 5 years ago
 libpoppler-qt5-dev : Depends: libpoppler-qt5-1 (= 0.24.5-2ubuntu4.8) but it is not going to be installed
                      Depends: qtbase5-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Sigh.

TheAssassin commented 5 years ago

Try xenial. It's gooooood.

probonopd commented 5 years ago

Won't run on all still-supported releases of Ubuntu. Would have to wait until xenial is the oldest still-supported release.

BasioMeusPuga commented 5 years ago

I've removed python-poppler-qt5 as a dependency. I'm using pymupdf instead. That's maintained, and it's available as a wheel, so we should be good.

datamaskinen commented 4 years ago

do we have the appimage script for this working now?

Can someone post the newest script to create it?

probonopd commented 4 years ago

xenial is now the oldest still-supported distribution, so we should be good to go.