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