summaryrefslogtreecommitdiff
path: root/package/debian/rules
blob: c37339cefd23bb53058718b54c692b285ec6e93c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

DESKTOP_VENDOR  = dickey

PKG_SUFFIX	= -dev
PKG_CLASS	= XTermDev

PACKAGE		:= $(shell dpkg-parsechangelog| \
			sed -n 's/^Source: \(.*\)$$/\1/p')

PKG_APPDEFAULTS	:= /etc/X11/app-defaults
PKG_DESKTOP	:= /usr/share/applications

DSTDIR		:= $(CURDIR)/debian/$(PACKAGE)
MY_DESKTOP	:= $(DSTDIR)/usr/share/applications

CFLAGS =

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
DEBOP=--enable-debug
else
DEBOP=
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
	dh_testdir

	./configure \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--program-suffix=$(PKG_SUFFIX) \
		--prefix=/usr \
		--libexecdir=\$${prefix}/lib \
		--mandir=\$${prefix}/share/man \
		--sysconfdir=/etc/$(PACKAGE) \
		--localstatedir=/var \
		--libdir=/etc/$(PACKAGE) \
		--with-app-class=$(PKG_CLASS) \
		--without-xterm-symlink \
		--enable-256-color \
		--enable-88-color \
		--enable-dabbrev \
		--enable-dec-locator \
		--enable-exec-xterm \
		--enable-hp-fkeys \
		--enable-load-vt-fonts \
		--enable-logfile-exec \
		--enable-logging \
		--enable-mini-luit \
		--enable-paste64 \
		--enable-rectangles \
		--enable-sco-fkeys \
		--enable-tcap-fkeys \
		--enable-tcap-query \
		--enable-toolbar \
		--enable-wide-chars \
		--enable-xmc-glitch \
		--with-app-defaults=$(PKG_APPDEFAULTS) \
		--with-icondir=\$${prefix}/share/icons \
		--with-pixmapdir=\$${prefix}/share/pixmaps \
		--with-own-terminfo=\$${prefix}/share/terminfo \
		--with-icon-theme \
		--with-terminal-type=xterm-new \
		--with-utempter \
		${DEBOP}

	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp
	dh_testdir

	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot

	[ ! -f Makefile ] || $(MAKE) distclean

	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install \
		DESTDIR=$(CURDIR)/debian/$(PACKAGE)

	touch install-stamp

install: install-indep install-arch
install-indep:

install-arch:
	dh_testdir
	dh_testroot
	dh_prep -s 
	dh_installdirs -s

	$(MAKE) install-bin \
		DESTDIR=$(DSTDIR)

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot

	# This overwrites the Debian package's copy of app-defaults and icons.
	# But the resources are not the same; they are patched.
	sed -i -f package/debian/color.sed XTerm-col.ad
	sed -i -f package/debian/xterm-xres.sed XTerm.ad

	$(MAKE) install-app \
		install-icon \
		install-man \
		DESTDIR=$(DSTDIR)

	# Follow-up with a check against the installed resource files.
	( cd $(DSTDIR)$(PKG_APPDEFAULTS) \
	  && $(SHELL) -c 'for p in *; do \
	  	test -f $(PKG_APPDEFAULTS)/$$p && \
	  	diff -u $(PKG_APPDEFAULTS)/$$p $$p; \
		done' ; \
	  exit 0 )

	# The Debian package does not install desktop files.
	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=486317
	$(MAKE) install-desktop \
		DESKTOP_FLAGS="--vendor='$(DESKTOP_VENDOR)' --dir $(MY_DESKTOP)"

	( cd $(DSTDIR)$(PKG_DESKTOP) \
	  && $(SHELL) -c 'for p in *;do \
	  	test -f $(PKG_DESKTOP)/$$p && \
		diff -u $(PKG_DESKTOP)/$$p $$p; \
	  	test -n "$(PKG_SUFFIX)" && mv $$p `basename $$p .desktop`$(PKG_SUFFIX).desktop; \
		done' ; \
	  exit 0 )

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs
	dh_installmenu
	dh_installmime
	dh_installexamples tektests vttests
	dh_installchangelogs
	dh_install
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install install-stamp