| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# bring in DEB_VERSION |
| 4 |
include /usr/share/dpkg/default.mk |
| 5 |
|
| 6 |
# export DH_VERBOSE = 1 |
| 7 |
export DH_GOLANG_EXCLUDES = ^\. assets/ docs/ examples/ scripts/ tools/ web/ |
| 8 |
export DH_GOLANG_INSTALL_EXTRA = mail/mailer_emoji_map.json server/templates |
| 9 |
export GOFLAGS="-tags=nofirebase,nowebpush,nopayments" |
| 10 |
|
| 11 |
# For ntfy '--with=golang' must be used to avoid failure on: |
| 12 |
# dwz: debian/ntfy/usr/bin/ntfy: Found compressed .debug_aranges section, not attempting dwz compression |
| 13 |
# dh_dwz: error: dwz -- debian/ntfy/usr/bin/ntfy returned exit code 1 |
| 14 |
%: |
| 15 |
dh $@ --builddirectory=debian/_build --with=golang |
| 16 |
|
| 17 |
# 1. override version/commit/date, this way --help says something like: |
| 18 |
# ntfy 2.11.0-1 (debian-), runtime go1.23.5, built at 2024-12-15 |
| 19 |
# 2. show a message when accessing the ntfy web root |
| 20 |
# 3. upstream Makefile uses these tags, but skipping: |
| 21 |
# sqlite_omit_load_extension,osusergo,netgo |
| 22 |
override_dh_auto_build: |
| 23 |
mkdir -pv debian/_build/src/heckel.io/ntfy/v2/server/docs \ |
| 24 |
debian/_build/src/heckel.io/ntfy/v2/server/site |
| 25 |
touch debian/_build/src/heckel.io/ntfy/v2/server/docs/index.html |
| 26 |
echo "<html><body>" \ |
| 27 |
"ntfy web root: no web app is running in the debian version" \ |
| 28 |
"</body></html>" > \ |
| 29 |
debian/_build/src/heckel.io/ntfy/v2/server/site/app.html |
| 30 |
dh_auto_build -- \ |
| 31 |
-ldflags "-X main.version=$(DEB_VERSION) -X main.commit=debian- \ |
| 32 |
-X main.date=$(shell date -I --date='@$(SOURCE_DATE_EPOCH)')" |
| 33 |
# With v2 import path, dh-golang installs the binary as 'v2'; rename it back |
| 34 |
if [ -f debian/_build/bin/v2 ]; then mv debian/_build/bin/v2 debian/_build/bin/ntfy; fi |
| 35 |
|
| 36 |
override_dh_auto_install: |
| 37 |
dh_auto_install -- --no-source |
| 38 |
|
| 39 |
# install services without enabling or starting them as |
| 40 |
# ntfy/ntfy-client are noisy and configured for port 80 by default |
| 41 |
override_dh_installsystemd: |
| 42 |
dh_installsystemd --no-start --no-enable --restart-after-upgrade |
| 43 |
|
| 44 |
# Call sysusers because it's not called by standard dh sequence in compat=13 |
| 45 |
execute_after_dh_installsystemd: |
| 46 |
dh_installsysusers |
| 47 |
|
| 48 |
# Skip tests as they make requests to http://ntfy.sh |
| 49 |
# Although they should run as the depends have been tagged |
| 50 |
override_dh_auto_test: |