#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/pkg-info.mk # Workaround for #956971 export DEB_CFLAGS_MAINT_APPEND = -fcommon SHELL := sh -e PKGDIR = debian/$(DEB_SOURCE) PREFIX = /usr/lib/plan9 DATADIR = /usr/share MANDIR = $(DATADIR)/man PKGDATA = $(DATADIR)/$(DEB_SOURCE) TROFFDIR = $(PKGDATA)/troff MANEXT = plan9 CFLAGS += -c -I. -DPREFIX="\"$(PREFIX)\"" # CFLAGS for troff CFLAGS += -DUNICODE -DDWBHOME="\"$(TROFFDIR)\"" -DNTERMDIR="\"/term/tab.\"" \ -DTEXHYPHENS="\"/hyphen.tex\"" -DALTHYPHENS="\"/hyphen.tex\"" \ -DFONTDIR="\"/font\"" -DTDEVNAME="\"utf\"" -DTMACDIR="\"/tmac/tmac.\"" %: dh ${@} override_dh_auto_build: dh_auto_build -- \ CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \ PREFIX=$(PREFIX) MANPREFIX=$(MANDIR) STRIP=true override_dh_auto_install: dh_auto_install -- \ PREFIX=$(PREFIX) MANPREFIX=$(MANDIR) TROFFDIR=$(TROFFDIR) # delete unnecessary man pages rm -f $(PKGDIR)$(MANDIR)/man1/du.1 # almost empty rm -f $(PKGDIR)$(MANDIR)/man1/read.1 # identical to cat.1 # delete empty man pages find $(PKGDIR)$(MANDIR) -type f -empty -delete # Patch man pages on the fly: # - Append plan9 to their extension & section # - .PD0 -> .PD 0 to make groff happy for MANPAGE in $(PKGDIR)$(MANDIR)/man*/*; do \ sed -i \ -e 's/^\.TH [^ ]* [1-8]/&$(MANEXT)/' \ -e 's/^\.PD0/\.PD 0/' \ $$MANPAGE; \ mv $$MANPAGE $${MANPAGE}$(MANEXT); \ done install -D -m644 debian/shells $(PKGDIR)$(DATADIR)/debianutils/shells.d/plan9 override_dh_fixperms: dh_fixperms chmod 0755 $(PKGDIR)$(TROFFDIR)/font/devutf/mkMAP chmod 0755 $(PKGDIR)$(TROFFDIR)/tmac/sendcover