snap: build from source tarball

This commit is contained in:
Jeffrey C. Ollie 2025-03-19 19:21:36 -05:00
parent f5b5a36835
commit 6bd9e35cd6
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
3 changed files with 22 additions and 6 deletions

View File

@ -353,15 +353,19 @@ jobs:
os: os:
[namespace-profile-ghostty-snap, namespace-profile-ghostty-snap-arm64] [namespace-profile-ghostty-snap, namespace-profile-ghostty-snap-arm64]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
needs: test needs: [test, build-dist]
env: env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
steps: steps:
- uses: actions/checkout@v4 - name: Download Source Tarball Artifacts
uses: actions/download-artifact@v4
with: with:
fetch-depth: 0 name: source-tarball
fetch-tags: true - name: Extract tarball
run: |
mkdir dist
tar --verbose --extract --strip-components 1 --directory dist --file ghostty-source.tar.gz
- name: Setup Cache - name: Setup Cache
uses: namespacelabs/nscloud-cache-action@v1.2.0 uses: namespacelabs/nscloud-cache-action@v1.2.0
with: with:
@ -371,6 +375,8 @@ jobs:
- run: sudo apt install -y udev - run: sudo apt install -y udev
- run: sudo systemctl start systemd-udevd - run: sudo systemctl start systemd-udevd
- uses: snapcore/action-build@v1 - uses: snapcore/action-build@v1
with:
path: dist
build-windows: build-windows:
runs-on: windows-2022 runs-on: windows-2022

View File

@ -70,7 +70,6 @@ parts:
plugin: nil plugin: nil
build-attributes: [enable-patchelf] build-attributes: [enable-patchelf]
build-packages: build-packages:
- blueprint-compiler
- libgtk-4-dev - libgtk-4-dev
- libadwaita-1-dev - libadwaita-1-dev
# TODO: Add when the Snap is updated to Ubuntu 24.10+ # TODO: Add when the Snap is updated to Ubuntu 24.10+
@ -80,7 +79,7 @@ parts:
- patchelf - patchelf
- gettext - gettext
override-build: | override-build: |
craftctl set version=$(git describe --abbrev=8) craftctl set version=$(cat VERSION)
$CRAFT_PART_SRC/../../zig/src/zig build -Dpatch-rpath=\$ORIGIN/../usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR -Doptimize=ReleaseFast $CRAFT_PART_SRC/../../zig/src/zig build -Dpatch-rpath=\$ORIGIN/../usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/core24/current/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR -Doptimize=ReleaseFast
cp -rp zig-out/* $CRAFT_PART_INSTALL/ cp -rp zig-out/* $CRAFT_PART_INSTALL/
sed -i 's|Icon=com.mitchellh.ghostty|Icon=/snap/ghostty/current/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png|g' $CRAFT_PART_INSTALL/share/applications/com.mitchellh.ghostty.desktop sed -i 's|Icon=com.mitchellh.ghostty|Icon=/snap/ghostty/current/share/icons/hicolor/512x512/apps/com.mitchellh.ghostty.png|g' $CRAFT_PART_INSTALL/share/applications/com.mitchellh.ghostty.desktop

View File

@ -36,6 +36,17 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyDist {
"--format=tgz", "--format=tgz",
}); });
// embed the Ghostty version in the tarball
{
const version = b.addWriteFiles().add("VERSION", b.fmt("{}", .{cfg.version}));
// --add-file uses the most recent --prefix to determine the path
// in the archive to copy the file (the directory only).
git_archive.addArg(b.fmt("--prefix=ghostty-{}/", .{
cfg.version,
}));
git_archive.addPrefixedFileArg("--add-file=", version);
}
// Add all of our resources into the tarball. // Add all of our resources into the tarball.
for (resources.items) |resource| { for (resources.items) |resource| {
// Our dist path basename may not match our generated file basename, // Our dist path basename may not match our generated file basename,