File: rules

package info (click to toggle)
tigervnc 1.9.0%2Bdfsg-3%2Bdeb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,804 kB
  • sloc: java: 34,248; cpp: 29,106; ansic: 13,233; perl: 1,783; makefile: 927; sh: 913; python: 102
file content (317 lines) | stat: -rwxr-xr-x 12,377 bytes parent folder | download
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
#!/usr/bin/make -f
# debian/rules for the Debian tigervnc package.

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# Where the tigervnc sources are
DEB_SRCDIR   = .
# Don't override DEB_BUILDDIR as /usr/share/cdbs/1/class/cmake.mk does not
# support this
## Where to built tigervnc
#DEB_BUILDDIR = $(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE)

# Normal situation
#VNC_PATCH = $(CURDIR)/unix/xserver117.patch
# However in this case we do not have this file from upstream so we use a
# debian specific copy instead.
#VNC_PATCH = $(CURDIR)/unix/xserver119.patch
VNC_PATCH = $(CURDIR)/unix/xserver120.patch
VNC_LIBTOOL_PATCH = $(CURDIR)/contrib/packages/deb/ubuntu-xenial/debian/xorg-source-patches/debian_libtool.patch

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
include /usr/share/dpkg/architecture.mk

# Do our complex patch dance first! After that quilt patch system can proceed!
clean:: unpatch
unpatch: reverse-patches-dance
patch: apply-patches-dance

include /usr/share/cdbs/1/rules/patchsys-quilt.mk

DEB_DH_AUTORECONF_ARGS       = $(CURDIR)/debian/xorg-autoreconf.sh
DEB_DH_AUTORECONF_CLEAN_ARGS =

#include /usr/share/cdbs/1/rules/autoreconf.mk we need the deautoreconf in the unpatch sequence

DEB_CONFIGURE_EXTRA_FLAGS +=

DEB_CMAKE_INSTALL_PREFIX  = /usr
DEB_CMAKE_EXTRA_FLAGS     += -DUSE_INCLUDED_ZLIB:BOOL=OFF
DEB_CMAKE_EXTRA_FLAGS     += -DENABLE_LIBWRAP:BOOL=ON
DEB_CMAKE_EXTRA_FLAGS     += -DENABLE_NLS:BOOL=ON
DEB_CMAKE_EXTRA_FLAGS     += -DENABLE_GNUTLS:BOOL=ON
DEB_CMAKE_EXTRA_FLAGS     += -DENABLE_PAM:BOOL=ON
#DEB_CMAKE_EXTRA_FLAGS     += -DBUILD_JAVA=1

CFLAGS   += $(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS)
CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS  += $(shell dpkg-buildflags --get LDFLAGS)

# We need that as /usr/share/cdbs/1/class/cmake.mk is buggy and does not use the :STRING qualifier
DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_C_FLAGS:STRING="$(CPPFLAGS) $(CFLAGS) -fPIC"
DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_CXX_FLAGS:STRING="$(CPPFLAGS) $(CXXFLAGS) -fPIC"
DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)"
DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS)"
DEB_CMAKE_EXTRA_FLAGS += -DBUILD_TIMESTAMP="$(shell dpkg-parsechangelog -SDate | date -u -f- '+%Y-%m-%d %H:%M')"

# This is stolen from xorg-server/debian/xsfbs/xsfbs.mk
# Determine (source) package name from Debian changelog.
SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
                        | grep '^Source:' | awk '{print $$2}')

# Determine package version from Debian changelog.
SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
                        | grep '^Version:' | awk '{print $$2}')

# Strip a possible epoch marker from source version.
NO_EPOCH_VER:=$(shell echo $(SOURCE_VERSION) | sed 's/^.://')

# Determine upstream version number for make get-orig-source
UPSTREAM_DFSG_VERSION:=$(shell echo $(NO_EPOCH_VER) | sed 's/-.*//')

# Determine upstream version number.
UPSTREAM_VERSION:=$(shell echo $(UPSTREAM_DFSG_VERSION) | cut -d"+" -f1)

# Highly modified and adapted from http://wiki.debian.org/SandroTosi/Svn_get-orig-source
TIGERVNC_PACKAGE = tigervnc
TIGERVNC_VERSION = $(UPSTREAM_VERSION)
TIGERVNC_TARBALL = $(TIGERVNC_PACKAGE)_$(UPSTREAM_DFSG_VERSION).orig.tar.xz

