diff --git a/Makefile b/Makefile index 01f64f9..8231fbb 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,12 @@ OBJECTS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o) DEPS = $(OBJECTS:.o=.d) TARGET = tnt -.PHONY: all clean install uninstall debug release asan valgrind check test unit-test info +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +MANDIR ?= $(PREFIX)/share/man +SYSTEMD_UNIT_DIR ?= $(PREFIX)/lib/systemd/system + +.PHONY: all clean install install-systemd uninstall uninstall-systemd debug release asan valgrind check test unit-test info all: $(TARGET) @@ -45,14 +50,21 @@ clean: @echo "Clean complete" install: $(TARGET) - install -d $(DESTDIR)/usr/local/bin - install -m 755 $(TARGET) $(DESTDIR)/usr/local/bin/ - install -d $(DESTDIR)/usr/local/share/man/man1 - install -m 644 tnt.1 $(DESTDIR)/usr/local/share/man/man1/ + install -d $(DESTDIR)$(BINDIR) + install -m 755 $(TARGET) $(DESTDIR)$(BINDIR)/ + install -d $(DESTDIR)$(MANDIR)/man1 + install -m 644 tnt.1 $(DESTDIR)$(MANDIR)/man1/ + +install-systemd: + install -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) + install -m 644 tnt.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ uninstall: - rm -f $(DESTDIR)/usr/local/bin/$(TARGET) - rm -f $(DESTDIR)/usr/local/share/man/man1/tnt.1 + rm -f $(DESTDIR)$(BINDIR)/$(TARGET) + rm -f $(DESTDIR)$(MANDIR)/man1/tnt.1 + +uninstall-systemd: + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/tnt.service # Development targets debug: CFLAGS += -g -DDEBUG diff --git a/packaging/README.md b/packaging/README.md new file mode 100644 index 0000000..cae9bde --- /dev/null +++ b/packaging/README.md @@ -0,0 +1,34 @@ +# Packaging + +This directory contains package-manager drafts for TNT. They are intentionally +kept out of the root install path and should be reviewed before submission to +any public registry. + +## Current targets + +- `arch/PKGBUILD` - AUR-ready draft for `tnt-chat`. +- `homebrew/tnt-chat.rb` - Homebrew tap formula draft. +- `debian/README.md` - Ubuntu PPA / Debian packaging notes. + +## Release checklist + +1. Confirm `TNT_VERSION` in `include/common.h` and the manpage version match. +2. Create a GitHub release tag such as `v1.0.0`. +3. Build and upload release tarballs or rely on GitHub source archives. +4. Replace placeholder checksums in package drafts. +5. Verify package contents in an isolated directory: + + ```sh + make clean + make + tmpdir="$(mktemp -d)" + make DESTDIR="$tmpdir" PREFIX=/usr install + find "$tmpdir" -type f | sort + ``` + +6. Submit packages manually: + - Arch: upload `PKGBUILD` and generated `.SRCINFO` to AUR. + - Homebrew: open a PR to the project tap, or later Homebrew core if eligible. + - Ubuntu: build Debian source packages and upload to a Launchpad PPA. + +Do not connect these packaging drafts to automatic production deployment. diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..4bb126e --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,25 @@ +# Maintainer: M1ng + +pkgname=tnt-chat +pkgver=1.0.0 +pkgrel=1 +pkgdesc='SSH-native terminal chat server with a Vim-style interface' +arch=('x86_64' 'aarch64') +url='https://github.com/m1ngsama/TNT' +license=('MIT') +depends=('libssh') +makedepends=('gcc' 'make') +source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz") +sha256sums=('SKIP') + +build() { + cd "TNT-${pkgver}" + make +} + +package() { + cd "TNT-${pkgver}" + make DESTDIR="${pkgdir}" PREFIX=/usr install + make DESTDIR="${pkgdir}" PREFIX=/usr install-systemd + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/packaging/debian/README.md b/packaging/debian/README.md new file mode 100644 index 0000000..36f7910 --- /dev/null +++ b/packaging/debian/README.md @@ -0,0 +1,34 @@ +# Debian and Ubuntu Packaging + +Ubuntu distribution should start with a Launchpad PPA. Direct inclusion in +Debian or Ubuntu archives is a separate, slower process and should wait until +the project has a stable release cadence. + +## Recommended path + +1. Keep the upstream project installable with: + + ```sh + make DESTDIR="$pkgdir" PREFIX=/usr install + ``` + +2. Create Debian packaging metadata from a release tarball: + + - `debian/control` + - `debian/rules` + - `debian/changelog` + - `debian/copyright` + - `debian/install` + - optional `debian/tnt.service` + +3. Build locally with `debuild` or `dpkg-buildpackage`. +4. Upload the signed source package to a Launchpad PPA. +5. Only after repeated stable releases, consider Debian mentors or Ubuntu + archive sponsorship. + +## Package shape + +- Binary package name: `tnt-chat` +- Installed command: `/usr/bin/tnt` +- Runtime dependency: `libssh` +- Optional systemd unit: `/usr/lib/systemd/system/tnt.service` diff --git a/packaging/homebrew/tnt-chat.rb b/packaging/homebrew/tnt-chat.rb new file mode 100644 index 0000000..92be9b7 --- /dev/null +++ b/packaging/homebrew/tnt-chat.rb @@ -0,0 +1,21 @@ +class TntChat < Formula + desc "SSH-native terminal chat server with a Vim-style interface" + homepage "https://github.com/m1ngsama/TNT" + url "https://github.com/m1ngsama/TNT/archive/refs/tags/v1.0.0.tar.gz" + sha256 "REPLACE_WITH_RELEASE_TARBALL_SHA256" + license "MIT" + + depends_on "libssh" + + def install + system "make" + system "make", "install", "DESTDIR=#{buildpath}/stage", "PREFIX=#{prefix}" + + bin.install "#{buildpath}/stage#{prefix}/bin/tnt" + man1.install "#{buildpath}/stage#{prefix}/share/man/man1/tnt.1" + end + + test do + assert_match version.to_s, shell_output("#{bin}/tnt --version") + end +end