mirror of
https://oauth2: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@github.com/m1ngsama/TNT.git
synced 2026-06-26 05:34:39 +08:00
packaging: prepare package manager installs
This commit is contained in:
parent
36dbe8d549
commit
b4e714ed44
5 changed files with 133 additions and 7 deletions
26
Makefile
26
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
|
||||
|
|
|
|||
34
packaging/README.md
Normal file
34
packaging/README.md
Normal file
|
|
@ -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.
|
||||
25
packaging/arch/PKGBUILD
Normal file
25
packaging/arch/PKGBUILD
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Maintainer: M1ng <REPLACE_WITH_EMAIL>
|
||||
|
||||
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"
|
||||
}
|
||||
34
packaging/debian/README.md
Normal file
34
packaging/debian/README.md
Normal file
|
|
@ -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`
|
||||
21
packaging/homebrew/tnt-chat.rb
Normal file
21
packaging/homebrew/tnt-chat.rb
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue