From 6d5f76c593923503ce8d0437191c744353d23373 Mon Sep 17 00:00:00 2001 From: francoism90 Date: Thu, 10 Sep 2026 16:32:37 +0200 Subject: [PATCH] Build host-spawn from source instead of downloading binaries Replaces the per-arch host-spawn binary downloads (pulled straight from GitHub release assets) with a source build via the golang Sdk extension, compiling the same v1.6.2 tag with its dependencies vendored and pinned by commit. This avoids shipping prebuilt binary blobs and matches Flathub's general preference for building from source. Ported from flathub/com.vscodium.codium's host-spawn module, which already does this for the same host-spawn version - same pinned dependency commits, reused verbatim. The Flatter CI workflow now also pre-installs the golang Sdk extension alongside the Electron BaseApp, since Flatter's flatpak-builder invocation doesn't auto-install manifest dependencies the way a local `--install-deps-from=flathub` build does. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/flatter.yml | 14 ++++---- com.visualstudio.code.yaml | 61 ++++++++++++++++++++--------------- modules.txt | 9 ++++++ 3 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 modules.txt diff --git a/.github/workflows/flatter.yml b/.github/workflows/flatter.yml index 54bad76..c5f5b10 100644 --- a/.github/workflows/flatter.yml +++ b/.github/workflows/flatter.yml @@ -33,14 +33,16 @@ jobs: - name: Install Flatpak Dependencies # The freedesktop Flatter image ships the Platform/Sdk but not the - # Electron BaseApp our manifest needs (`base:`, providing zypak). - # flatpak-builder doesn't auto-install it - unlike a local - # `--install-deps-from=flathub` build, Flatter's own flatpak-builder - # invocation has no such flag, so it must already be present before - # "Build Packages" runs. + # Electron BaseApp our manifest needs (`base:`, providing zypak) or + # the golang Sdk extension (`sdk-extensions:`, needed to build + # host-spawn from source). flatpak-builder doesn't auto-install + # these - unlike a local `--install-deps-from=flathub` build, + # Flatter's own flatpak-builder invocation has no such flag, so + # they must already be present before "Build Packages" runs. run: | flatpak install --noninteractive flathub \ - org.electronjs.Electron2.BaseApp//25.08 + org.electronjs.Electron2.BaseApp//25.08 \ + org.freedesktop.Sdk.Extension.golang//25.08 - name: Build Packages uses: andyholmes/flatter@main diff --git a/com.visualstudio.code.yaml b/com.visualstudio.code.yaml index 8c3bbb5..f1df128 100644 --- a/com.visualstudio.code.yaml +++ b/com.visualstudio.code.yaml @@ -2,6 +2,8 @@ app-id: com.visualstudio.code runtime: org.freedesktop.Sdk runtime-version: '25.08' sdk: org.freedesktop.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.golang base: org.electronjs.Electron2.BaseApp base-version: '25.08' command: code @@ -141,31 +143,38 @@ modules: - name: host-spawn buildsystem: simple - build-commands: - - install -Dm755 host-spawn /app/bin/host-spawn + build-options: + append-path: /usr/lib/sdk/golang/bin + env: + GOBIN: /app/bin + GOFLAGS: -modcacherw + GOPATH: /run/build/host-spawn sources: - - type: file - url: https://github.com/1player/host-spawn/releases/download/v1.6.2/host-spawn-x86_64 - sha256: 077bc09a087292447ba17cfe2156a93f71bf56c4c6be8e38d3abe65c1240f34c - dest-filename: host-spawn - only-arches: [x86_64] - x-checker-data: - type: json - url: https://api.github.com/repos/1player/host-spawn/releases/latest - version-query: .tag_name - timestamp-query: .published_at - url-query: '"https://github.com/1player/host-spawn/releases/download/" + - $version + "/host-spawn-x86_64"' - - - type: file - url: https://github.com/1player/host-spawn/releases/download/v1.6.2/host-spawn-aarch64 - sha256: 8b30215b0b6b66c8c34a3e22d372dd39020295cd0904608bc2c5f5ecff829e5f - dest-filename: host-spawn - only-arches: [aarch64] + - type: git + url: https://github.com/1player/host-spawn + commit: d76c3a5196a8e0943f6a1c7c9f1acde4bd83c40c + tag: v1.6.2 x-checker-data: - type: json - url: https://api.github.com/repos/1player/host-spawn/releases/latest - version-query: .tag_name - timestamp-query: .published_at - url-query: '"https://github.com/1player/host-spawn/releases/download/" + - $version + "/host-spawn-aarch64"' + type: git + tag-pattern: ^v([\d.]+)$ + # The below dependencies need to be updated manually, avoid adding them to the external checker + - dest: vendor + path: modules.txt + type: file + - type: git + dest: vendor/github.com/godbus/dbus/v5 + url: https://github.com/godbus/dbus.git + commit: e523abc905595cf17fb0001a7d77eaaddfaa216d + tag: v5.1.0 + - type: git + dest: vendor/github.com/pkg/term + url: https://github.com/pkg/term.git + commit: d02e49dd31404f3c3cf4b5469b28942194e0ca23 + tag: v1.1.0 + - type: git + dest: vendor/golang.org/x/sys + url: https://go.googlesource.com/sys.git + commit: 13b15b780d9013988b1fb0e79e30b2528a877638 + tag: v0.15.0 + build-commands: + - go install -mod=vendor -ldflags "-X main.Version=$(git describe --tags)" diff --git a/modules.txt b/modules.txt new file mode 100644 index 0000000..2791535 --- /dev/null +++ b/modules.txt @@ -0,0 +1,9 @@ +# github.com/godbus/dbus/v5 v5.1.0 +## explicit; go 1.12 +github.com/godbus/dbus/v5 +# github.com/pkg/term v1.1.0 +## explicit; go 1.14 +github.com/pkg/term/termios +# golang.org/x/sys v0.15.0 +## explicit; go 1.18 +golang.org/x/sys/unix