Skip to content

Commit

Permalink
Add Linux AppImage build process for CI (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelrosa authored Dec 5, 2024
1 parent 7fad522 commit c3be52f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ jobs:
with:
name: tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
path: output/tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.zip
- name: "📤 Uploading Linux AppImage packages..."
uses: actions/upload-artifact@v4
if: matrix.platform == 'linux'
with:
name: tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.AppImage
path: output/tiddlydesktop-${{ matrix.platform-for-pkg }}-v${{ steps.td-version.outputs.version }}.AppImage
outputs:
td-version: ${{ steps.td-version.outputs.version }}

Expand All @@ -115,3 +121,4 @@ jobs:
draft: true
files: |
tiddlydesktop-*-v${{ needs.build-and-package.outputs.td-version }}.zip
tiddlydesktop-*-v${{ needs.build-and-package.outputs.td-version }}.AppImage
45 changes: 45 additions & 0 deletions bld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,49 @@ cp -RH nwjs/nwjs-sdk-v${NWJS_VERSION}-linux-ia32/* output/linux32/TiddlyDesktop-
cp -RH source/* output/linux32/TiddlyDesktop-linux32-v$(./bin/get-version-number)
}

# # Linux AppImage
# # For Github CI, only
build_linux_appimage() {
appdir="output/AppDir.$ARCH"
build_dependencies="curl findutils desktop-file-utils"
font_packages="fonts-dejavu-core fonts-dejavu-extra"
runtime_dependencies="$font_packages libnss3 libnspr4 libasound2-dev libatomic1 libatk1.0-0 libcups2-dev libxkbcommon-dev libatspi2.0-dev libxcomposite-dev libxdamage-dev libxfixes-dev libxrandr-dev libpango1.0-dev libgbm-dev libcairo2-dev libxi-dev libxrender-dev libwayland-dev libfribidi-dev libthai-dev libharfbuzz-dev libpng-dev libfontconfig-dev libfreetype-dev libpixman-1-dev libdatrie-dev libgraphite2-dev libbz2-dev fonts-dejavu"
package_arch=""
appimagetool_arch=""
sudo apt-get install -y $runtime_dependencies $build_dependencies

case "$ARCH" in
ia32)
package_arch="linux32"
appimagetool_arch="i686"
curl -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-i686.AppImage -o output/appimagetool-$ARCH.AppImage
;;
x64)
package_arch="linux64"
appimagetool_arch="x86_64"
curl -L https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -o output/appimagetool-$ARCH.AppImage
;;
esac

chmod u+x output/appimagetool-$ARCH.AppImage
mkdir -p $appdir
mkdir -p $appdir/usr/{bin,lib,share}
mkdir -p $appdir/usr/share/fonts/truetype/dejavu
cp icons/app-icon1024.png $appdir/tiddlydesktop.png
cp linux/AppRun $appdir/
cp linux/tiddlydesktop.desktop $appdir/
cp -r output/$package_arch/TiddlyDesktop-$package_arch-v$(./bin/get-version-number)/* $appdir/usr/bin/

libraries=$(dpkg -L $runtime_dependencies | grep "\.so" 2>/dev/null)
for f in $libraries; do
cp $f* $appdir/usr/lib/
done

dpkg -L $font_packages | grep "\.ttf" 2>/dev/null | xargs -I '{}' -- cp '{}' $appdir/usr/share/fonts/truetype/dejavu/
VERSION=$(./bin/get-version-number)
ARCH=$appimagetool_arch ./output/appimagetool-$ARCH.AppImage --no-appstream $appdir output/tiddlydesktop-$package_arch-v$(./bin/get-version-number).AppImage
}

if [ "$CI" = "true" ]; then
# Running in GitHub Actions, where each platform builds as a separate step, in parallel, with PLATFORM and ARCH variables supplied by the GitHub Actions script
case "$PLATFORM-$ARCH" in
Expand All @@ -118,9 +161,11 @@ if [ "$CI" = "true" ]; then
;;
linux-ia32)
build_linux32
build_linux_appimage
;;
linux-x64)
build_linux64
build_linux_appimage
;;
esac
else
Expand Down
12 changes: 12 additions & 0 deletions linux/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
SELF=$(readlink -f "$0")
HERE=${SELF%/*}
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
exec "${EXEC}" "$@"
7 changes: 7 additions & 0 deletions linux/tiddlydesktop.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Categories=Utility;TextEditor
Exec=nw
Icon=tiddlydesktop
Name=Tiddly Desktop
Type=Application
Version=1.4
12 changes: 12 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ Unzip into a folder and run `TiddlyWiki.app` or `nw.exe` and for linux `nw`

Note that TiddlyDesktop will not work correctly from a Windows UNC network share (eg ``\\MY-SERVER\SHARE\MyFolder``). You should map the network share to a local drive, and run it from there.

## Linux AppImage

Linux releases are also available in the AppImage format. The AppImages are compatible with glibc-based Desktop Linux distributions such as Ubuntu, Fedora, and Arch Linux. The AppImages are _not_ compatible with musl-based Linux distributions such as Alpine Linux, nor are they compatible with Linux server distributions; Server distributions don't provide enough of the required dependencies.

To use an AppImage, your Linux distribution must provide `fusermount3`, which is typically provided in a package named `fuse3`.

Before you can execute an AppImage, you must set the executable permission:

```
chmod u+x tiddlydesktop-*-v*.AppImage
```

## NixOS

To install TiddlyDesktop on NixOS, you first need to add this repo to your `configuration.nix`; Using a `let` expression at the top of the file is a good approach:
Expand Down

0 comments on commit c3be52f

Please sign in to comment.