From d0eeca32d13622f4745f72e8c4da3966329e1c01 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Fri, 25 Oct 2024 16:03:57 +0400 Subject: [PATCH 1/4] Revert "libssl is embedded in the kiwix-desktop appimage" This reverts commit dee57f131c2407b3efeada54ae3aa506b47a89a0. --- scripts/create_kiwix-desktop_appImage.sh | 69 +----------------------- 1 file changed, 2 insertions(+), 67 deletions(-) diff --git a/scripts/create_kiwix-desktop_appImage.sh b/scripts/create_kiwix-desktop_appImage.sh index 15d4fc3d..f1d9e4ef 100755 --- a/scripts/create_kiwix-desktop_appImage.sh +++ b/scripts/create_kiwix-desktop_appImage.sh @@ -25,41 +25,6 @@ rm -f $APPDIR/usr/lib/libmagic.so* 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 - -# 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 @@ -78,35 +43,5 @@ chmod u+x linuxdeployqt ./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 - -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 +# Build the image. +./linuxdeployqt $APPDIR/usr/share/applications/kiwix-desktop.desktop -bundle-non-qt-libs -extra-plugins=imageformats,iconengines -appimage From c116685b2166db813a7112cae4f5dfe177f425d7 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Wed, 30 Oct 2024 20:22:30 +0400 Subject: [PATCH 2/4] kiwix-desktop appimage creation under jammy - 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). --- scripts/create_kiwix-desktop_appImage.sh | 44 +++++++++++------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/scripts/create_kiwix-desktop_appImage.sh b/scripts/create_kiwix-desktop_appImage.sh index f1d9e4ef..702cd37d 100755 --- a/scripts/create_kiwix-desktop_appImage.sh +++ b/scripts/create_kiwix-desktop_appImage.sh @@ -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 From 2321717c835ae482e1d8592341114bfe39b7b8b0 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 25 Nov 2024 16:30:42 +0400 Subject: [PATCH 3/4] Added OS_NAME in build definition table for focal Next we are going to have some CI/CD jobs running on jammy instead of focal that's why the build platform for Linux jobs has to be made explicit. --- .github/scripts/build_definition.py | 50 ++++++++++++++--------------- .github/workflows/ci.yml | 1 + 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 7a38f2e3..49b313a5 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -38,32 +38,32 @@ | 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 | 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 | """ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5842db04..a063129e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,7 @@ jobs: 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" From ff2ade262cb24e842b4a309e7592dd99fb2f771f Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 25 Nov 2024 17:41:58 +0400 Subject: [PATCH 4/4] Migrate kiwix-desktop appimage build to jammy --- .github/scripts/build_definition.py | 3 ++- .github/workflows/cd.yml | 4 +++- .github/workflows/ci.yml | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 49b313a5..541838fb 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -41,7 +41,8 @@ | 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 | dBPS | | linux-x86_64-dyn | + | 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 | focal | android_arm | dBP | dBP | | | | android-arm | android-arm | | focal | android_arm64 | dBP | dBP | | | | android-arm64 | android-arm64 | diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9d4068f1..ba96d663 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a063129e..4da35ef9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,13 +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