debug-debian-rules:
	@echo '$$(DEB_CONFIGURE_EXTRA_FLAGS) $(DEB_CONFIGURE_EXTRA_FLAGS)'
	@echo '$$(DEB_CMAKE_EXTRA_FLAGS) $(DEB_CMAKE_EXTRA_FLAGS)'
	@echo '$$(SOURCE_NAME) $(SOURCE_NAME)'
	@echo '$$(SOURCE_VERSION) $(SOURCE_VERSION)'
	@echo '$$(NO_EPOCH_VER) $(NO_EPOCH_VER)'
	@echo '$$(UPSTREAM_DFSG_VERSION) $(UPSTREAM_DFSG_VERSION)'
	@echo '$$(UPSTREAM_VERSION) $(UPSTREAM_VERSION)'
	@echo '$$(TIGERVNC_PACKAGE) $(TIGERVNC_PACKAGE)'
	@echo '$$(TIGERVNC_VERSION) $(TIGERVNC_VERSION)'
	@echo '$$(TIGERVNC_TARBALL) $(TIGERVNC_TARBALL)'

.PHONY: apply-patches-dance reverse-patches-dance

apply-patches-dance: apply-patches
apply-patches: apply-patches-vnc-patch-xorg
apply-patches-vnc-patch-xorg: apply-patches-unify-xorg-and-vnc-tree
apply-patches-unify-xorg-and-vnc-tree:

reverse-patches-dance: reverse-patches-remove-xorg-from-vnc-tree
reverse-patches-remove-xorg-from-vnc-tree: reverse-patches-vnc-unpatch-xorg reverse-patches-vnc-unpatch-xorg-libtool
reverse-patches-vnc-unpatch-xorg: reverse-patches-deautoreconf
reverse-patches-deautoreconf: reverse-patches

.PHONY: reverse-patches-deautoreconf

post-patches:: $(DEB_SRCDIR)/unix/xserver/.autoreconf-xorg.stamp

$(DEB_SRCDIR)/unix/xserver/.autoreconf-xorg.stamp:
	dh_autoreconf $(DEB_DH_AUTORECONF_ARGS) && touch $@

reverse-patches-deautoreconf:
	if test -f $(DEB_SRCDIR)/unix/xserver/.autoreconf-xorg.stamp; then \
	  dh_autoreconf_clean $(DEB_DH_AUTORECONF_CLEAN_ARGS) && \
	  rm -f $(DEB_SRCDIR)/unix/xserver/.autoreconf-xorg.stamp \
	  	$(CURDIR)/debian/autoreconf.before \
	  	$(CURDIR)/debian/autoreconf.after; \
	else \
	  rm -f $(CURDIR)/debian/autoreconf.before \
	  	$(CURDIR)/debian/autoreconf.after; \
	fi

.PHONY: apply-patches-vnc-patch-xorg reverse-patches-vnc-unpatch-xorg

apply-patches-vnc-patch-xorg: $(DEB_SRCDIR)/unix/xserver/.apply-patches-vnc-patch-xorg.stamp

$(DEB_SRCDIR)/unix/xserver/.apply-patches-vnc-patch-xorg.stamp: $(VNC_PATCH)
	cd $(DEB_SRCDIR)/unix/xserver && { \
		patch --no-backup-if-mismatch -p1 < $(VNC_PATCH) && \
		touch .apply-patches-vnc-patch-xorg.stamp; \
	}

reverse-patches-vnc-unpatch-xorg: $(VNC_PATCH)
	cd $(DEB_SRCDIR)/unix/xserver && if test -f .apply-patches-vnc-patch-xorg.stamp; then \
		patch --no-backup-if-mismatch -R -p1 < $(VNC_PATCH); \
		rm -f .apply-patches-vnc-patch-xorg.stamp; \
	fi

.PHONY: apply-patches-vnc-patch-xorg-libtool reverse-patches-vnc-unpatch-xorg-libtool

apply-patches-vnc-patch-xorg-libtool: $(DEB_SRCDIR)/unix/xserver/.apply-patches-vnc-patch-xorg-libtool.stamp

$(DEB_SRCDIR)/unix/xserver/.apply-patches-vnc-patch-xorg-libtool.stamp: $(VNC_LIBTOOL_PATCH)
	cd $(DEB_SRCDIR)/unix/xserver && { \
		patch --no-backup-if-mismatch -p1 < $(VNC_LIBTOOL_PATCH) && \
		touch .apply-patches-vnc-patch-xorg-libtool.stamp; \
	}

