Skip to content

Commit

Permalink
feat(appimage): add support for Ubuntu Lunar
Browse files Browse the repository at this point in the history
  • Loading branch information
git-developer committed Oct 2, 2023
1 parent 4921dfe commit 676a8e0
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 35 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Build and publish AppImages

env:
UBUNTU_RELEASE: jammy
UBUNTU_PUBKEY: 871920D1991BC93C
BASE_OS: ubuntu
BASE_CODENAME: jammy
APT_PUBKEY: 871920D1991BC93C

on:
pull_request:
Expand Down Expand Up @@ -39,7 +40,8 @@ jobs:
platforms: ${{ matrix.platform }}
outputs: build
build-args: |
UBUNTU_RELEASE
BASE_OS
BASE_CODENAME
- name: Prepare environment to build AppImage
env:
Expand All @@ -54,8 +56,8 @@ jobs:
APPIMAGE_SOURCE=build
APPIMAGE_VERSION="${GITHUB_REF_SLUG}"
APPIMAGE_APT_ARCH="${TARGETARCH}"
APPIMAGE_APT_DISTRO="${UBUNTU_RELEASE}"
APPIMAGE_APT_PUBKEY="${UBUNTU_PUBKEY}"
APPIMAGE_APT_DISTRO="${BASE_CODENAME}"
APPIMAGE_APT_PUBKEY="${APT_PUBKEY}"
APPIMAGE_ARCH="${TARGETMACHINE}"
printenv | grep ^APPIMAGE_ >>"${GITHUB_ENV}"
Expand Down
73 changes: 50 additions & 23 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ AppDir:
set -eu
# appimage-builder expects .desktop file to start with appinfo-id
path="${TARGET_APPDIR}/usr/share/applications"
ln -sr "${path}/sc-controller.desktop" "${path}/org.ryochan7.sc-controller.desktop"
desktop="$(find "${TARGET_APPDIR}/usr" -name sc-controller.desktop)"
ln -sr "${desktop}" "${TARGET_APPDIR}/usr/share/applications/org.ryochan7.sc-controller.desktop"
# appimage-builder expects utf-8 encoding when patching shebangs,
# but pygettext3 has iso-8859-1 encoding
Expand All @@ -48,47 +48,74 @@ AppDir:
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}} main universe
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-updates main universe
- sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ {{APPIMAGE_APT_DISTRO}}-security main universe

include:
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- gir1.2-rsvg-2.0
- libbluetooth3
- librsvg2-common
- python3-evdev
- python3-gi-cairo
- python3-pylibacl
- python3-vdf
- shared-mime-info # required for gui
- binutils # required for detection of bluetooth library
- coreutils # provides /usr/bin/env
- shared-mime-info # required for gui if host provides no MIME info, e.g. when XDG_DATA_DIRS is missing
exclude:
- gcc*
- libblkid*
- libdb*
- libgcc*
- libicu*
- libmount*
- libncurses*
- libreadline*
- libssl*
- libstdc*
- libtirpc*
- readline*
- "*crypt*"
- "*krb*"
- "*sqlite*"
- gcc* # development
- libgcc* # development
- libpcre* # development
- libstdc* # development
- libtirpc* # development
- libuuid* # development
- libattr* # filesystem
- libblkid* # filesystem
- libmount* # filesystem
- libbz* # codec
- libjpeg* # codec
- liblzma* # codec
- libtiff* # codec
- libxml* # codec
- libwebp* # codec
- media-types # codec
- libpixman* # X
- libxext* # X
- libxrender* # X
- libfontconfig* # fonts
- libfreetype* # fonts
- libfribidi* # i18n
- libicu* # i18n
- libgmp* # arithmetics
- libmpdec* # arithmetics
- libncurses* # terminal
- libreadline* # terminal
- readline* # terminal
- libssl* # security
- "*crypt*" # security
- "*krb*" # security
- libdb* # database
- "*sqlite*" # database
- libnsl* # network


files:
exclude:
- usr/bin/*gold* # alternative for ld
- usr/bin/*gp-display-html* # since Ubuntu Lunatic, requires perl
- usr/lib/*/gconv # unicode
- usr/lib/*/gdk-pixbuf-2.0/*/loaders/libpixbufloader-[!s]*.so # only svg is required
- usr/lib/*/glib-2.0
- usr/lib/python*/cgi.py
- usr/lib/python*/email
- usr/lib/python*/test
- usr/lib/python*/unittest
- usr/share/doc
- usr/share/glib-2.0
- usr/share/gtk-doc
- usr/share/icu
- usr/share/local
- usr/share/locale
- usr/share/man
- usr/share/python3/runtime.d
- usr/share/thumbnailers
- usr/share/glib-2.0

runtime:
env:
Expand All @@ -97,7 +124,7 @@ AppDir:
# Fortunately the site-packages directory is on the $PATH, so we add $PATH instead.
# It must precede an existing $PYTHONPATH to work.
PYTHONPATH: "${APPDIR}/usr/lib/python3/dist-packages:${PATH}:${PYTHONPATH}"
GI_TYPELIB_PATH: "${APPDIR}/usr/lib/girepository-1.0:${APPDIR}/usr/lib/{{APPIMAGE_ARCH}}-linux-gnu/girepository-1.0"
SCC_SHARED: "${APPDIR}/usr/share/scc"

AppImage:
arch: "{{APPIMAGE_ARCH}}"
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG UBUNTU_RELEASE=latest
FROM ubuntu:$UBUNTU_RELEASE AS build-stage
ARG BASE_OS=ubuntu
ARG BASE_CODENAME=jammy
FROM $BASE_OS:$BASE_CODENAME AS build-stage

# Download build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -12,7 +13,7 @@ ARG TARGET=/build/usr

# Build and install
RUN python3 setup.py build --executable "/usr/bin/env python3" && \
python3 setup.py install --single-version-externally-managed --prefix "${TARGET}" --record /dev/null
python3 setup.py install --single-version-externally-managed --home "${TARGET}" --record /dev/null

# Provide input-event-codes.h as fallback for runtime systems without linux headers
RUN cp -a \
Expand All @@ -24,14 +25,15 @@ RUN suffix=".cpython-*-$(uname -m)-linux-gnu.so" && \
find "${TARGET}" -type f -path "*/site-packages/*${suffix}" \
| while read -r path; do ln -sfr "${path}" "${path%${suffix}}.so"; done

# Put AppStream metadata to required location
RUN mkdir -p "${TARGET}/share/metainfo" && \
cp -a scripts/sc-controller.appdata.xml "${TARGET}/share/metainfo/"
# Put AppStream metadata to required location according to https://wiki.debian.org/AppStream/Guidelines
RUN metainfo=/build/usr/share/metainfo && \
mkdir -p "${metainfo}" && \
cp -a scripts/sc-controller.appdata.xml "${metainfo}"

# Convert icon to png format (required for icons in .desktop file)
RUN iconpath="${TARGET}/share/icons/hicolor/512x512/apps" && \
mkdir -p "${iconpath}" && \
rsvg-convert --background-color none -o "${iconpath}/sc-controller.png" "${TARGET}/share/pixmaps/sc-controller.svg"
rsvg-convert --background-color none -o "${iconpath}/sc-controller.png" images/sc-controller.svg

# Store build metadata
ARG TARGETOS TARGETARCH TARGETVARIANT
Expand Down

0 comments on commit 676a8e0

Please sign in to comment.