#!/usr/bin/make -f
# OBS-compatible debian/rules for nginx-waf-feeds

export GOPATH=$(CURDIR)/.gopath
export GOCACHE=$(CURDIR)/.gocache

%:
	dh $@

override_dh_auto_build:
	make build VERSION=$(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')

override_dh_auto_install:
	# Install binary
	install -D -m 0755 nginx-waf-feeds debian/nginx-waf-feeds/usr/bin/nginx-waf-feeds
	# Install systemd service
	install -D -m 0644 dist/nginx-waf-feeds.service debian/nginx-waf-feeds/usr/lib/systemd/system/nginx-waf-feeds.service
	# Install example configuration
	install -D -m 0640 conf/config.example.yaml debian/nginx-waf-feeds/etc/nginx-waf-feeds/config.yaml
	# Create lists directory
	mkdir -p debian/nginx-waf-feeds/etc/nginx/waf-lists

override_dh_auto_test:
	# Skip tests during package build
	@echo "Skipping tests"

override_dh_auto_clean:
	rm -f nginx-waf-feeds
	rm -rf .gopath .gocache
	dh_auto_clean