reverse-patches-vnc-unpatch-xorg-libtool: $(VNC_LIBTOOL_PATCH)
	cd $(DEB_SRCDIR)/unix/xserver && if test -f .apply-patches-vnc-patch-xorg-libtool.stamp; then \
		patch --no-backup-if-mismatch -R -p1 < $(VNC_LIBTOOL_PATCH); \
		rm -f .apply-patches-vnc-patch-xorg-libtool.stamp; \
	fi

.PHONY: apply-patches-unify-xorg-and-vnc-tree reverse-patches-remove-xorg-from-vnc-tree

apply-patches-unify-xorg-and-vnc-tree: $(DEB_SRCDIR)/unix/xserver/.apply-patches-unify-xorg-and-vnc-tree.stamp

$(DEB_SRCDIR)/unix/xserver/.apply-patches-unify-xorg-and-vnc-tree.stamp:
	cd $(DEB_SRCDIR)/unix/xserver && \
	  { tar --strip-components 1 -xvJf /usr/src/xorg-server.tar.xz | \
	      sed -e 's@^[^/]*/@@' > .apply-patches-unify-xorg-and-vnc-tree.files; } && \
	  touch .apply-patches-unify-xorg-and-vnc-tree.stamp

reverse-patches-remove-xorg-from-vnc-tree:
	cd $(DEB_SRCDIR)/unix/xserver && \
		if test -f .apply-patches-unify-xorg-and-vnc-tree.files; then \
			sort -r < .apply-patches-unify-xorg-and-vnc-tree.files | \
				while read line; do \
					if test -d "$$line"; then \
						rmdir "$$line" || true; \
					else \
						rm -f "$$line"; \
					fi; \
				done; \
			rm -f .apply-patches-unify-xorg-and-vnc-tree.stamp \
			      .apply-patches-unify-xorg-and-vnc-tree.files; \
		fi

configure/tigervnc-standalone-server configure/tigervnc-xorg-extension:: $(DEB_BUILDDIR)/unix/xserver/configure.stamp

# Unfortunately quoting in /usr/share/xserver-xorg/configure_flags.mk is fucked
# up in buster and ${xxx} is not escaped correctly.
xserver_confflags := $(shell cat /usr/share/xserver-xorg/configure_flags.mk | \
  sed -ne '/^xserver_confflags\s*=/{s/^[^=]*=//;s/--with-builderstring="[^"]*"//;p}')

#-include /usr/share/xserver-xorg/configure_flags.mk
#xserver_confflags := $(shell echo '$(xserver_confflags)' | sed 's/--with-builderstring="[^"]*"//')

XORG_DEBIAN_CONFIGURE_FLAGS := \
	$(filter-out \
		--prefix=% \
		--mandir=% \
		--infodir=% \
		--sysconfdir=% \
		--localstatedir=% \
		--build=% \
		--host=% \
		--enable-xwayland \
		--enable-dmx \
		--enable-xvfb \
		--enable-xnest \
		--enable-xephyr \
		--enable-xorg \
		--enable-dri \
		--enable-dri2 \
		--enable-dri3 \
		--enable-xmir \
	    , $(xserver_confflags) \
	)

# Don't use libunwind for armel, armhf, and arm64 as this library is buggy
# (bug #923962) on those architectures.
ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf arm64))
	DEB_CONFIGURE_EXTRA_FLAGS += --disable-libunwind
	XORG_DEBIAN_CONFIGURE_FLAGS := \
	    $(filter-out --enable-libunwind, $(XORG_DEBIAN_CONFIGURE_FLAGS))
endif

# Next step is run configure script. It is very difficult use correct parameters.
# You should use same parameters as used in your distribution X server and add
# --disable-xvfb --disable-xnest --disable-xorg
$(DEB_BUILDDIR)/unix/xserver/configure.stamp: $(DEB_SRCDIR)/unix/xserver/.apply-patches-vnc-patch-xorg-libtool.stamp
	mkdir -p $(DEB_BUILDDIR)/unix/xserver
	( cd $(DEB_BUILDDIR)/unix/xserver && \
	  $(DEB_CONFIGURE_SCRIPT_ENV) $(CURDIR)/$(DEB_SRCDIR)/unix/xserver/configure \
		TIGERVNC_BUILDDIR="$(CURDIR)/$(DEB_BUILDDIR)" \
		CPPFLAGS="$(CPPFLAGS)" \
		CFLAGS="$(CFLAGS)" \
		CXXFLAGS="$(CXXFLAGS)" \
		LDFLAGS="$(LDFLAGS) -lpam" \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc \
		--localstatedir=/var \
		$(XORG_DEBIAN_CONFIGURE_FLAGS) \
		$(DEB_CONFIGURE_EXTRA_FLAGS) \
		--disable-selective-werror \
		--with-builderstring="tigervnc-xorg-server $(NO_EPOCH_VER) (TigerVNC Packaging Team <pkg-tigervnc-devel@lists.alioth.debian.org>)" \
		--disable-xwayland \
		--disable-dmx \
		--disable-xvfb \
		--disable-xnest \
		--disable-xephyr \
		--disable-xorg \
		--disable-dri \
		--disable-dri2 \
		--disable-dri3 ) && \
	  touch $@

