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