rules revision 913cc679
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
28CPPFLAGS	:= $(shell dpkg-buildflags --get CPPFLAGS)
29CFLAGS		:= $(shell dpkg-buildflags --get CFLAGS)
30LDFLAGS		:= $(shell dpkg-buildflags --get LDFLAGS)
31
32ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
33DEBOP=--enable-debug
34else
35DEBOP=
36endif
37
38ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
39        CFLAGS += -O0
40else
41        CFLAGS += -O2
42endif
43ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
44        INSTALL_PROGRAM += -s
45endif
46
47configure: configure-stamp
48configure-stamp:
49	dh_testdir
50
51	CPPFLAGS="$(CPPFLAGS)" \
52	CFLAGS="$(CFLAGS)" \
53	LDFLAGS="$(LDFLAGS)" \
54	./configure \
55		--host=$(DEB_HOST_GNU_TYPE) \
56		--build=$(DEB_BUILD_GNU_TYPE) \
57		--program-suffix=$(PKG_SUFFIX) \
58		--prefix=/usr \
59		--libexecdir=\$${prefix}/lib \
60		--mandir=\$${prefix}/share/man \
61		--sysconfdir=/etc/$(PACKAGE) \
62		--localstatedir=/var \
63		--libdir=/etc/$(PACKAGE) \
64		--with-app-class=$(PKG_CLASS) \
65		--without-xterm-symlink \
66		--disable-imake \
67		--enable-256-color \
68		--enable-88-color \
69		--enable-dabbrev \
70		--enable-dec-locator \
71		--enable-exec-xterm \
72		--enable-hp-fkeys \
73		--enable-load-vt-fonts \
74		--enable-logfile-exec \
75		--enable-logging \
76		--enable-mini-luit \
77		--enable-paste64 \
78		--enable-regis-graphics \
79		--enable-sco-fkeys \
80		--enable-screen-dumps \
81		--enable-sixel-graphics \
82		--enable-tcap-fkeys \
83		--enable-tcap-query \
84		--enable-toolbar \
85		--enable-wide-chars \
86		--enable-xmc-glitch \
87		--with-app-defaults=$(PKG_APPDEFAULTS) \
88		--with-icondir=\$${prefix}/share/icons \
89		--with-pixmapdir=\$${prefix}/share/pixmaps \
90		--with-own-terminfo=\$${prefix}/share/terminfo \
91		--with-icon-theme \
92		--with-terminal-type=xterm-new \
93		--with-utempter \
94		--with-icon-name=mini.xterm \
95		--with-xpm ${DEBOP}
96
97	touch configure-stamp
98
99build: build-stamp
100build-stamp: configure-stamp
101	dh_testdir
102
103	$(MAKE)
104
105	touch build-stamp
106
107clean:
108	dh_testdir
109	dh_testroot
110
111	[ ! -f Makefile ] || $(MAKE) distclean
112
113	dh_clean
114
115install: install-stamp
116install-stamp: build-stamp
117	dh_testdir
118	dh_testroot
119	dh_clean -k
120	dh_installdirs
121
122	$(MAKE) install \
123		DESTDIR=$(CURDIR)/debian/$(PACKAGE)
124
125	touch install-stamp
126
127install: install-indep install-arch
128install-indep:
129
130install-arch:
131	dh_testdir
132	dh_testroot
133	dh_prep -s 
134	dh_installdirs -s
135
136	$(MAKE) install-bin \
137		DESTDIR=$(DSTDIR)
138
139# Build architecture-independent files here.
140binary-indep: build install
141	dh_testdir
142	dh_testroot
143
144	# This overwrites the Debian package's copy of app-defaults and icons.
145	# But the resources are not the same; they are patched.
146	sed -i -f package/debian/color.sed XTerm-col.ad
147	sed -i -f package/debian/xterm-xres.sed XTerm.ad
148
149	$(MAKE) install-app \
150		install-icon \
151		install-man \
152		DESTDIR=$(DSTDIR)
153
154	# Follow-up with a check against the installed resource files.
155	( cd $(DSTDIR)$(PKG_APPDEFAULTS) \
156	  && $(SHELL) -c 'for p in *; do \
157	  	test -f $(PKG_APPDEFAULTS)/$$p && \
158	  	diff -u $(PKG_APPDEFAULTS)/$$p $$p; \
159		done' ; \
160	  exit 0 )
161
162	# The Debian package does not install desktop files.
163	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
164	$(MAKE) install-desktop \
165		DESKTOP_FLAGS="--vendor='$(DESKTOP_VENDOR)' --dir $(MY_DESKTOP)"
166
167	( cd $(DSTDIR)$(PKG_DESKTOP) \
168	  && $(SHELL) -c 'for p in *;do \
169	  	test -f $(PKG_DESKTOP)/$$p && \
170		diff -u $(PKG_DESKTOP)/$$p $$p; \
171	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
172		done' ; \
173	  exit 0 )
174
175	dh_icons
176
177# Build architecture-dependent files here.
178binary-arch: build install
179	dh_testdir
180	dh_testroot
181	dh_installdebconf
182	dh_installdocs
183	dh_installmenu
184	dh_installmime
185	dh_installexamples tektests vttests
186	dh_installchangelogs
187	dh_install
188	dh_link
189	dh_strip
190	dh_compress -Xexamples
191	dh_fixperms
192	dh_installdeb
193	dh_shlibdeps
194	dh_gencontrol
195	dh_md5sums
196	dh_builddeb
197
198binary: binary-indep binary-arch
199.PHONY: build clean binary-indep binary-arch binary install install-stamp
200