rules revision 0bd37d32
1#!/usr/bin/make -f
2# Made with the aid of dh_make, by Craig Small
3# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4# Some lines taken from debmake, by Cristoph Lameter.
5
6# Uncomment this to turn on verbose mode.
7#export DH_VERBOSE=1
8
9# These are used for cross-compiling and for saving the configure script
10# from having to guess our platform (since we know it already)
11DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13
14DESKTOP_VENDOR  = dickey
15
16PKG_SUFFIX	= -dev
17PKG_CLASS	= XTermDev
18
19PACKAGE		:= $(shell dpkg-parsechangelog| \
20			sed -n 's/^Source: \(.*\)$$/\1/p')
21
22PKG_APPDEFAULTS	:= /etc/X11/app-defaults
23PKG_DESKTOP	:= /usr/share/applications
24
25DSTDIR		:= $(CURDIR)/debian/$(PACKAGE)
26MY_DESKTOP	:= $(DSTDIR)/usr/share/applications
27
28CFLAGS =
29
30ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
31DEBOP=--enable-debug
32else
33DEBOP=
34endif
35
36ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
37        CFLAGS += -O0
38else
39        CFLAGS += -O2
40endif
41ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
42        INSTALL_PROGRAM += -s
43endif
44
45configure: configure-stamp
46configure-stamp:
47	dh_testdir
48
49	./configure \
50		--host=$(DEB_HOST_GNU_TYPE) \
51		--build=$(DEB_BUILD_GNU_TYPE) \
52		--program-suffix=$(PKG_SUFFIX) \
53		--prefix=/usr \
54		--libexecdir=\$${prefix}/lib \
55		--mandir=\$${prefix}/share/man \
56		--sysconfdir=/etc/$(PACKAGE) \
57		--localstatedir=/var \
58		--libdir=/etc/$(PACKAGE) \
59		--with-app-class=$(PKG_CLASS) \
60		--without-xterm-symlink \
61		--disable-imake \
62		--enable-256-color \
63		--enable-88-color \
64		--enable-dabbrev \
65		--enable-dec-locator \
66		--enable-exec-xterm \
67		--enable-hp-fkeys \
68		--enable-load-vt-fonts \
69		--enable-logfile-exec \
70		--enable-logging \
71		--enable-mini-luit \
72		--enable-paste64 \
73		--enable-rectangles \
74		--enable-sco-fkeys \
75		--enable-tcap-fkeys \
76		--enable-tcap-query \
77		--enable-toolbar \
78		--enable-wide-chars \
79		--enable-xmc-glitch \
80		--with-app-defaults=$(PKG_APPDEFAULTS) \
81		--with-icondir=\$${prefix}/share/icons \
82		--with-pixmapdir=\$${prefix}/share/pixmaps \
83		--with-own-terminfo=\$${prefix}/share/terminfo \
84		--with-icon-theme \
85		--with-terminal-type=xterm-new \
86		--with-utempter \
87		--with-icon-name=mini.xterm \
88		--with-xpm ${DEBOP}
89
90	touch configure-stamp
91
92build: build-stamp
93build-stamp: configure-stamp
94	dh_testdir
95
96	$(MAKE)
97
98	touch build-stamp
99
100clean:
101	dh_testdir
102	dh_testroot
103
104	[ ! -f Makefile ] || $(MAKE) distclean
105
106	dh_clean
107
108install: install-stamp
109install-stamp: build-stamp
110	dh_testdir
111	dh_testroot
112	dh_clean -k
113	dh_installdirs
114
115	$(MAKE) install \
116		DESTDIR=$(CURDIR)/debian/$(PACKAGE)
117
118	touch install-stamp
119
120install: install-indep install-arch
121install-indep:
122
123install-arch:
124	dh_testdir
125	dh_testroot
126	dh_prep -s 
127	dh_installdirs -s
128
129	$(MAKE) install-bin \
130		DESTDIR=$(DSTDIR)
131
132# Build architecture-independent files here.
133binary-indep: build install
134	dh_testdir
135	dh_testroot
136
137	# This overwrites the Debian package's copy of app-defaults and icons.
138	# But the resources are not the same; they are patched.
139	sed -i -f package/debian/color.sed XTerm-col.ad
140	sed -i -f package/debian/xterm-xres.sed XTerm.ad
141
142	$(MAKE) install-app \
143		install-icon \
144		install-man \
145		DESTDIR=$(DSTDIR)
146
147	# Follow-up with a check against the installed resource files.
148	( cd $(DSTDIR)$(PKG_APPDEFAULTS) \
149	  && $(SHELL) -c 'for p in *; do \
150	  	test -f $(PKG_APPDEFAULTS)/$$p && \
151	  	diff -u $(PKG_APPDEFAULTS)/$$p $$p; \
152		done' ; \
153	  exit 0 )
154
155	# The Debian package does not install desktop files.
156	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
157	$(MAKE) install-desktop \
158		DESKTOP_FLAGS="--vendor='$(DESKTOP_VENDOR)' --dir $(MY_DESKTOP)"
159
160	( cd $(DSTDIR)$(PKG_DESKTOP) \
161	  && $(SHELL) -c 'for p in *;do \
162	  	test -f $(PKG_DESKTOP)/$$p && \
163		diff -u $(PKG_DESKTOP)/$$p $$p; \
164	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
165		done' ; \
166	  exit 0 )
167
168	dh_icons
169
170# Build architecture-dependent files here.
171binary-arch: build install
172	dh_testdir
173	dh_testroot
174	dh_installdebconf
175	dh_installdocs
176	dh_installmenu
177	dh_installmime
178	dh_installexamples tektests vttests
179	dh_installchangelogs
180	dh_install
181	dh_link
182	dh_strip
183	dh_compress
184	dh_fixperms
185	dh_installdeb
186	dh_shlibdeps
187	dh_gencontrol
188	dh_md5sums
189	dh_builddeb
190
191binary: binary-indep binary-arch
192.PHONY: build clean binary-indep binary-arch binary install install-stamp
193