File: rules

package info (click to toggle)
mono 5.18.0.240+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,253,000 kB
  • sloc: cs: 10,925,936; xml: 2,804,987; ansic: 643,964; cpp: 120,384; perl: 59,272; asm: 21,383; sh: 20,162; makefile: 18,156; python: 4,715; pascal: 924; sql: 859; sed: 16; php: 1
file content (476 lines) | stat: -rwxr-xr-x 21,643 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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
#!/usr/bin/make -f
#export DH_VERBOSE=1

include debian/mono-archs.make

# Assume Debian behaviour by default.
DISTRO = $(shell lsb_release -si)

MAKEFILE = $(firstword $(MAKEFILE_LIST))
DEBIAN_DIR = $(dir $(MAKEFILE))
SOURCE_DIR = $(DEBIAN_DIR)/..

VERSION = $(shell dpkg-parsechangelog -l$(DEBIAN_DIR)/changelog | grep ^Vers | cut -d\  -f2)
UPVERSION = $(shell echo $(VERSION) | sed 's,-.*,,' | sed 's,+dfsg.*,,')
UPVERSION_THREEPART = $(shell echo $(UPVERSION) | cut -f1-3 -d.)
NEXT_UPVERSION = $(shell perl -e '$$_=pop; s/(\d+)$$/$$1+1/e; print' $(UPVERSION))
DEB_SOURCE_NAME = $(shell dpkg-parsechangelog -l$(DEBIAN_DIR)/changelog | grep ^Source | cut -d" " -f2)

RUN_MONO = LD_LIBRARY_PATH=debian/tmp/usr/lib MONO_PATH=debian/tmp/usr/lib/mono/4.5 debian/tmp/usr/bin/mono
KILL_MONO = pgrep mono | xargs kill -9
DH_INTERNAL_MONO_PARAM = --internal-mono
ifeq ($(shell dpkg --compare-versions $$(dpkg-query -f '$${Version}' -W debhelper) lt 7.1; echo $$?), 0)
	DH_INTERNAL_MONO_PARAM = internal-mono
endif

DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	CONF_FLAGS += --build $(DEB_HOST_GNU_TYPE)
else
	CONF_FLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
	CONF_FLAGS += --enable-minimal=aot
endif

ifeq ($(DEB_HOST_ARCH), armel)
	CONF_FLAGS += --with-fpu=NONE --with-tls=pthread
	BTLS_ARCH = true
endif

ifeq ($(DEB_HOST_ARCH), armhf)
	CONF_FLAGS += --with-tls=pthread
	BTLS_ARCH = true
endif

ifeq ($(DEB_HOST_ARCH), i386)
	BTLS_ARCH = true
endif

ifeq ($(DEB_HOST_ARCH), amd64)
	BTLS_ARCH = true
endif

ifeq ($(DEB_HOST_ARCH), mipsel)
	CONF_FLAGS += --with-tls=pthread
endif

ifeq ($(DEB_HOST_ARCH), powerpc)
	CONF_FLAGS += --with-tls=pthread
endif

ifeq ($(DEB_HOST_ARCH), ppc64)
	CONF_FLAGS += --with-tls=pthread
endif

ifeq ($(DEB_HOST_ARCH), ppc64el)
	CONF_FLAGS += --with-tls=pthread
	BTLS_ARCH = true
endif

ifeq ($(DEB_HOST_ARCH), s390x)
	BTLS_ARCH = true
	CFLAGS:=$(filter-out -fstack-protector-strong,$(CFLAGS))
endif

ifneq (,$(findstring $(DEB_HOST_ARCH),$(DEB_MONO_SGEN_ARCHS)))
	CONF_FLAGS += --with-sgen=yes
else
	CONF_FLAGS += --with-sgen=no
endif

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	MINI_TEST = true
	MONO_BOEHM_TEST = true
	MONO_SGEN_TEST = true
else
	TIMEOUT = timeout -k 1h 1h
	MINI_TEST = cd mono/mini && $(TIMEOUT) make check; $(KILL_MONO)
	MONO_BOEHM_TEST = cd mono/tests && MONO_ENV_OPTIONS=--gc=boehm $(TIMEOUT) make check; $(KILL_MONO)
	MONO_SGEN_TEST = cd mono/tests && MONO_ENV_OPTIONS=--gc=sgen $(TIMEOUT) make check; $(KILL_MONO)
endif

ifeq ($(DEB_HOST_ARCH), arm64)
	MONO_BOEHM_TEST = true
	CONF_FLAGS += --disable-boehm
	SKIP_LIBGC = true
	BTLS_ARCH = true
