Debian Codegraph @

.github/workflows/scripts/ffappimagebuild.sh

raw symbols SCIP
1 #!/bin/bash
2 set -ex -o pipefail
3
4 SCRIPT_BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5
6 APPDIR=$1
7 export LINUXDEPLOY_OUTPUT_VERSION=${2:0:7} # linuxdeploy uses this for naming the file
8
9 if [ -z "$APPDIR" ] || [ -z "$LINUXDEPLOY_OUTPUT_VERSION" ]; then
10 echo "Usage: `basename $0` appdir version"
11 echo " appdir is the location to the dumped location that cmake generated"
12 echo " version is the version hash of this build"
13 echo
14 echo " This script does not support overwriting an existing appdir."
15 exit 1
16 fi
17
18 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 sudo apt-get install -y libfuse2
22
23 # TODO: AppStream metainfo
24 PYVER=$(ldd $APPDIR/usr/bin/fontforge | grep -Eom1 'python[0-9\.]+[0-9]+' | head -1 | cut -c 7-)
25 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-get download -y libpython${PYVER}-minimal ; dpkg -x libpython${PYVER}-minimal*.deb . )
30 ( cd $APPDIR ; apt-get download -y libpython${PYVER}-stdlib ; 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 [ ! -f linuxdeploy.AppImage ]; then
34 curl -Lo linuxdeploy.AppImage "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
35 chmod +x linuxdeploy.AppImage
36 fi
37
38 if [ ! -f linuxdeploy-plugin-gtk.sh ]; then
39 curl -Lo linuxdeploy-plugin-gtk.sh "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
40 chmod +x linuxdeploy-plugin-gtk.sh
41 fi
42
43 if [ ! -f appstream-util.AppImage ]; then
44 curl -Lo appstream-util.AppImage "https://github.com/fontforge/debugfonts/releases/download/r1/appstream-util-ef4c8e9-x86_64.AppImage"
45 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 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 find $APPDIR -executable -type f -exec ldd {} \; | grep " => /lib" | cut -d " " -f 2-3 | sort | uniq
60
61 mv FontForge*.AppImage FontForge-$(date +%Y-%m-%d)-$LINUXDEPLOY_OUTPUT_VERSION-x86_64.AppImage