From 904c113696cb4ae022e96540d827cee7123e4aeb Mon Sep 17 00:00:00 2001 From: Mike Kasberg Date: Mon, 6 Jan 2025 20:40:52 -0700 Subject: [PATCH] Revert "Simplify to dpkg-deb" This reverts commit 38e24068213f06e2a9185135ca68c94e43e252cc. And also modifies a few things in doing so. Building a source package using debuild is necessary for using a Launchpad PPA. --- .github/workflows/build.yml | 5 +-- build-ghostty.sh | 51 +++++++--------------------- changelog.Debian => debian/changelog | 0 {DEBIAN => debian}/control | 12 +++++-- copyright => debian/copyright | 0 debian/install | 1 + debian/patches/000-libbz2.patch | 14 ++++++++ debian/patches/series | 1 + debian/rules | 33 ++++++++++++++++++ debian/source/format | 1 + setup-env.sh | 2 +- 11 files changed, 73 insertions(+), 47 deletions(-) rename changelog.Debian => debian/changelog (100%) rename {DEBIAN => debian}/control (59%) rename copyright => debian/copyright (100%) create mode 100644 debian/install create mode 100644 debian/patches/000-libbz2.patch create mode 100644 debian/patches/series create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0613c3..5d663d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,13 +28,10 @@ jobs: - name: Build Ghostty run: ./build-ghostty.sh - - - name: Lint .deb Package - run: lintian ghostty_*.deb || true # Lintian shouldn't fail our build yet - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: package-${{ matrix.ubuntu_version }} retention-days: 7 - path: ghostty_*.deb + path: ghostty_*.* diff --git a/build-ghostty.sh b/build-ghostty.sh index 8669962..b260273 100755 --- a/build-ghostty.sh +++ b/build-ghostty.sh @@ -11,6 +11,12 @@ UBUNTU_DIST=$(lsb_release -sc) FULL_VERSION="$GHOSTTY_VERSION-0~ppa2" +DEBEMAIL="kasberg.mike@gmail.com" +DEBFULLNAME="Mike Kasberg" +DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -I -us -uc" +DEBUILD_LINTIAN_OPTS="-i -I --show-overrides" +DEB_BUILD_MAINT_OPTIONS="hardening=+all" + # Fetch Ghostty Source wget -q "https://release.files.ghostty.org/$GHOSTTY_VERSION/ghostty-$GHOSTTY_VERSION.tar.gz" wget -q "https://release.files.ghostty.org/$GHOSTTY_VERSION/ghostty-$GHOSTTY_VERSION.tar.gz.minisig" @@ -19,44 +25,11 @@ minisign -Vm "ghostty-$GHOSTTY_VERSION.tar.gz" -P RWQlAjJC23149WL2sEpT/l0QKy7hMI rm ghostty-$GHOSTTY_VERSION.tar.gz.minisig tar -xzmf "ghostty-$GHOSTTY_VERSION.tar.gz" +ln -s "ghostty-$GHOSTTY_VERSION.tar.gz" "ghostty_$GHOSTTY_VERSION.orig.tar.gz" -cd "ghostty-$GHOSTTY_VERSION" +cp -r debian "ghostty-$GHOSTTY_VERSION/debian" -# On Ubuntu it's libbz2, not libbzip2 -sed -i 's/linkSystemLibrary2("bzip2", dynamic_link_opts)/linkSystemLibrary2("bz2", dynamic_link_opts)/' build.zig - -# Fetch Zig Cache -ZIG_GLOBAL_CACHE_DIR=/tmp/offline-cache ./nix/build-support/fetch-zig-cache.sh - -# Build Ghostty with zig -zig build \ - --summary all \ - --prefix ./zig-out/usr \ - --system /tmp/offline-cache/p \ - -Doptimize=ReleaseFast \ - -Dcpu=baseline \ - -Dpie=true \ - -Demit-docs \ - -Dversion-string=$GHOSTTY_VERSION - -# Debian control files -cp -r ../DEBIAN/ ./zig-out/DEBIAN/ - -# Changelog and copyright -mkdir -p ./zig-out/usr/share/doc/ghostty/ -cp ../copyright ./zig-out/usr/share/doc/ghostty/ -cp ../changelog.Debian ./zig-out/usr/share/doc/ghostty/ -sed -i "s/DIST/$UBUNTU_DIST/" zig-out/usr/share/doc/ghostty/changelog.Debian -gzip -n -9 zig-out/usr/share/doc/ghostty/changelog.Debian - -# Compress manpages -gzip -n -9 zig-out/usr/share/man/man1/ghostty.1 -gzip -n -9 zig-out/usr/share/man/man5/ghostty.5 - -# Zsh looks for /usr/local/share/zsh/site-functions/ -# but looks for /usr/share/zsh/vendor-completions/ -# (note the difference when we're not in /usr/local). -mv zig-out/usr/share/zsh/site-functions zig-out/usr/share/zsh/vendor-completions - -dpkg-deb --build zig-out ghostty_${FULL_VERSION}_amd64.deb -mv ghostty_${FULL_VERSION}_amd64.deb ../ +# Build Ghostty +cd "ghostty-$GHOSTTY_VERSION" +# TODO remove --prepend-path so we can work on a PPA build server +debuild --prepend-path /usr/local/bin -S -us -uc diff --git a/changelog.Debian b/debian/changelog similarity index 100% rename from changelog.Debian rename to debian/changelog diff --git a/DEBIAN/control b/debian/control similarity index 59% rename from DEBIAN/control rename to debian/control index c5b822d..16c4b80 100644 --- a/DEBIAN/control +++ b/debian/control @@ -2,11 +2,17 @@ Source: ghostty Section: utils Priority: optional Maintainer: Mike Kasberg +Build-Depends: debhelper-compat (= 13), libgtk-4-dev, libadwaita-1-dev, libonig-dev, libbz2-dev +Standards-Version: 4.6.1 Homepage: https://ghostty.org/ +Rules-Requires-Root: no +Vcs-Git: https://github.com/ghostty-org/ghostty.git +Vcs-Browser: https://github.com/ghostty-org/ghostty + Package: ghostty -Version: 1.0.1-0~ppa2 -Architecture: amd64 -Depends: libadwaita-1-0, libc6, libfontconfig1, libfreetype6, libglib2.0-0t64, libgtk-4-1, libharfbuzz0b, libonig5, libx11-6 +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, ${shlibs:Depends} Description: Fast, feature-rich, and cross-platform terminal emulator. Ghostty is a terminal emulator that differentiates itself by being fast, feature-rich, and native. While there are many excellent terminal emulators diff --git a/copyright b/debian/copyright similarity index 100% rename from copyright rename to debian/copyright diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..a3ea52f --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +zig-out/usr / diff --git a/debian/patches/000-libbz2.patch b/debian/patches/000-libbz2.patch new file mode 100644 index 0000000..0992fd9 --- /dev/null +++ b/debian/patches/000-libbz2.patch @@ -0,0 +1,14 @@ +From: Mike Kasberg +Description: Patch libbzip2 to libbz2 for debian +diff -Nru ghostty-1.0.1.orig/build.zig ghostty-1.0.1/build.zig +--- ghostty-1.0.1.orig/build.zig ++++ ghostty-1.0.1/build.zig +@@ -1064,7 +1064,7 @@ + step.root_module.addImport("freetype", freetype_dep.module("freetype")); + + if (b.systemIntegrationOption("freetype", .{})) { +- step.linkSystemLibrary2("bzip2", dynamic_link_opts); ++ step.linkSystemLibrary2("bz2", dynamic_link_opts); + step.linkSystemLibrary2("freetype2", dynamic_link_opts); + } else { + step.linkLibrary(freetype_dep.artifact("freetype")); diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4d5614a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +000-libbz2.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4d7dae3 --- /dev/null +++ b/debian/rules @@ -0,0 +1,33 @@ +#!/usr/bin/make -f +# You must remove unused comment lines for the released package. +export DH_VERBOSE = 1 +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 + +%: + dh $@ + +override_dh_auto_configure: + ZIG_GLOBAL_CACHE_DIR=/tmp/offline-cache ./nix/build-support/fetch-zig-cache.sh + +override_dh_auto_build: + zig build \ + --summary all \ + --prefix ./zig-out/usr \ + --system /tmp/offline-cache/p \ + -Doptimize=ReleaseFast \ + -Dcpu=baseline \ + -Dpie=true \ + -Demit-docs \ + -Dversion-string=1.0.1 + +#override_dh_auto_install: +# dh_auto_install -- prefix=/usr + +override_dh_install: + dh_install + # Zsh looks for /usr/local/share/zsh/site-functions/ + # but looks for /usr/share/zsh/vendor-completions/ + # (note the difference when we're not in /usr/local). + mv zig-out/usr/share/zsh/site-functions zig-out/usr/share/zsh/vendor-completions diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/setup-env.sh b/setup-env.sh index 1eb67f6..9d91a5f 100755 --- a/setup-env.sh +++ b/setup-env.sh @@ -8,7 +8,7 @@ DEBIAN_FRONTEND="noninteractive" ZIG_VERSION="0.13.0" # Install Build Tools -apt-get -qq update && apt-get -qq -y install build-essential libonig-dev libbz2-dev lintian lsb-release pandoc wget +apt-get -qq update && apt-get -qq -y install build-essential debhelper devscripts pandoc libonig-dev libbz2-dev lsb-release wget wget -q "https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz" tar -xzf minisign-0.11-linux.tar.gz