Skip to content

Commit

Permalink
Merge pull request #771 from kiwix/kiwix-desktop_jammy_appimage
Browse files Browse the repository at this point in the history
Kiwix desktop jammy appimage
  • Loading branch information
kelson42 authored Dec 2, 2024
2 parents 83b45a0 + ff2ade2 commit a14970b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 109 deletions.
51 changes: 26 additions & 25 deletions .github/scripts/build_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,33 @@
| macos | macOS_x86_64 | B | B | | | | | |
| macos | apple_all_static | | BP | | | | xcframework | |
----------------------------------------------------------------------------------------------------------------------------------------------
| | flatpak | | | | | BP | | |
| | native_static | d | d | dBPSD | dBPSD | | linux-x86_64 | linux-x86_64-static |
| | native_mixed | BPS | BPS | | | | linux-x86_64 | |
| | native_dyn | d | d | dB | dB | dBPS | | linux-x86_64-dyn |
| focal | flatpak | | | | | BP | | |
| focal | native_static | d | d | dBPSD | dBPSD | | linux-x86_64 | linux-x86_64-static |
| focal | native_mixed | BPS | BPS | | | | linux-x86_64 | |
| focal | native_dyn | d | d | dB | dB | | | linux-x86_64-dyn |
| jammy | native_dyn | d | d | | | dBPS | | linux-x86_64-dyn |
# libzim CI is building alpine_dyn but not us
| | android_arm | dBP | dBP | | | | android-arm | android-arm |
| | android_arm64 | dBP | dBP | | | | android-arm64 | android-arm64 |
| | android_x86 | BP | BP | | | | android-x86 | |
| | android_x86_64 | BP | BP | | | | android-x86_64 | |
| | armv6_static | | | BP | BP | | linux-armv6 | |
| | armv6_mixed | BP | | | | | linux-armv6 | |
| | armv6_dyn | | | B | B | | | |
| | armv8_static | | | BP | BP | | linux-armv8 | |
| | armv8_mixed | BP | | | | | linux-armv8 | |
| | armv8_dyn | | | B | B | | | |
| | aarch64_static | | | BP | BP | | linux-aarch64 | |
| | aarch64_mixed | BP | | | | | linux-aarch64 | |
| | aarch64_dyn | d | | B | B | | | linux-aarch64-dyn |
| | aarch64_musl_static| | | BP | BP | | linux-aarch64-musl | |
| | aarch64_musl_mixed | BP | | | | | linux-aarch64-musl | |
| | aarch64_musl_dyn | d | | B | B | | | linux-aarch64-musl-dyn |
| | x86-64_musl_static | | | BP | BP | | linux-x86_64-musl | |
| | x86-64_musl_mixed | BP | | | | | linux-x86_64-musl | |
| | i586_static | | | BP | BP | | linux-i586 | |
| | i586_dyn | | | B | B | | | |
| | wasm | dBP | | | | | wasm-emscripten | wasm |
| focal | android_arm | dBP | dBP | | | | android-arm | android-arm |
| focal | android_arm64 | dBP | dBP | | | | android-arm64 | android-arm64 |
| focal | android_x86 | BP | BP | | | | android-x86 | |
| focal | android_x86_64 | BP | BP | | | | android-x86_64 | |
| focal | armv6_static | | | BP | BP | | linux-armv6 | |
| focal | armv6_mixed | BP | | | | | linux-armv6 | |
| focal | armv6_dyn | | | B | B | | | |
| focal | armv8_static | | | BP | BP | | linux-armv8 | |
| focal | armv8_mixed | BP | | | | | linux-armv8 | |
| focal | armv8_dyn | | | B | B | | | |
| focal | aarch64_static | | | BP | BP | | linux-aarch64 | |
| focal | aarch64_mixed | BP | | | | | linux-aarch64 | |
| focal | aarch64_dyn | d | | B | B | | | linux-aarch64-dyn |
| focal | aarch64_musl_static| | | BP | BP | | linux-aarch64-musl | |
| focal | aarch64_musl_mixed | BP | | | | | linux-aarch64-musl | |
| focal | aarch64_musl_dyn | d | | B | B | | | linux-aarch64-musl-dyn |
| focal | x86-64_musl_static | | | BP | BP | | linux-x86_64-musl | |
| focal | x86-64_musl_mixed | BP | | | | | linux-x86_64-musl | |
| focal | i586_static | | | BP | BP | | linux-i586 | |
| focal | i586_dyn | | | B | B | | | |
| focal | wasm | dBP | | | | | wasm-emscripten | wasm |
"""


Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ jobs:
image_variant: manylinux
- config: aarch64_mixed
image_variant: manylinux
- config: native_dyn
image_variant: jammy
env:
HOME: /home/runner
SSH_KEY: /tmp/id_rsa
runs-on: ubuntu-22.04
container:
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-06-03"
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-11-30"
options: "--device /dev/fuse --privileged"
steps:
- name: Checkout code
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ jobs:
image_variant: manylinux
- config: aarch64_mixed
image_variant: manylinux
- config: native_dyn
image_variant: jammy
env:
HOME: /home/runner
SSH_KEY: /tmp/id_rsa
OS_NAME: ${{matrix.image_variant}}
runs-on: ubuntu-22.04
container:
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-06-03"
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2024-11-30"
options: "--device /dev/fuse --privileged"
steps:
- name: Checkout code
Expand Down
97 changes: 15 additions & 82 deletions scripts/create_kiwix-desktop_appImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,98 +14,31 @@ 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
# 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

# Copy ssl libs so that the appimage runs on newer systems
# that use a backward incompatible version of openssl
cp /usr/$SYSTEMLIBDIR/lib{crypto,ssl}.so.1.1 $APPDIR/usr/lib

patch_rodata()
{
local elffile=$1
local sedscript=$2
local rodatafile=$elffile.rodata
objcopy --dump-section .rodata="$rodatafile" "$elffile"
sed -i "$sedscript" "$rodatafile"
objcopy --update-section .rodata="$rodatafile" "$elffile"
rm $rodatafile
}

# copy and patch a couple of libs depending on ssl functionalty before
# linuxdeployqt copies and modifies them whereupon the patch_rodata procedure
# stops working on them correctly
cp -rL /usr/$SYSTEMLIBDIR/{libgnutls.so.30,libQt5Network.so.5} $APPDIR/usr/lib

# patch libQt5Network.so so that if it fails to load certificates from
# system paths the last path that it tries points to the certificate bundle
# included with the appimage

# !!! crt_bundle_new_path must have the same length as crt_bundle_old_path
crt_bundle_old_path=/usr/local/share/certs/ca-root-nss.crt
crt_bundle_new_path=/tmp/cert_bundle_provided_by_kiwix.crt
# !!! crt_bundle_new_path must have the same length as crt_bundle_old_path

libQtNetworkPatchingSedScript="s|$crt_bundle_old_path|$crt_bundle_new_path|"

patch_rodata $APPDIR/usr/lib/libQt5Network.so.5 "$libQtNetworkPatchingSedScript"


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
# 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

cp $DESKTOPFILE $APPDIR/kiwix-desktop.desktop
cp $ICONFILE $APPDIR/
cp $ICONFILE $APPDIR/.DirIcon

rm "$APPDIR"/AppRun

cat > "$APPDIR"/AppRun <<'END'
#!/usr/bin/env bash
mydir=$(dirname "$0")
mydir=$(cd "$mydir" && pwd)
crt_path=??? # this is set by postprocessing via sed
if [ ! -e "$crt_path" ]
then
ln -s "$mydir"/etc/ssl/certs/ca-certificates.crt "$crt_path"
trap "rm '$crt_path'" EXIT
fi
"$mydir"/usr/bin/kiwix-desktop "$@"
END

sed -i "s#^crt_path=.*#crt_path=$crt_bundle_new_path#" "$APPDIR"/AppRun

chmod 0755 "$APPDIR"/AppRun

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

Expand Down

0 comments on commit a14970b

Please sign in to comment.