build/tigervnc-standalone-server build/tigervnc-xorg-extension::
	$(MAKE) TIGERVNC_BUILDDIR="$(CURDIR)/$(DEB_BUILDDIR)" -C $(DEB_BUILDDIR)/unix/xserver

install/tigervnc-common::
	mkdir -p $(DEB_DESTDIR)/usr/share/doc
	mv $(DEB_DESTDIR)/usr/share/doc/tigervnc-* \
	  $(DEB_DESTDIR)/usr/share/doc/tigervnc-common

install/tigervnc-viewer::
	mv $(DEB_DESTDIR)/usr/bin/vncviewer \
	  $(DEB_DESTDIR)/usr/bin/xvncviewer
	mv $(DEB_DESTDIR)/usr/share/man/man1/vncviewer.1 \
	  $(DEB_DESTDIR)/usr/share/man/man1/xvncviewer.1
	mkdir -p $(DEB_DESTDIR)/usr/share/applications
	cp debian/xtigervncviewer.desktop \
	  $(DEB_DESTDIR)/usr/share/applications/
	mkdir -p $(DEB_DESTDIR)/usr/share/icons/hicolor/scalable/apps
	cp media/icons/tigervnc.svg \
	  $(DEB_DESTDIR)/usr/share/icons/hicolor/scalable/apps/
	for i in 16 22 24 32 48; do \
	  mkdir -p $(DEB_DESTDIR)/usr/share/icons/hicolor/$${i}x$${i}/apps; \
	  cp media/icons/tigervnc_$${i}.png \
	    $(DEB_DESTDIR)/usr/share/icons/hicolor/$${i}x$${i}/apps/tigervnc.png; \
	done
	# Hack, replace media/icons/tigervnc_16.png of wrong dimensions 20x20 by our fixed version.
	cp debian/tigervnc_16.png \
	  $(DEB_DESTDIR)/usr/share/icons/hicolor/16x16/apps/tigervnc.png

install/tigervnc-standalone-server install/tigervnc-xorg-extension::
	$(MAKE) TIGERVNC_BUILDDIR="$(CURDIR)/$(DEB_BUILDDIR)" -C $(DEB_BUILDDIR)/unix/xserver/hw/vnc DESTDIR=$(DEB_DESTDIR) install

common-binary-arch:: debian/tmp/common-binary-impl.stamp

common-binary-indep::

debian/tmp/common-binary-impl.stamp:
	cd $(DEB_DESTDIR) && find usr/bin usr/share/man -name "*vnc*" | while read line; do \
	  echo Rename "$$line" `echo "$$line" | sed -e 's/vnc/tigervnc/g'` ; \
	  mv "$$line" `echo "$$line" | sed -e 's/vnc/tigervnc/g'`; \
	done
	cp -pr debian/helpers/* \
	  debian/tmp
	find debian/tmp/usr/share/man -type f | while read line; do \
	  echo "Rewriting and renaming $$line into $$line.gz" ; \
	  sed -e 's/\<vncviewer\>/xtigervncviewer/g' \
	      -e 's/\<vncpasswd\>/tigervncpasswd/g' \
	      -e 's/\<vncconfig\>/tigervncconfig/g' \
	      -e 's/\<vncserver\>/tigervncserver/g' \
	      -e 's/\<x0vncserver\>/x0tigervncserver/g' \
	      -e 's/\<Xvnc\>/Xtigervnc/g' \
	      -e 's/\<Xtigervnc-session\>/Xvnc-session/g' \
	      $$line | \
	    gzip -9 > $$line.gz; \
	  rm -f $$line; \
	done
	touch $@

clean::
	rm -rf $(DEB_BUILDDIR)
	rm -f debian/*.debhelper.log