Rework build system
Replace the dpkg-buildpackage / debhelper rig with the same pattern
used in vpp-maglev and govpp-snmp-agentx: a Makefile that
cross-compiles CGO-free static binaries for amd64 and arm64, plus a
debian/build-deb.sh that stages the .deb directly with dpkg-deb. The
two arch packages drop into build/ and run on any glibc/musl Linux of
the matching arch.
VERSION is parsed once from debian/changelog and injected at link
time via -ldflags "-X 'main.Version=...' -X 'main.Commit=...' -X
'main.Date=...'", so 's3-genindex -version' is the source of truth
for which build is running. The Version constant in main.go becomes
a var to make this work; the old sync-version make target is gone.
Removes the now-unused debian/{control,rules,install,compat} files
and the matching debhelper artifact entries from .gitignore. build/
is added to .gitignore.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Build one s3-genindex .deb for one architecture.
|
||||
# Usage: build-deb.sh <package> <amd64|arm64> <version>
|
||||
#
|
||||
# The version is also baked into the binary at link time (see Makefile
|
||||
# LDFLAGS), so `s3-genindex -version` is the source of truth for "which
|
||||
# build". The .deb itself only carries the release version.
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGE="${1:?usage: build-deb.sh <package> <amd64|arm64> <version>}"
|
||||
ARCH="${2:?usage: build-deb.sh <package> <amd64|arm64> <version>}"
|
||||
VERSION="${3:?usage: build-deb.sh <package> <amd64|arm64> <version>}"
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PKG="${PACKAGE}_${VERSION}_${ARCH}"
|
||||
STAGING="$(mktemp -d)"
|
||||
trap 'rm -rf "$STAGING"' EXIT
|
||||
|
||||
echo "Building ${PKG}.deb"
|
||||
|
||||
install -d "$STAGING/DEBIAN"
|
||||
install -d "$STAGING/usr/bin"
|
||||
install -d "$STAGING/usr/share/man/man1"
|
||||
|
||||
# s3-genindex is a CLI tool, so /usr/bin (on every login PATH) is the
|
||||
# right place; no /usr/sbin, no systemd unit, no /etc conffile.
|
||||
install -m 755 "$REPO_ROOT/build/${ARCH}/${PACKAGE}" "$STAGING/usr/bin/${PACKAGE}"
|
||||
gzip -9 -c "$REPO_ROOT/docs/${PACKAGE}.1" > "$STAGING/usr/share/man/man1/${PACKAGE}.1.gz"
|
||||
|
||||
sed "s/@VERSION@/${VERSION}/;s/@ARCH@/${ARCH}/" \
|
||||
"$REPO_ROOT/debian/${PACKAGE}.control.in" > "$STAGING/DEBIAN/control"
|
||||
|
||||
mkdir -p "$REPO_ROOT/build"
|
||||
OUT="$REPO_ROOT/build/${PKG}.deb"
|
||||
dpkg-deb --build --root-owner-group "$STAGING" "$OUT"
|
||||
echo "Built: $OUT"
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
10
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
Source: s3-genindex
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Pim van Pelt <pim@ipng.ch>
|
||||
Build-Depends: debhelper (>= 10), golang-go
|
||||
Standards-Version: 4.1.2
|
||||
Homepage: https://git.ipng.ch/ipng/s3-genindex
|
||||
|
||||
Package: s3-genindex
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: HTML directory index generator for local and S3 storage
|
||||
Generate HTML directory indexes with file type icons and responsive design
|
||||
for local directories and S3-compatible storage. This is particularly useful
|
||||
for S3 buckets that are publicly readable.
|
||||
.
|
||||
Features include local directory indexing with recursive traversal,
|
||||
S3-compatible storage support (MinIO, AWS S3, etc.), hierarchical directory
|
||||
structure for S3 buckets, responsive HTML design with file type icons,
|
||||
dry run mode for testing, flexible filtering with glob patterns and regex
|
||||
exclusion, and hidden file control.
|
||||
Vendored
-2
@@ -1,2 +0,0 @@
|
||||
s3-genindex usr/bin
|
||||
docs/s3-genindex.1 usr/share/man/man1
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=direct
|
||||
export GOSUMDB=off
|
||||
export GOCACHE=$(CURDIR)/debian/.gocache
|
||||
export GOPATH=$(CURDIR)/debian/go
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
go build -o s3-genindex ./cmd/s3-genindex
|
||||
|
||||
override_dh_auto_test:
|
||||
go test ./...
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/s3-genindex/usr/bin
|
||||
cp s3-genindex debian/s3-genindex/usr/bin/
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
Package: s3-genindex
|
||||
Version: @VERSION@
|
||||
Architecture: @ARCH@
|
||||
Maintainer: Pim van Pelt <pim@ipng.ch>
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Homepage: https://git.ipng.ch/ipng/s3-genindex
|
||||
Description: HTML directory index generator for local and S3 storage
|
||||
Generate HTML directory indexes with file type icons and responsive
|
||||
design for local directories and S3-compatible storage. Particularly
|
||||
useful for S3 buckets that are publicly readable.
|
||||
.
|
||||
Features include local directory indexing with recursive traversal,
|
||||
S3-compatible storage support (MinIO, AWS S3, etc.), hierarchical
|
||||
directory structure for S3 buckets, responsive HTML design with file
|
||||
type icons, dry run mode for testing, flexible filtering with glob
|
||||
patterns and regex exclusion, and hidden file control.
|
||||
Reference in New Issue
Block a user