#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PACKAGE		= stterm
ORIGBIN		= st

BIN		= $(PACKAGE)
PKGDIR		= $(CURDIR)/debian/$(PACKAGE)
BINDIR		= $(PKGDIR)/usr/bin
SHAREROOTDIR	= $(PKGDIR)/usr/share
DOCROOTDIR	= $(SHAREROOTDIR)/doc
PKGDOCDIR	= $(DOCROOTDIR)/$(PACKAGE)
TERMINFO	= $(PKGDIR)/usr/share/terminfo
MANDIR 	= $(SHAREROOTDIR)/man/man1

terminfo:
	install -m 755 -d $(TERMINFO)/s
	TERMINFO=$(TERMINFO) tic $(ORIGBIN).info

override_dh_installinfo:
	# Disable; the *.info is not a info(1) but a terminfo file

override_dh_auto_install: terminfo
	# Upstream no good. Calls tic(1) which writes to $HOME
	install -m 755 -D $(BIN) $(BINDIR)/$(BIN)
	install -m 644 -D $(ORIGBIN).info $(PKGDOCDIR)/examples/$(PACKAGE).terminfo
	install -m 644 -D st.1 $(MANDIR)/stterm.1

%:
	dh $@ 
