| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | set -ex -o pipefail |
| 3 | |
| 4 | SCRIPT_BASE="$( cd "$( dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}" )" && pwdscip-shell system . . pwd. )" |
| 5 | |
| 6 | APPDIR=$1 |
| 7 | export LINUXDEPLOY_OUTPUT_VERSION=${2:0:7} # linuxdeploy uses this for naming the file |
| 8 | |
| 9 | if [scip-shell system . . `[`. -z "$APPDIR" ] || [scip-shell system . . `[`. -z "$LINUXDEPLOY_OUTPUT_VERSION" ]; then |
| 10 | echoscip-shell system . . echo. "Usage: `basenamescip-shell system . . basename. $0` appdir version" |
| 11 | echoscip-shell system . . echo. " appdir is the location to the dumped location that cmake generated" |
| 12 | echoscip-shell system . . echo. " version is the version hash of this build" |
| 13 | echoscip-shell system . . echo. |
| 14 | echoscip-shell system . . echo. " This script does not support overwriting an existing appdir." |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | echoscip-shell system . . echo. "Starting appimage build, folder is $APPDIR with version $LINUXDEPLOY_OUTPUT_VERSION" |
| 19 | |
| 20 | # AppImage still needs libfuse2. See https://github.com/AppImage/AppImageKit/issues/1235. |
| 21 | sudoscip-shell system . . sudo. apt-get install -y libfuse2 |
| 22 | |
| 23 | # TODO: AppStream metainfo |
| 24 | PYVER=$(lddscip-shell system . . ldd. $APPDIR/usr/bin/fontforge | grepscip-shell system . . grep. -Eom1 'python[0-9\.]+[0-9]+' | headscip-shell system . . head. -1 | cutscip-shell system . . cut. -c 7-) |
| 25 | echoscip-shell system . . echo. "FontForge built against Python $PYVER" |
| 26 | |
| 27 | # In Ubuntu 20-22 the libpython3-minimal is not automatically included with the default Python installation. |
| 28 | # In Ubuntu 24.04 this doesn't seem to be necessary anymore. |
| 29 | ( cd $APPDIR ; apt-getscip-shell system . . apt-get. download -y libpython${PYVER}-minimal ; dpkgscip-shell system . . dpkg. -x libpython${PYVER}-minimal*.deb . ) |
| 30 | ( cd $APPDIR ; apt-getscip-shell system . . apt-get. download -y libpython${PYVER}-stdlib ; dpkgscip-shell system . . dpkg. -x libpython${PYVER}-stdlib*.deb . ) |
| 31 | "python${PYVER}" -m pip install -I --target "$APPDIR/usr/lib/python${PYVER}/dist-packages" setuptools |
| 32 | |
| 33 | if [scip-shell system . . `[`. ! -f linuxdeploy.AppImage ]; then |
| 34 | curlscip-shell system . . curl. -Lo linuxdeploy.AppImage "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" |
| 35 | chmodscip-shell system . . chmod. +x linuxdeploy.AppImage |
| 36 | fi |
| 37 | |
| 38 | if [scip-shell system . . `[`. ! -f linuxdeploy-plugin-gtk.sh ]; then |
| 39 | curlscip-shell system . . curl. -Lo linuxdeploy-plugin-gtk.sh "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" |
| 40 | chmodscip-shell system . . chmod. +x linuxdeploy-plugin-gtk.sh |
| 41 | fi |
| 42 | |
| 43 | if [scip-shell system . . `[`. ! -f appstream-util.AppImage ]; then |
| 44 | curlscip-shell system . . curl. -Lo appstream-util.AppImage "https://github.com/fontforge/debugfonts/releases/download/r1/appstream-util-ef4c8e9-x86_64.AppImage" |
| 45 | chmodscip-shell system . . chmod. +x appstream-util.AppImage |
| 46 | fi |
| 47 | |
| 48 | ./appstream-util.AppImage validate-strict $APPDIR/usr/share/metainfo/org.fontforge.FontForge.appdata.xml |
| 49 | |
| 50 | export DEPLOY_GTK_VERSION=3 |
| 51 | |
| 52 | # linuxdeploy automatically detectes and uses custom AppRun |
| 53 | installscip-shell system . . install. -m 755 $SCRIPT_BASE/../../../Packaging/AppDir/AppRun $APPDIR/AppRun |
| 54 | |
| 55 | ./linuxdeploy.AppImage --appdir $APPDIR --plugin gtk --output appimage -i ../desktop/tango/scalable/org.fontforge.FontForge.svg -d ../desktop/org.fontforge.FontForge.desktop |
| 56 | |
| 57 | # List remaining external dependencies for debug purposes |
| 58 | ./linuxdeploy.AppImage --appimage-extract |
| 59 | findscip-shell system . . find. $APPDIR -executable -type f -exec ldd {} \; | grepscip-shell system . . grep. " => /lib" | cutscip-shell system . . cut. -d " " -f 2-3 | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. |
| 60 | |
| 61 | mvscip-shell system . . mv. FontForge*.AppImage FontForge-$(datescip-shell system . . date. +%Y-%m-%d)-$LINUXDEPLOY_OUTPUT_VERSION-x86_64.AppImage |