endif


CONFIGURE =	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"   \
		$(GCC) ./configure $(CONF_FLAGS) --prefix=/usr \
		  --mandir=\$${prefix}/share/man \
		  --infodir=\$${prefix}/share/info --sysconfdir=/etc \
		  --with-ikvm-native=no \
		  --disable-quiet-build \
		  --with-csc=mcs \
		  --disable-system-aot \
		  --enable-llvm=no \
		  --enable-loadedllvm=no

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	EGLIB_MAKE_FLAGS += -j$(NUMJOBS)
	LIBGC_MAKE_FLAGS += -j$(NUMJOBS)
	MONO_MAKE_FLAGS += -j$(NUMJOBS)
endif

source: source-stamp
source-stamp:
	cd $(DEBIAN_DIR) && tar cJf mono-source.tar.xz --exclude=mono-source.tar.xz -C ../.. $$(cd ..; basename $$(pwd))
	touch $@

autoreconf: autoreconf-stamp
autoreconf-stamp: source-stamp
	autoreconf -f -i -s
	touch $@

configure: configure-stamp
configure-stamp: autoreconf-stamp
	dh_testdir
	$(CONFIGURE)
	touch $@

build: build-stamp
build-indep: build-stamp
build-arch: build-stamp
build-stamp: configure-stamp
	dh_testdir
	cd mono/eglib && $(MAKE) $(EGLIB_MAKE_FLAGS)
ifndef SKIP_LIBGC
	cd libgc && $(MAKE) $(LIBGC_MAKE_FLAGS)
endif
	cd mono && $(MAKE) $(MONO_MAKE_FLAGS)
	LC_ALL=C $(MAKE) $(MAKE_FLAGS) EXTERNAL_MCS=false EXTERNAL_MONO=false

	cd debian/detector && \
	  $(MAKE)
	chmod +x debian/dh_makeclilibs \
	         debian/dh_clideps \
	         debian/dh_clistrip \
	         debian/dh_clifixperms \
	         debian/dh_monoaot

	cp -a ./external/binary-reference-assemblies/v4.7.1 ./external/binary-reference-assemblies/v4.7.1.debbak
	find ./external/binary-reference-assemblies/v4.7.1/ -name \*.dll -print -delete
	cd ./external/binary-reference-assemblies/ && MONO_PATH=$(CURDIR)/mcs/class/lib/net_4_x-linux/ V=1 CSC="$(CURDIR)/runtime/mono-wrapper $(CURDIR)/mcs/class/lib/net_4_x-linux/mcs.exe" make

	touch $@

test: test-stamp
test-stamp: build-stamp
	-$(MINI_TEST)
	-$(MONO_BOEHM_TEST)
	-$(MONO_SGEN_TEST)
	-$(KILL_MONO)
	# funny bug-459094.cs creates too long directory names which
	# pbuilder is unable to remove, eh
	rm -rf mono/tests/abcde12345abcde12345abcde12345abcde12345/
	touch $@

clean:
	echo "distro is $(DISTRO)"
	dh_testdir
	dh_testroot
ifneq ("$(wildcard external/binary-reference-assemblies/v4.7.1.debbak)","")
		rm -rf external/binary-reference-assemblies/v4.7.1
		mv external/binary-reference-assemblies/v4.7.1.debbak external/binary-reference-assemblies/v4.7.1
