diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 740820ef..93cadb55 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -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: @@ -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: @@ -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}" diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index 8e474a69..094ea8cd 100644 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -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 @@ -48,9 +48,8 @@ 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 @@ -58,37 +57,65 @@ AppDir: - 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: @@ -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}}" diff --git a/Dockerfile b/Dockerfile index b59805ef..a0bd33bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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 \ @@ -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