Skip to content

Commit

Permalink
kiwix-desktop appimage creation under jammy
Browse files Browse the repository at this point in the history
- Switched from linuxdeployqt to (linuxdeploy + linuxdeploy-plugin-qt)

- Eliminated custom creation of the AppDir & most manual copying of
  some stuff into it (trusting linuxdeploy to do everything needed
  for the correct operation of the appimage). Note, however, that
  nss/ libs are no longer bundled with the appimage (libthai.so is
  forcefully bundled via a special option to linuxdeploy).
  • Loading branch information
veloman-yunkan committed Oct 30, 2024
1 parent 033eb9f commit 761b242
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions scripts/create_kiwix-desktop_appImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,32 @@ fi
ICONFILE=$SOURCEDIR/resources/icons/kiwix/scalable/kiwix-desktop.svg
DESKTOPFILE=$SOURCEDIR/resources/org.kiwix.desktop.desktop

# Create structure
mkdir -p $APPDIR/usr/{bin,lib,share} $APPDIR/usr/share/applications $APPDIR/usr/share/icons/hicolor/48x48/apps
# Copy our files
cp $INSTALLDIR/bin/kiwix-desktop $APPDIR/usr/bin/
cp $INSTALLDIR/$SYSTEMLIBDIR/*.so* $APPDIR/usr/lib
# Remove it as it break with linuxdeployqt (should we compile without it) ?
rm -f $APPDIR/usr/lib/libmagic.so*
# Copy nss lib (to not conflict with host's ones)
cp -a /usr/$SYSTEMLIBDIR/nss $APPDIR/usr/lib
# Copy libthai.so (see kiwix-desktop issue#1016)
cp -a /usr/$SYSTEMLIBDIR/libthai.so* $APPDIR/usr/lib
cp $ICONFILE $APPDIR/usr/share/icons/hicolor/48x48/apps/kiwix-desktop.svg
mkdir -p $APPDIR/usr/share/applications
cp $DESKTOPFILE $APPDIR/usr/share/applications/kiwix-desktop.desktop
# Get linuxdeploy
wget --continue https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-x86_64.AppImage
chmod u+x linuxdeploy-x86_64.AppImage
wget --continue https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20240109-1/linuxdeploy-plugin-qt-x86_64.AppImage
chmod u+x linuxdeploy-plugin-qt-x86_64.AppImage

# Fill with all deps libs and so
LD_LIBRARY_PATH=$INSTALLDIR/lib/x86_64-linux-gnu ./linuxdeploy-x86_64.AppImage \
--plugin=qt \
--appdir="$APPDIR" \
--executable=$INSTALLDIR/bin/kiwix-desktop \
--desktop-file=$DESKTOPFILE \
--icon-file=$ICONFILE \
--library=/usr/lib/x86_64-linux-gnu/libthai.so.0 \

# get the aria2
wget --continue https://github.com/q3aql/aria2-static-builds/releases/download/v1.36.0/aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2
mkdir -p $APPDIR/usr/bin/ && tar -C $APPDIR/usr/bin/ -xf aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 aria2-1.36.0-linux-gnu-64bit-build1/aria2c --strip-components=1
mkdir -p $APPDIR/etc/ssl/certs/ && tar -C $APPDIR/etc/ssl/certs/ -xf aria2-1.36.0-linux-gnu-64bit-build1.tar.bz2 aria2-1.36.0-linux-gnu-64bit-build1/ca-certificates.crt --strip-components=1

# Get linuxdeployqt
# Dispite the 'continuous' in the file name, it IS release 8
wget --continue https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage -O linuxdeployqt
chmod u+x linuxdeployqt

# Fill with all deps libs and so
./linuxdeployqt $APPDIR/usr/bin/kiwix-desktop -bundle-non-qt-libs -extra-plugins=imageformats,iconengines
# Fix the RPATH of QtWebEngineProcess [TODO] Fill a issue ?
patchelf --set-rpath '$ORIGIN/../lib' $APPDIR/usr/libexec/QtWebEngineProcess
# Build the image.
./linuxdeployqt $APPDIR/usr/share/applications/kiwix-desktop.desktop -bundle-non-qt-libs -extra-plugins=imageformats,iconengines -appimage

mv $APPDIR/{AppRun.wrapped,kiwix-desktop}
sed -i 's/AppRun\.wrapped/kiwix-desktop/g' $APPDIR/AppRun
wget --continue https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod u+x appimagetool-x86_64.AppImage

./appimagetool-x86_64.AppImage AppDir Kiwix-"$VERSION"-x86_64.AppImage

0 comments on commit 761b242

Please sign in to comment.