endif
	[ ! -f Makefile ] || $(MAKE) distclean
	# distclean misses stuff
	find -name "*.mdb" -delete
	find ./external/binary-reference-assemblies/ -name "*.dll" -not -path "./external/binary-reference-assemblies/v4.7.1/*" -print -delete
	rm -rf mcs/class/lib/basic/ \
	       mcs/class/lib/net_4_5/

	-cd debian/detector && $(MAKE) clean
	rm -f debian/MonoGetAssemblyName.exe

	# clean stuff handled by autoreconf
	rm -rf configure config.sub config.guess aclocal.m4 autom4te.cache/
	find . -name "Makefile.in" -delete

	rm -f mcs/packages/*.dll mcs/packages/*.exe* mcs/packages/*.rsp
	rm -f autoreconf-stamp
	rm -f configure-*-stamp
	rm -f build-*-stamp
	rm -f install-*-stamp

	dh_clean

install: install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	cd mcs/jay && \
		$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	# don't want docs of bundled libgc
	rm -rf debian/tmp/usr/share/libgc-mono
	# Mono.Security.Win32.dll is only useful on windows, as it wrap the win api
	rm -rf $(CURDIR)/debian/tmp/usr/lib/mono/gac/Mono.Security.Win32/
	rm -f  $(CURDIR)/debian/tmp/usr/lib/mono/4.5/Mono.Security.Win32.dll*
	# we don't ship bundled nunit of mono
	rm -f  $(CURDIR)/debian/tmp/usr/lib/mono/4.5/nunit*
	rm -f  $(CURDIR)/debian/tmp/usr/lib/pkgconfig/mono-nunit.pc
	rm -rf $(CURDIR)/debian/tmp/usr/lib/mono/gac/nunit*/
	rm -f  $(CURDIR)/debian/tmp/usr/bin/nunit*

	# mono 2.10.1 bug, prj2make was removed but the start script not
	rm -f $(CURDIR)/debian/tmp/usr/bin/prj2make

	# copy missing 2.0 manpages
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/al.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/al2.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/mcs.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/gmcs.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/mcs.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/dmcs.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/mono-service.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/mono-service2.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/wsdl.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/wsdl2.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/gacutil.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/gacutil2.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/monop.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/monop2.1
	cp $(CURDIR)/debian/tmp/usr/share/man/man1/resgen.1 \
	   $(CURDIR)/debian/tmp/usr/share/man/man1/resgen2.1
	touch $@

binary: binary-arch binary-indep

