2024-01-06 23:55:43 +01:00
|
|
|
CC ?= gcc
|
2024-01-06 23:52:16 +01:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
2024-01-10 10:49:10 +01:00
|
|
|
SYSTEMDDIR ?= /etc/systemd
|
2024-01-06 23:52:16 +01:00
|
|
|
|
2024-02-05 12:00:00 +01:00
|
|
|
all: reaction ip46tables nft46
|
2023-10-05 12:00:00 +02:00
|
|
|
|
|
|
|
clean:
|
2024-04-06 12:00:00 +02:00
|
|
|
rm -f reaction ip46tables nft46 reaction*.deb reaction.minisig ip46tables.minisig nft46.minisig reaction*.deb.minisig
|
|
|
|
rm -rf debian-packaging
|
2023-12-20 15:56:22 +01:00
|
|
|
|
2024-02-05 12:00:00 +01:00
|
|
|
ip46tables: helpers_c/ip46tables.c
|
|
|
|
$(CC) -s -static helpers_c/ip46tables.c -o ip46tables
|
|
|
|
|
|
|
|
nft46: helpers_c/nft46.c
|
|
|
|
$(CC) -s -static helpers_c/nft46.c -o nft46
|
2023-10-05 12:00:00 +02:00
|
|
|
|
|
|
|
reaction: app/* reaction.go go.mod go.sum
|
2024-01-05 12:00:00 +01:00
|
|
|
CGO_ENABLED=0 go build -buildvcs=false -ldflags "-s -X main.version=`git tag --sort=v:refname | tail -n1` -X main.commit=`git rev-parse --short HEAD`"
|
2023-12-20 15:56:22 +01:00
|
|
|
|
2024-01-12 14:45:31 +01:00
|
|
|
reaction_%-1_amd64.deb:
|
|
|
|
apt-get -qq -y update
|
|
|
|
apt-get -qq -y install build-essential devscripts debhelper quilt wget
|
|
|
|
if [ -e debian-packaging ]; then rm -rf debian-packaging; fi
|
|
|
|
mkdir debian-packaging
|
|
|
|
wget "https://framagit.org/ppom/reaction/-/archive/v${*}/reaction-v${*}.tar.gz" -O "debian-packaging/reaction_${*}.orig.tar.gz"
|
|
|
|
cd debian-packaging && tar xf "reaction_${*}.orig.tar.gz"
|
|
|
|
cp -r debian "debian-packaging/reaction-v${*}"
|
|
|
|
if [ -e "debian/changelog" ]; then \
|
2024-04-06 12:00:00 +02:00
|
|
|
cd "debian-packaging/reaction-v${*}" && \
|
|
|
|
DEBFULLNAME=ppom DEBEMAIL=reaction@ppom.me dch --package reaction --newversion "${*}-1" "New upstream release."; \
|
|
|
|
else \
|
|
|
|
cd "debian-packaging/reaction-v${*}" && \
|
|
|
|
DEBFULLNAME=ppom DEBEMAIL=reaction@ppom.me dch --create --package reaction --newversion "${*}-1" "Initial release."; \
|
|
|
|
fi
|
2024-04-06 12:00:00 +02:00
|
|
|
cd "debian-packaging/reaction-v${*}" && DEBFULLNAME=ppom DEBEMAIL=reaction@ppom.me dch --release --distribution stable --urgency low ""
|
2024-01-12 14:45:31 +01:00
|
|
|
cd "debian-packaging/reaction-v${*}" && debuild --prepend-path=/go/bin:/usr/local/go/bin -us -uc
|
|
|
|
cp "debian-packaging/reaction-v${*}/debian/changelog" debian/
|
|
|
|
cp "debian-packaging/reaction_${*}-1_amd64.deb" .
|
|
|
|
|
|
|
|
signatures_%: reaction_%-1_amd64.deb reaction ip46tables nft46
|
|
|
|
minisign -Sm nft46 ip46tables reaction reaction_${*}-1_amd64.deb
|
2024-01-04 12:00:00 +01:00
|
|
|
|
2024-01-06 23:52:16 +01:00
|
|
|
install: all
|
2024-01-10 12:00:00 +01:00
|
|
|
install -m755 reaction $(DESTDIR)$(BINDIR)
|
|
|
|
install -m755 ip46tables $(DESTDIR)$(BINDIR)
|
2024-02-05 12:00:00 +01:00
|
|
|
install -m755 nft46 $(DESTDIR)$(BINDIR)
|
2024-01-10 10:49:10 +01:00
|
|
|
|
|
|
|
install_systemd: install
|
2024-04-20 12:00:00 +02:00
|
|
|
install -m644 config/reaction.example.service $(SYSTEMDDIR)/system/reaction.service
|
2024-01-10 12:00:00 +01:00
|
|
|
sed -i 's#/usr/bin#$(DESTDIR)$(BINDIR)#' $(SYSTEMDDIR)/system/reaction.service
|