rules revision 2e4f8982
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-regis-graphics \
74		--enable-sco-fkeys \
75		--enable-screen-dumps \
76		--enable-sixel-graphics \
77		--enable-tcap-fkeys \
78		--enable-tcap-query \
79		--enable-toolbar \
80		--enable-wide-chars \
81		--enable-xmc-glitch \
82		--with-app-defaults=$(PKG_APPDEFAULTS) \
83		--with-icondir=\$${prefix}/share/icons \
84		--with-pixmapdir=\$${prefix}/share/pixmaps \
85		--with-own-terminfo=\$${prefix}/share/terminfo \
86		--with-icon-theme \
87		--with-terminal-type=xterm-new \
88		--with-utempter \
89		--with-icon-name=mini.xterm \
90		--with-xpm ${DEBOP}
91
92	touch configure-stamp
93
94build: build-stamp
95build-stamp: configure-stamp
96	dh_testdir
97
98	$(MAKE)
99
100	touch build-stamp
101
102clean:
103	dh_testdir
104	dh_testroot
105
106	[ ! -f Makefile ] || $(MAKE) distclean
107
108	dh_clean
109
110install: install-stamp
111install-stamp: build-stamp
112	dh_testdir
113	dh_testroot
114	dh_clean -k
115	dh_installdirs
116
117	$(MAKE) install \
118		DESTDIR=$(CURDIR)/debian/$(PACKAGE)
119
120	touch install-stamp
121
122install: install-indep install-arch
123install-indep:
124
125install-arch:
126	dh_testdir
127	dh_testroot
128	dh_prep -s 
129	dh_installdirs -s
130
131	$(MAKE) install-bin \
132		DESTDIR=$(DSTDIR)
133
134# Build architecture-independent files here.
135binary-indep: build install
136	dh_testdir
137	dh_testroot
138
139	# This overwrites the Debian package's copy of app-defaults and icons.
140	# But the resources are not the same; they are patched.
141	sed -i -f package/debian/color.sed XTerm-col.ad
142	sed -i -f package/debian/xterm-xres.sed XTerm.ad
143
144	$(MAKE) install-app \
145		install-icon \
146		install-man \
147		DESTDIR=$(DSTDIR)
148
149	# Follow-up with a check against the installed resource files.
150	( cd $(DSTDIR)$(PKG_APPDEFAULTS) \
151	  && $(SHELL) -c 'for p in *; do \
152	  	test -f $(PKG_APPDEFAULTS)/$$p && \
153	  	diff -u $(PKG_APPDEFAULTS)/$$p $$p; \
154		done' ; \
155	  exit 0 )
156
157	# The Debian package does not install desktop files.
158	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
159	$(MAKE) install-desktop \
160		DESKTOP_FLAGS="--vendor='$(DESKTOP_VENDOR)' --dir $(MY_DESKTOP)"
161
162	( cd $(DSTDIR)$(PKG_DESKTOP) \
163	  && $(SHELL) -c 'for p in *;do \
164	  	test -f $(PKG_DESKTOP)/$$p && \
165		diff -u $(PKG_DESKTOP)/$$p $$p; \
166	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
167		done' ; \
168	  exit 0 )
169
170	dh_icons
171
172# Build architecture-dependent files here.
173binary-arch: build install
174	dh_testdir
175	dh_testroot
176	dh_installdebconf
177	dh_installdocs
178	dh_installmenu
179	dh_installmime
180	dh_installexamples tektests vttests
181	dh_installchangelogs
182	dh_install
183	dh_link
184	dh_strip
185	dh_compress -Xexamples
186	dh_fixperms
187	dh_installdeb
188	dh_shlibdeps
189	dh_gencontrol
190	dh_md5sums
191	dh_builddeb
192
193binary: binary-indep binary-arch
194.PHONY: build clean binary-indep binary-arch binary install install-stamp
195