Skip to content

Commit

Permalink
feat: add appimage back to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky committed Dec 25, 2024
1 parent b244e20 commit 8ecfb16
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 61 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build-test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,28 @@ jobs:
# Build, test, and deploy jobs (PR and push)
################################################################################################

build-appimage:
name: appimage on alpine
runs-on: ubuntu-22.04
needs: [update-nightly-tag]
strategy:
matrix:
features: [full]
build_type: [Release]
steps:
- uses: actions/checkout@v4
- name: Install docker-compose
run: sudo apt-get install -y docker-compose
- name: Run build
run: docker-compose run --rm -e GITHUB_REPOSITORY=$GITHUB_REPOSITORY -e GITHUB_REF=$GITHUB_REF alpine ./appimage/build.sh --src-dir /qtox
- name: Upload appimage
uses: actions/upload-artifact@v4
with:
name: qTox-${{ github.sha }}-${{ matrix.arch }}-AppImage
path: |
qTox-*.AppImage
qTox-*.AppImage.zsync
build-android:
name: Android
runs-on: ubuntu-22.04
Expand Down
83 changes: 22 additions & 61 deletions appimage/build.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
#!/usr/bin/env bash

# MIT License
#
# SPDX-License-Identifier: GPL-3.0-or-later.
# Copyright © 2019 by The qTox Project Contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Copyright © 2024 The TokTok team

# Fail out on error
set -exuo pipefail
Expand All @@ -47,54 +29,33 @@ fi
# directory paths
BUILD_DIR=$(realpath .)
readonly BUILD_DIR
QTOX_APP_DIR="$BUILD_DIR"/appdir
QTOX_APP_DIR="$BUILD_DIR"/QTox.AppDir
readonly QTOX_APP_DIR
readonly LOCAL_LIB_DIR="$QTOX_APP_DIR"/local/lib
# ldqt binary
readonly LDQT_BIN="/usr/lib/qt5/bin/linuxdeployqt"

wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage

# update information to be embeded in AppImage
readonly UPDATE_INFO="gh-releases-zsync|qTox|qTox|latest|qTox-*.x86_64.AppImage.zsync"
export GIT_VERSION=$(git -C "${QTOX_SRC_DIR}" rev-parse --short HEAD)
#readonly UPDATE_INFO="gh-releases-zsync|TokTok|qTox|latest|qTox-*.x86_64.AppImage.zsync"
#export GIT_VERSION=$(git -C "${QTOX_SRC_DIR}" rev-parse --short HEAD)

echo $QTOX_APP_DIR
cmake "${QTOX_SRC_DIR}" -DDESKTOP_NOTIFICATIONS=ON -DUPDATE_CHECK=ON -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
rm -fr appdir
make DESTDIR=appdir install

unset QTDIR; unset QT_PLUGIN_PATH; unset LD_LIBRARY_PATH;
cmake "${QTOX_SRC_DIR}" \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DDESKTOP_NOTIFICATIONS=ON \
-DUPDATE_CHECK=ON
cmake --build .
#rm -fr QTox.AppDir
cmake --install . --prefix QTox.AppDir/usr

readonly QTOX_DESKTOP_FILE="$QTOX_APP_DIR"/usr/local/share/applications/*.desktop
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/x86_64-linux-gnu/
export QTDIR=/usr/lib/qt6

eval "$LDQT_BIN $QTOX_DESKTOP_FILE -bundle-non-qt-libs -extra-plugins=libsnore-qt5"
eval ./appimagetool-*.AppImage --appimage-extract-and-run -s deploy $QTOX_APP_DIR/usr/share/applications/*.desktop

# Move the required files to the correct directory
mv "$QTOX_APP_DIR"/usr/* "$QTOX_APP_DIR/"
rm -rf "$QTOX_APP_DIR/usr"
# print all links not contained inside the AppDir
LD_LIBRARY_PATH='' find $QTOX_APP_DIR -type f -exec ldd {} 2>&1 \; | grep '=>' | grep -v $QTOX_APP_DIR

# Warning: This is hard coded to debain:stretch.
libs=(
# copy OpenSSL libs to AppImage
/usr/lib/x86_64-linux-gnu/libssl.so
/usr/lib/x86_64-linux-gnu/libcrypt.so
/usr/lib/x86_64-linux-gnu/libcrypto.so
# Also bundle libjack.so* without which the AppImage does not work in Fedora Workstation
/usr/lib/x86_64-linux-gnu/libjack.so.0
# And libglib needed by Red Hat and derivatives to work with our old gnutls
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
)

for lib in "${libs[@]}"; do
lib_file_name=$(basename "$lib")
cp -P $(echo "$lib"*) "$LOCAL_LIB_DIR"
patchelf --set-rpath '$ORIGIN' "$LOCAL_LIB_DIR/$lib_file_name"
done
eval ./appimagetool-*.AppImage --appimage-extract-and-run $QTOX_APP_DIR

appimagetool -u "$UPDATE_INFO" $QTOX_APP_DIR qTox-${GIT_VERSION}.x86_64.AppImage

0 comments on commit 8ecfb16

Please sign in to comment.