binary-indep: build-stamp install-stamp
	dh_testdir
	dh_testroot

	# Build the late-GAC tool,
	# using the built Mono runtime from debian/tmp
	# (thus the install-arch target dependency!)
	$(RUN_MONO) mcs/class/lib/build/mcs.exe \
	  -target:exe \
	  -out:debian/MonoGetAssemblyName.exe \
	  debian/MonoGetAssemblyName.cs

	# that exclude list are programs for arch-dep packages
	dh_install -i --list-missing -Xusr/share/man -Xusr/share/jay -Xusr/lib/libmono -Xusr/lib/libMono -Xbin/monodis -Xbin/monograph -Xbin/mono-find-provides -Xbin/mono-find-requires -Xbin/pedump -Xbin/jay

	# Late GAC
	install -D -m 755 debian/mono.runtime-script debian/mono-gac/usr/share/cli-common/runtimes.d/mono

	install -m 644 debian/System.Data.dll.config debian/libmono-system-data4.0-cil/usr/lib/mono/gac/System.Data/4.0.*/
	install -m 644 debian/System.Drawing.dll.config debian/libmono-system-drawing4.0-cil/usr/lib/mono/gac/System.Drawing/4.0.*/
	install -m 644 debian/System.Windows.Forms.dll.config debian/libmono-system-windows-forms4.0-cil/usr/lib/mono/gac/System.Windows.Forms/4.0.*/
	install -m 644 debian/Mono.Cairo.dll.config debian/libmono-cairo4.0-cil/usr/lib/mono/gac/Mono.Cairo/4.0.*/
	install -m 644 debian/Mono.WebBrowser.dll.config debian/libmono-webbrowser4.0-cil/usr/lib/mono/gac/Mono.WebBrowser/4.0.*/
	
	dh_link -i
	dh_installchangelogs -i -X ChangeLog
	dh_installdocs -i
	dh_installman -i
	debian/dh_clistrip -i --dbg-package=mono-dbg
	dh_compress -i
	
	dh_fixperms -i
	debian/dh_clifixperms -i
	DH_AUTOSCRIPTDIR=$(CURDIR)/debian debian/dh_monoaot -i
	dh_installdeb -i
	debian/dh_makeclilibs -i -m 1.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-cairo4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-cecil-private-cil -m $(UPVERSION) $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-compilerservices-symbolwriter4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-corlib4.5-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-csharp4.0c-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-data-tds4.0-cil -m 4.2.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-debugger-soft4.0a-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n4.0-cil -m 4.0.0~alpha1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n-cjk4.0-cil -m 4.0.0~alpha1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n-mideast4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n-other4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n-rare4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-i18n-west4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-ldap4.0-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-oracle4.0-cil -m 3.12.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-peapi4.0a-cil -m 4.2.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-posix4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-messaging4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-messaging-rabbitmq4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-build4.0-cil -m 3.6.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-build-engine4.0-cil -m 3.2.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-build-framework4.0-cil -m 3.6.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-build-tasks-v4.0-4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-build-utilities-v4.0-4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-microsoft-web-infrastructure1.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-relaxng4.0-cil -m 2.10.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-security4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-sharpzip4.84-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-simd4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-smdiagnostics0.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system4.0-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-componentmodel-composition4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-componentmodel-dataannotations4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-configuration4.0-cil -m 4.0.0~alpha1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-core4.0-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-data4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-data-services4.0-cil -m 3.2.8 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-data-datasetextensions4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-design4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-drawing4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-identitymodel4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-io-compression4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-io-compression-filesystem4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-ldap4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-messaging4.0-cil -m 2.10.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-net-http4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-net-http-webrequest4.0-cil -m 3.2.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-numerics4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-numerics-vectors4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-runtime4.0-cil -m 2.10.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-runtime-caching4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-runtime-durableinstancing4.0-cil -m 4.2.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-runtime-serialization4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-security4.0-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-servicemodel4.0a-cil -m 5.18.0.240 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-servicemodel-web4.0-cil -m 3.2.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-serviceprocess4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-threading-tasks-dataflow4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-transactions4.0-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-web4.0-cil -m 2.10.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-web-extensions4.0-cil -m 2.10.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-web-http-webhost4.0-cil -m 3.2.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-web-services4.0-cil -m 4.2.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-windows4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-windows-forms4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-windows-forms-datavisualization4.0a-cil -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-xaml4.0-cil -m 4.2.0 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-xml4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-xml-linq4.0-cil -m 5.16.0.220 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-system-xml-serialization4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-security4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-sqlite4.0-cil -m 3.0.6 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-windowsbase4.0-cil -m 4.6.1.3 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p monodoc-base -m 3.2.1 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p mono-xbuild -m 5.12.0.309 $(DH_INTERNAL_MONO_PARAM)
	debian/dh_makeclilibs -p libmono-cecil-private-cil -m $(UPVERSION) -l $(NEXT_UPVERSION) $(DH_INTERNAL_MONO_PARAM)
	debian/dh_clideps -i -X/usr/lib/mono/2.0-api -X/usr/lib/mono/3.5-api -X/usr/lib/mono/4.0-api -X/usr/lib/mono/4.5.1-api \
		-X/usr/lib/mono/4.5.2-api -X/usr/lib/mono/4.5-api -X/usr/lib/mono/4.6.1-api -X/usr/lib/mono/4.6.2-api \
		-X/usr/lib/mono/4.6-api -X/usr/lib/mono/4.7.1-api -X/usr/lib/mono/4.7.2-api -X/usr/lib/mono/4.7-api \
		-l debian/tmp $(DH_INTERNAL_MONO_PARAM)
	#DH_VERBOSE=1 debian/dh_clideps -i -l debian/tmp $(DH_INTERNAL_MONO_PARAM)
	# mono-1.0/2.0-gac needs special runtime dep, to prevent circular dep (mono-runtime <-> mono-1.0/2.0-gac)
	debian/dh_clideps -p mono-4.0-gac -r $(DH_INTERNAL_MONO_PARAM)
	dh_gencontrol -i -- -Vmono:upversion=$(UPVERSION) -Vmono:next-upversion=$(NEXT_UPVERSION)
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build-stamp install-stamp test-stamp
	dh_testdir
	dh_testroot
	
	cd debian/detector && \
	  install -D -m 755 binfmt-detector-cli $(CURDIR)/debian/mono-runtime/usr/lib/cli/binfmt-detector-cli
	install -D -m 644 -o root -g root debian/cli.binfmt \
	  debian/mono-runtime/usr/share/binfmts/cli

	dh_install -s
ifndef SKIP_LIBGC
	install -m 644 debian/tmp/usr/bin/pedump debian/mono-utils/usr/bin/
endif
ifdef BTLS_ARCH
	install -D -m 644 debian/tmp/usr/lib/libmono-btls-shared.so debian/mono-runtime-common/usr/lib/
endif
	dh_link -s
	dh_installchangelogs -s -X ChangeLog
	dh_installchangelogs -pmono-runtime
	dh_installdocs -s
	dh_installman -s
	dh_installexamples -s
	dh_installexamples -pmono-jay $(CURDIR)/mcs/jay/skeleton.cs
	dh_strip -pmono-runtime-sgen -pmono-runtime-boehm --dbg-package=mono-runtime-dbg
	dh_strip -plibmonoboehm-2.0-1 --dbg-package=libmonoboehm-2.0-1-dbg
	dh_strip -plibmonosgen-2.0-1 --dbg-package=libmonosgen-2.0-1-dbg
	dh_strip -s -Xbin/mono-sgen -Xbin/mono-boehm
	dh_compress -s -Xskeleton.cs

	dh_fixperms -s
