From f6f8e6c081cf0ae89937f25be40766e61b4a87fa Mon Sep 17 00:00:00 2001 From: Antoine Lambert Date: Fri, 17 May 2024 22:24:20 +0200 Subject: [PATCH] gha: Add job to build Talipot AppImage with Qt6 --- .github/workflows/appimage-build.yml | 12 +++- bundlers/linux/CMakeLists.txt | 9 +++ bundlers/linux/make_appimage_bundle.sh.in | 14 ++++- bundlers/linux/talipot.appdata.xml | 6 +- .../linux/talipot_appimage_centos_build.sh | 61 ++++++++++++++++--- 5 files changed, 83 insertions(+), 19 deletions(-) diff --git a/.github/workflows/appimage-build.yml b/.github/workflows/appimage-build.yml index a2e1442ae3..ef9bfbab7a 100644 --- a/.github/workflows/appimage-build.yml +++ b/.github/workflows/appimage-build.yml @@ -8,8 +8,12 @@ jobs: fail-fast: false matrix: config: - - name: Talipot AppImage build on CentOS 8 + - name: Talipot AppImage build on CentOS 8 Stream docker-image: tgagor/centos-stream:8 + centos-version: centos8 + - name: Talipot AppImage build on CentOS 9 Stream + docker-image: dokken/centos-stream-9 + centos-version: centos9 steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.12.1 @@ -41,6 +45,8 @@ jobs: run: docker run -e CCACHE_DIR=/ccache --volumes-from ccache + --device /dev/fuse + --privileged -v `pwd`:/talipot:rw ${{ matrix.config.docker-image }} /bin/bash -c "bash -xe /talipot/bundlers/linux/talipot_appimage_centos_build.sh" @@ -61,7 +67,7 @@ jobs: -v ${{ github.workspace }}:/talipot:rw run: | dnf -y group install "Basic Desktop" GNOME - yum install -y xorg-x11-server-Xvfb + yum install -y xorg-x11-server-Xvfb libglvnd-opengl xvfb-run $(ls /talipot/build/Talipot*.AppImage) --check-application-starts --debug-plugins-load - name: Check Talipot AppImage can be executed on ArchLinux uses: addnab/docker-run-action@v3 @@ -90,7 +96,7 @@ jobs: - name: Upload Taliot AppImage to GitHub Actions artifacts uses: actions/upload-artifact@v4 with: - name: Talipot-AppImage + name: Talipot-AppImage-${{ matrix.config.centos-version }} path: ./build/Talipot*.AppImage - name: Upload Talipot bundle to dev-latest prerelease if: github.ref == 'refs/tags/dev-latest' diff --git a/bundlers/linux/CMakeLists.txt b/bundlers/linux/CMakeLists.txt index 4494056763..a2d959764e 100644 --- a/bundlers/linux/CMakeLists.txt +++ b/bundlers/linux/CMakeLists.txt @@ -18,3 +18,12 @@ ADD_CUSTOM_TARGET( -e DISPLAY=$DISPLAY tgagor/centos-stream:8 /bin/bash -c "bash -xe /talipot/bundlers/linux/talipot_appimage_centos_build.sh" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +ADD_CUSTOM_TARGET( + bundle-qt6 + COMMAND + docker run --rm=true -it -v ${CMAKE_SOURCE_DIR}:/talipot:rw -v + ${CMAKE_BINARY_DIR}:/talipot_host_build:rw -v /tmp/.X11-unix:/tmp/.X11-unix + -e DISPLAY=$DISPLAY dokken/centos-stream-9 /bin/bash -c + "bash -xe /talipot/bundlers/linux/talipot_appimage_centos_build.sh" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/bundlers/linux/make_appimage_bundle.sh.in b/bundlers/linux/make_appimage_bundle.sh.in index c47c0cc967..a8591840b4 100644 --- a/bundlers/linux/make_appimage_bundle.sh.in +++ b/bundlers/linux/make_appimage_bundle.sh.in @@ -1,6 +1,6 @@ #!/bin/bash -# This script is CentOS Stream 8.x specific, it intends to create a +# This script is CentOS Stream [8|9].x specific, it intends to create a # talipot portable bundle (using AppImageKit) suitable to # run on most linux distributions @@ -135,8 +135,16 @@ wget "https://github.com/probonopd/linuxdeployqt/releases/download/\ continuous/linuxdeployqt-continuous-x86_64.AppImage" chmod a+x linuxdeployqt-continuous-x86_64.AppImage -./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract-and-run \ - $BUNDLE_BIN_DIR/talipot -bundle-non-qt-libs -no-translations +linuxdeployqt_opts="-bundle-non-qt-libs -no-translations" +if [ $(${QMAKE} -query QT_VERSION | cut -c1) -ge 6 ] +then + linuxdeployqt_opts+=" -unsupported-allow-new-glibc" + linuxdeployqt_opts+=" -exclude-libs=libnss3.so,libnssutil3.so" +fi + +export LD_LIBRARY_PATH=/usr/lib64/samba/ +./linuxdeployqt-continuous-x86_64.AppImage $BUNDLE_BIN_DIR/talipot \ + $linuxdeployqt_opts pushd $BUNDLE_LIB_DIR > /dev/null 2>&1 diff --git a/bundlers/linux/talipot.appdata.xml b/bundlers/linux/talipot.appdata.xml index a40ae093a1..ebedda5a8a 100644 --- a/bundlers/linux/talipot.appdata.xml +++ b/bundlers/linux/talipot.appdata.xml @@ -6,12 +6,12 @@ Talipot Display, analyze and edit relational data -

Talipot is an information visualization framework dedicated to the analysis and visualization of relational data.

+

Talipot is an information visualization framework dedicated to the analysis and visualization + of relational data.

- Talipot.png talipot.desktop https://github.com/anlambert/talipot talipot.desktop - + \ No newline at end of file diff --git a/bundlers/linux/talipot_appimage_centos_build.sh b/bundlers/linux/talipot_appimage_centos_build.sh index 1426154c15..cd61ab7e61 100644 --- a/bundlers/linux/talipot_appimage_centos_build.sh +++ b/bundlers/linux/talipot_appimage_centos_build.sh @@ -1,6 +1,14 @@ #!/bin/bash -# this script should only be run in a CentOS Stream 8.x docker image +# this script should only be run in a CentOS Stream [8|9].x docker image + +centos8=true +centos9=false +if grep -q "CentOS Stream release 9" /etc/centos-release +then + centos8=false + centos9=true +fi cd @@ -12,22 +20,37 @@ yum -y update # install base build system yum -y install epel-release yum -y install xz tar gzip make wget ccache +yum -y install dnf-plugins-core +if [ "$centos8" = true ] +then + # add extra CentOS 8 repositories to get some build dependencies + yum config-manager --set-enabled powertools + yum -y install https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-2.el8.noarch.rpm + talipot_use_qt6=OFF + qmake=qmake-qt5 +else + # add extra CentOS 9 repositories to get some build dependencies + yum config-manager --set-enabled crb + talipot_use_qt6=ON + qmake=qmake +fi -# add extra CentOS 8 repositories to get some build dependencies -yum -y install dnf-plugins-core -yum config-manager --set-enabled powertools -yum -y install https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-2.el8.noarch.rpm yum -y install cmake - # install talipot deps yum -y install zlib-devel libzstd-devel qhull-devel yajl-devel \ graphviz-devel libgit2-devel binutils-devel yum -y install freetype-devel fontconfig-devel glew-devel fribidi-devel -yum -y install qt5-qtbase-devel qt5-qtimageformats qt5-qtsvg \ - quazip-qt5-devel qt5-qtwebkit-devel --enablerepo=epel-testing --nobest +if [ "$centos8" = true ] +then + yum -y install qt5-qtbase-devel qt5-qtimageformats qt5-qtsvg \ + quazip-qt5-devel qt5-qtwebkit-devel --enablerepo=epel-testing --nobest +else + yum -y install qt6-qtbase-devel qt6-qtimageformats qt6-qtsvg \ + qt6-qt5compat-devel qt6-qtwebengine-devel +fi # install Python 3, Sphinx and SIP yum -y install python3.11-devel python3.11-pip @@ -60,6 +83,7 @@ cmake -DCMAKE_BUILD_TYPE=Release \ -DTALIPOT_USE_CCACHE=ON \ -DTALIPOT_BUILD_FOR_APPIMAGE=ON \ -DTALIPOT_BUILD_TESTS=ON \ + -DTALIPOT_USE_QT6=$talipot_use_qt6 \ -DOpenMP_C_FLAGS=-fopenmp \ -DOpenMP_CXX_FLAGS=-fopenmp .. @@ -71,14 +95,31 @@ xvfb-run make tests # build a bundle dir suitable for AppImageKit bash bundlers/linux/make_appimage_bundle.sh --appdir $PWD +# ensure QtWebEngine is functional when bundled in AppImage +if [ "$centos9" = true ] +then + yum -y install patchelf cpio + # for some reasons, qt6-qtwebengine translations files are not installed + # by yum but those are still available in the rpm archive so we hack a bit + # to extract and copy them in the AppImage AppDir + yum -y remove --noautoremove qt6-qtwebengine + yum -y install --downloadonly --downloaddir=$PWD qt6-qtwebengine + rpm2cpio qt6-qtwebengine*.rpm | cpio -idmv --directory=/opt/qtwebengine + cp -r /opt/qtwebengine/usr/share/qt6/translations/qtwebengine_locales/ $BUNDLE_DIR/usr/translations/ + # this file is also required to be bundled in AppImage or V8 crashes on startup + cp /opt/qtwebengine/usr/share/qt6/resources/v8_context_snapshot.bin $BUNDLE_DIR/usr/resources/ + # rpath of QtWebEngineProcess also needs to be patched to work in AppImage + patchelf --set-rpath '$ORIGIN/../lib' $BUNDLE_DIR/usr/libexec/QtWebEngineProcess +fi + # get appimagetool wget "https://github.com/probonopd/AppImageKit/releases/download/\ continuous/appimagetool-$(uname -p).AppImage" chmod a+x appimagetool-$(uname -p).AppImage # finally build the portable app -TALIPOT_APPIMAGE=Talipot-$(sh talipot-config --version)-$(uname -p).AppImage -./appimagetool-$(uname -p).AppImage --appimage-extract-and-run Talipot.AppDir $TALIPOT_APPIMAGE +TALIPOT_APPIMAGE=Talipot-$(sh talipot-config --version)-$(uname -p)-qt$($qmake -query QT_VERSION).AppImage +./appimagetool-$(uname -p).AppImage Talipot.AppDir $TALIPOT_APPIMAGE chmod +x $TALIPOT_APPIMAGE if [ -d /talipot_host_build ]; then