rules revision 5307cd1a
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-dabbrev \
68		--enable-dec-locator \
69		--enable-exec-xterm \
70		--enable-hp-fkeys \
71		--enable-load-vt-fonts \
72		--enable-logfile-exec \
73		--enable-logging \
74		--enable-mini-luit \
75		--enable-regis-graphics \
76		--enable-sco-fkeys \
77		--enable-status-line \
78		--enable-toolbar \
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_prep
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 -a
127	dh_installdirs -a
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 stopped installing xterm's desktop files; a
156	# subsequent revision added that back with limitations.  xterm's
157	# configure script checks for categories which are used by other
158	# terminal emulators.  The Debian package overrides that to a single
159	# category.
160	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
161	$(MAKE) install-desktop \
162		DESKTOP_FLAGS="--dir $(MY_DESKTOP)"
163
164	( cd $(DSTDIR)$(PKG_DESKTOP) \
165	  && $(SHELL) -c 'for p in *;do \
166	  	test -f $(PKG_DESKTOP)/$$p && \
167		diff -u $(PKG_DESKTOP)/$$p $$p; \
168	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
169		done' ; \
170	  exit 0 )
171
172	dh_icons
173
174# Build architecture-dependent files here.
175binary-arch: build install
176	dh_testdir
177	dh_testroot
178	dh_installdebconf
179	dh_lintian
180	dh_installdocs
181	dh_installmenu
182	dh_installmime
183	dh_installexamples tektests vttests
184	dh_installchangelogs
185	dh_install
186	dh_link
187	dh_strip
188	dh_compress -Xexamples
189	dh_fixperms
190	dh_installdeb
191	dh_shlibdeps
192	dh_gencontrol
193	dh_md5sums
194	dh_builddeb
195
196binary: binary-indep binary-arch
197.PHONY: build clean binary-indep binary-arch binary install install-stamp
198