ifndef SKIP_LIBGC
	dpkg-gensymbols -plibmonoboehm-2.0-1 -edebian/tmp/usr/lib/libmonoboehm-2.0.so.1 -c4
endif
	dpkg-gensymbols -plibmonosgen-2.0-1 -edebian/tmp/usr/lib/libmonosgen-2.0.so.1 -c4
	dh_makeshlibs -s -V
ifndef SKIP_LIBGC
	dh_makeshlibs -plibmonoboehm-2.0-1 -V 'libmonoboehm-2.0-1 (>= $(UPVERSION))'
endif
	dh_makeshlibs -plibmonosgen-2.0-1 -V 'libmonosgen-2.0-1 (>= $(UPVERSION))'
	dh_installdeb -s
	dh_shlibdeps -s -Xlibmono-profiler-cov -ldebian/libmonoboehm-2.0-1/usr/lib -ldebian/libmonosgen-2.0-1/usr/lib
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

get-orig-source: TARBALL_DIR = $(DEB_SOURCE_NAME)-$(UPVERSION)
get-orig-source:
	uscan \
		--package $(DEB_SOURCE_NAME) \
		--watchfile $(DEBIAN_DIR)/watch \
		--upstream-version $(UPVERSION) \
		--download-version $(UPVERSION) \
		--destdir . \
		--force-download \
		--rename \
		--repack
	if [ -d $(TARBALL_DIR) ]; then \
		echo "$(TARBALL_DIR) is in the way, bailing out!"; \
		exit 1; \
	fi
	if [ -d $(TARBALL_DIR)+dfsg ]; then \
		echo "$(TARBALL_DIR)+dfsg is in the way, bailing out!"; \
		exit 1; \
	fi
	tar -xzf $(DEB_SOURCE_NAME)_$(UPVERSION).orig.tar.gz
	rm $(DEB_SOURCE_NAME)_$(UPVERSION).orig.tar.gz
	rm -rf $(TARBALL_DIR)/external/Lucene.Net/lib/
	rm -fr $(TARBALL_DIR)/mcs/packages/mnt/
	rm -fr $(TARBALL_DIR)/external/roslyn-binaries/
	rm -fr $(TARBALL_DIR)/external/api-doc-tools/external/SharpZipLib/Documentation/
	# Need to delete binary reference assemblies, except for v4.7.1 which is used to build classlib
	# as per API_BIN_PROFILE in mcs/build/profiles/net_4_x.make
	find $(TARBALL_DIR) -name "*.dll" -not -path "$(TARBALL_DIR)/mcs/class/lib/monolite-linux/*" -not -path "$(TARBALL_DIR)/external/binary-reference-assemblies/v4.7.1/*" -print -delete
	find $(TARBALL_DIR) -name "*.exe" -not -path "$(TARBALL_DIR)/mcs/class/lib/monolite-linux/*" -not -path "$(TARBALL_DIR)/external/binary-reference-assemblies/v4.7.1/*" -print -delete
	find $(TARBALL_DIR) -name "*.chm" -not -path "$(TARBALL_DIR)/mcs/class/lib/monolite-linux/*" -print -delete
	find $(TARBALL_DIR) -name "*.nupkg" -print -delete
	find $(TARBALL_DIR)/external/ -name ".git" -print -delete
	find $(TARBALL_DIR)/external/ -name "*.o" -print -delete
	find $(TARBALL_DIR)/external/ -name "*.lo" -print -delete
	find $(TARBALL_DIR)/external/ -name "*.so" -print -delete
	find $(TARBALL_DIR)/external/ -name "*.Plo" -print -delete
	find $(TARBALL_DIR)/external/ -name ".dirstamp" -print -delete
	find $(TARBALL_DIR)/external/ -name ".libs" -print -delete
	find $(TARBALL_DIR)/external/ -name ".deps" -print -delete
	mv $(TARBALL_DIR) $(TARBALL_DIR)+dfsg
	tar -czf $(DEB_SOURCE_NAME)_$(UPVERSION)+dfsg.orig.tar.gz $(TARBALL_DIR)+dfsg
	rm -r $(TARBALL_DIR)+dfsg

.PHONY: autoreconf \
        configure \
        clean \
        build build-all \
        test \
        install install-all install-arch install-indep \
        binary binary-arch binary-indep \
        get-orig-source

.NOTPARALLEL: