Skip to content

Commit

Permalink
Revert "Simplify to dpkg-deb"
Browse files Browse the repository at this point in the history
This reverts commit 38e2406.
And also modifies a few things in doing so.

Building a source package using debuild is necessary for using a
Launchpad PPA.
  • Loading branch information
mkasberg committed Jan 7, 2025
1 parent b38e4d2 commit 904c113
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 47 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_*.*
51 changes: 12 additions & 39 deletions build-ghostty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ UBUNTU_DIST=$(lsb_release -sc)
FULL_VERSION="$GHOSTTY_VERSION-0~ppa2"


DEBEMAIL="[email protected]"
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"
Expand All @@ -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
File renamed without changes.
12 changes: 9 additions & 3 deletions DEBIAN/control → debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ Source: ghostty
Section: utils
Priority: optional
Maintainer: Mike Kasberg <[email protected]>
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
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
zig-out/usr /
14 changes: 14 additions & 0 deletions debian/patches/000-libbz2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
From: Mike Kasberg <[email protected]>
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"));
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
000-libbz2.patch
33 changes: 33 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
2 changes: 1 addition & 1 deletion setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 904c113

Please sign in to comment.