File: rules

package info (click to toggle)
eclipse 3.2.1-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 54,216 kB
  • ctags: 71
  • sloc: sh: 8,046; makefile: 496
file content (675 lines) | stat: -rwxr-xr-x 21,890 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
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
#!/usr/bin/make -f

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

DISTRIBUTION := $(shell lsb_release -is)

BUILD_DEPS :=

export DH_OPTIONS =
export SHELL = /bin/bash

DEB_GCJ_PACKAGES := eclipse-rcp eclipse-platform eclipse-jdt eclipse-pde libswt3.2-gtk
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

enable_native := no

ifeq ($(DEB_HOST_ARCH),i386)
    enable_native=yes
    ECLIPSE_PLATFORM=x86
endif
ifeq ($(DEB_HOST_ARCH),ia64)
    enable_native=yes
    ECLIPSE_PLATFORM=ia64
endif
ifeq ($(DEB_HOST_ARCH),amd64)
    enable_native=yes
    ECLIPSE_PLATFORM=x86_64
endif
ifeq ($(DEB_HOST_ARCH),powerpc)
    enable_native=yes
    ECLIPSE_PLATFORM=ppc
endif
ifeq ($(ECLIPSE_PLATFORM),)
    enable_native=yes
    ECLIPSE_PLATFORM=$(DEB_HOST_ARCH)
endif

ifeq ($(enable_native),yes)
    AVAIL_CPUS := $(shell n=$$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1); awk -v n=$$n '/^MemTotal:/ { n2=int($$2/196608); if (n2<n) n=n2; print n}' /proc/meminfo)
  ifneq ($(AVAIL_CPUS),1)
	AOT_MAKEFLAGS = -j$(AVAIL_CPUS)
	export AOT_MAKEFLAGS
  endif
endif

SOURCE=$(shell ls upstream/eclipse*.tar.bz2)
SOURCE_ICU4J=$(shell ls upstream/icu4j*.tar.bz2)
SOURCE_JSCH=$(shell ls upstream/jsch*.tar.bz2)

SOURCE_TREE=$(CURDIR)/source-tree
BUILD_TREE=$(CURDIR)/build-tree

SOURCE_VERSION=$(shell head -1 debian/changelog | sed -e 's/^.*(\(.*\)).*$$/\1/')
UPSTREAM_VERSION=$(shell echo $(SOURCE_VERSION) | sed -e 's/-.*$$//')
REL=v3235

export JAVA_HOME=/usr/lib/jvm/java-gcj

# GCJ configuration
# GCJ_RUN		command line to launch gcj
# AOT_COMPILE		command line to AOT compile jars to native
GCJ_VERSION=4.1
GCJ_RUN=/usr/bin/gcj-$(GCJ_VERSION)
GCJ_DBTOOL=/usr/bin/gcj-dbtool-$(GCJ_VERSION)
GCJ_JARDIR=/usr/lib/gcj/eclipse
AOT_COMPILE=/usr/bin/aot-compile

# Virtual machine configuration.
# JAVA_RUN		command line to start the virtual machine
# JAVA_CLASSPATH	classpath components neccassary for the VM to function
JAVA_RUN=/usr/lib/jvm/java-gcj/bin/java
JAVA_CLASSPATH=

# Ant configuration.
# ANT_CLASSPATH		classpath components required to run Ant
# ANT_CLASS		class containing the Main method for Ant
# ANT_OPTS		properties to be added to the VM when running Ant
ANT_CLASSPATH=/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-launcher.jar
# use ecj-bootstrap as compiler
ANT_CLASSPATH=/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/java/ecj.jar
ANT_CLASS=org.apache.tools.ant.Main
ANT_OPTS=-DjavacFailOnError=true -DjavacVerbose=false -DjavacSource=1.3 -DjavacTarget=1.3 -Dbootclasspath=
ANT_DEP := ant-optional (>= 1.6.5-3)
BUILD_DEPS += , ant-optional (>= 1.6.5-3)

# Generic VM compilation.
JVM_CLASSPATH=
JVM_COMPILER=gcj
# use ecj-bootstrap as compiler
JVM_COMPILER=org.eclipse.jdt.core.JDTCompilerAdapter
JVM_ANT_RUN=$(JAVA_RUN) -cp $(ANT_CLASSPATH):$(JVM_CLASSPATH) $(ANT_OPTS) -Dbuild.compiler=$(JVM_COMPILER) -Dbuild.compiler.warnings=false $(ANT_CLASS)

# Eclipse Compiler for Java configuration.
# ECJ_COMPILER		Ant compilation adapter class
# ECJ_ANT_RUN		command line for invoking Ant with ecj
ECJ_COMPILER=org.eclipse.jdt.core.JDTCompilerAdapter
ECJ_ANT_RUN=$(JAVA_RUN) -cp $(ANT_CLASSPATH) $(ANT_OPTS) -Dbuild.compiler=$(ECJ_COMPILER) $(ANT_CLASS)

# Variables for package creation.
ECLIPSE_HOME=usr/lib/eclipse
DEBIAN_TMP=$(CURDIR)/debian/tmp
EXTRA=$(CURDIR)/debian/extra

with_tomcat := yes
ifeq ($(with_tomcat),yes)
  TOMCAT_DEP = libtomcat5.5-java
  BUILD_DEPS += , libtomcat5.5-java
endif

with_browser := xulrunner
#with_browser := mozilla
#with_browser := firefox
ifeq ($(DISTRIBUTION),Ubuntu)
  with_browser := firefox
endif

with_dpatch = yes
#with_dpatch = no


eclipse_patches = \
	eclipse-ant-manifest \
	eclipse-helpindexbuilder \
	eclipse-fileinitializer \
	eclipse-gnuformatterjdt \
	eclipse-gnuformatterjdtui \
	eclipse-libswt-enableall \
	eclipse-libupdatebuild \
	eclipse-libupdatebuild2 \
	eclipse-jsch \
	eclipse-disable-junit4-apt \
	eclipse-libswt-xpcomgcc4 \
	eclipse-icu4j-build-files \
	eclipse-jsch-build-files \
	eclipse-awt-libpath \
	eclipse-nativepresentation \
	eclipse-updatehomedir \
	eclipse-swttools \
	eclipse-swt-x11 \
	eclipse-build \
	eclipse-disable-motif \

#	eclipse-icon \
#	eclipse-efj \
#	eclipse-disable-filelog \
#	eclipse-libswt-mozilla-classic \
#	eclipse-javadoc-bootclasspath \
#	eclipse-link-classpathdoc \
#	eclipse-gjdoc-reflection \
#	eclipse-public-applypatch \

ifeq ($(with_tomcat),yes)
  eclipse_patches += \
	eclipse-tomcat55-build.dpatch \
	eclipse-tomcat55.dpatch \
	eclipse-webapp-tomcat55.dpatch
#	eclipse-webapp-tomcat55-newarches.dpatch
else
  eclipse_patches += \
	eclipse-disable-tomcat
endif

ifeq ($(with_browser),xulrunner)
  eclipse_patches += \
	eclipse-libswt-xulrunner \
	eclipse-libswt-firefox2 \

#	eclipse-libswt-mozilla-profiles

  BUILD_DEPS += , libxul-dev
  MOZILLA_DEP = $${shlibs:Depends}
  MOZILLA_HOME = /usr/lib/mozilla
endif

ifeq ($(with_browser),mozilla)
  eclipse_patches += \
	eclipse-libswt-mozilla \
	eclipse-libswt-mozilla-profiles

  BUILD_DEPS += , mozilla-dev
#  MOZILLA_DEP = mozilla-browser (>= 2:1.7.0) | firefox (>= 1.4.99) | mozilla-firefox (>= 1.0.7)
  MOZILLA_DEP = mozilla-browser (>= 2:1.7.0)
  MOZILLA_HOME = /usr/lib/mozilla
endif

ifeq ($(with_browser),firefox)
  eclipse_patches += \
	eclipse-libswt-firefox \
	eclipse-libswt-firefox2

  BUILD_DEPS += , firefox-dev
#  MOZILLA_DEP = firefox (>= 1.4.99) | mozilla-browser (>= 2:1.7.0) | mozilla-firefox (>= 1.0.7)
  MOZILLA_DEP = firefox (>= 1.4.99)
  MOZILLA_HOME = /usr/lib/firefox
endif

export PATCHLIST = $(eclipse_patches)

debian/control: debian/control.in debian/rules
	sed -e 's/@ANT_DEP@/$(ANT_DEP)/g' \
	    -e 's/@TOMCAT_DEP@/$(TOMCAT_DEP)/g' \
	    -e 's/@MOZILLA_DEP@/$(MOZILLA_DEP)/g' \
	    -e 's/@BUILD_DEPS@/$(BUILD_DEPS)/g' \
	    -e 's,@SECTION_PREFIX@,$(SECTION_PREFIX),g' \
	    -e 's/ ,/,/g' \
		debian/control.in > debian/control.tmp
	if cmp -s debian/control debian/control.tmp; then \
	  rm debian/control.tmp; \
	else \
	  mv debian/control.tmp debian/control; \
	  echo "debian/control did change, please restart the build"; \
	  exit 1; \
	fi


uncompress: uncompress-stamp
uncompress-stamp: debian/control
	dh_testdir

	# The building happens inside the source-tree directory. This makes
	# cleanup much easier.
	mkdir -p "$(SOURCE_TREE)"
	(cd "$(SOURCE_TREE)" && tar xfj ../"$(SOURCE)" > /dev/null)

	rm $(SOURCE_TREE)/baseLocation/plugins/com.ibm.icu.source_3.4.5/src/com.ibm.icu_3.4.5/src.zip
	rm $(SOURCE_TREE)/baseLocation/plugins/com.ibm.icu.base.source_3.4.5/src/com.ibm.icu.base_3.4.5/src.zip

	@cd $(SOURCE_TREE)/baseLocation/plugins; \
	mkdir icu4j-build-temp; \
	cd icu4j-build-temp; \
	tar xfj ../../../../$(SOURCE_ICU4J); \
	sed --in-place "s/ .*bootclasspath=.*//g" build.xml; \
	ant eclipseProjects; \
	cd ..; \
	mkdir -p icu4j-build; \
	mv icu4j-build-temp/eclipseProjects/com.ibm.icu icu4j-build; \
	mv icu4j-build-temp/eclipseProjects/com.ibm.icu.base icu4j-build; \
	rm -r icu4j-build-temp

	@cd $(SOURCE_TREE)/baseLocation/plugins; \
	tar xfj ../../../$(SOURCE_JSCH); \

	touch uncompress-stamp

ifeq ($(with_dpatch),yes)
# Include dpatch stuff.
DPATCH_STAMPFN=dpatch-stamp
include /usr/share/dpatch/dpatch.make

patch-stamp: uncompress-stamp dpatch-stamp
	cp dpatch-stamp patch-stamp
else
patch_ext = dpatch

patch: patch-stamp
patch-stamp: uncompress-stamp
	dh_testdir

	# This patch system was orginally copied off of the one found in cdbs.

	@cd $(SOURCE_TREE); \
	test $$(find $(CURDIR)/debian/patches/ -maxdepth 1 -name '*.$(patch_ext)' | wc -l) -eq 0 && exit 0; \
	for patch in $(CURDIR)/debian/patches/*.$(patch_ext); do \
		success=""; \
		echo -n "trying patch $$(basename $$patch) at level "; \
		for level in 0 1 2 3; do \
			if test -z "$$success"; then \
				echo -n "$$level..."; \
				if patch -f -p$$level -E --dry-run < $$patch > /dev/null 2>&1; then \
					if patch -f -p$$level -E -V never < $$patch > /dev/null 2>&1; then \
						success=yes; \
						echo "success."; \
					fi; \
				fi; \
			fi; \
		done; \
		if test -z "$$success"; then \
			echo "failure."; \
			exit 1; \
		fi; \
	done

	# This has been modified to work "per-plug-in". Patches are put in the
	# debian/patches/plugin directory. They are named with a common pattern
	# "<plugin>_<description>.patch". They are applied automatically, in
	# the specified plug-in's directory with an increasing -p argument.
	#
	# Note: If you are making a patch that only adds files, include a no-op
	# modification so the patch only applies at the correct -p level.

	@cd $(SOURCE_TREE); \
	test $$(find $(CURDIR)/debian/patches/plugins/ -maxdepth 1 -name '*.$(patch_ext)' | wc -l) -eq 0 && exit 0; \
	for patch in $(CURDIR)/debian/patches/plugins/*.$(patch_ext); do \
		plugin=$$(basename $$patch | cut -d_ -f1); \
		if test ! -d $(SOURCE_TREE)/plugins/$$plugin/; then \
			echo "invalid plugin $$plugin."; \
			exit 1; \
		fi; \
		cd $(SOURCE_TREE)/plugins/$$plugin/; \
		success=""; \
		echo -n "trying patch $$(basename $$patch) at level "; \
		for level in 0 1 2 3; do \
			if test -z "$$success"; then \
				echo -n "$$level..."; \
				if patch -f -p$$level -E --dry-run < $$patch > /dev/null 2>&1; then \
					if patch -f -p$$level -E -V never < $$patch > /dev/null 2>&1; then \
						success=yes; \
						echo "success."; \
					fi; \
				fi; \
			fi; \
		done; \
		if test -z "$$success"; then \
			echo "failure."; \
			exit 1; \
		fi; \
	done

	touch patch-stamp
endif

prepare: prepare-stamp
prepare-stamp: patch-stamp
	dh_testdir

	# A number of the Ant build files have the verbosity increased. This
	# simply makes a lot of text. We set it back down here.
	find . -type f -name "build.xml" -exec \
		perl -pi -e 's| verbose="true"| verbose="false"|g' \
		{} ';'

	# Replace all jars by links to previous install libraries.	
ifeq ($(with_tomcat),yes)
	cat $(EXTRA)/links.txt | while read FROM TO; do \
		if [ ! -d $(SOURCE_TREE)/plugins/$$(dirname $$TO) ]; then \
			mkdir -p $(SOURCE_TREE)/plugins/$$(dirname $$TO); \
		fi; \
		ln -sf $$FROM $(SOURCE_TREE)/plugins/$$TO; \
	done
else
	cat $(EXTRA)/links.txt | grep -v tomcat | while read FROM TO; do \
		ln -sf $$FROM $(SOURCE_TREE)/plugins/$$TO; \
	done
endif

	# Build icu4j
	cd $(SOURCE_TREE)/baseLocation/plugins; \
	zipfile=$$PWD/com.ibm.icu.base.source_3.4.5/src/com.ibm.icu.base_3.4.5/src.zip; \
	pushd icu4j-build/com.ibm.icu.base/src; \
	find -name \*.java | xargs touch --date=1/1/1970; \
	zip -X -9 -r $$zipfile . -i \*.java; \
	popd; \
	pushd icu4j-build/com.ibm.icu.base; \
	ant build.update.jar; \
	popd; \
	mv icu4j-build/com.ibm.icu.base/com.ibm.icu.base_3.4.5.jar .

	cd $(SOURCE_TREE)/baseLocation/plugins; \
	zipfile=$$PWD/com.ibm.icu.source_3.4.5/src/com.ibm.icu_3.4.5/src.zip; \
	pushd icu4j-build/com.ibm.icu/src; \
	find -name \*.java | xargs touch --date=1/1/1970; \
	zip -X -9 -r $$zipfile . -i \*.java; \
	popd; \
	pushd icu4j-build/com.ibm.icu; \
	ant build.update.jar; \
	popd; \
	mv icu4j-build/com.ibm.icu/com.ibm.icu_3.4.5.jar .

	# Build jsch
	cd $(SOURCE_TREE)/baseLocation/plugins/jsch-0.1.28; \
	ant dist; \
	mv dist/lib/com.jcraft.jsch_0.1.28.jar ..

	# Update build ids in configuration files
	cd $(SOURCE_TREE) && \
	$(JVM_ANT_RUN) \
		-Djava5.home=/usr/lib/jvm/java-gcj \
		-Djava.endorsed.dirs=$(SOURCE_TREE)/plugins/org.eclipse.tomcat \
		-Dnobootstrap=true \
		-DinstallOs=linux \
		-DinstallWs=gtk \
		-DinstallArch=$(ECLIPSE_PLATFORM) \
		-Dlibsconfig=true \
		insertBuildId

	touch prepare-stamp


build: build-java
build-java: build-java-stamp
build-java-stamp: prepare-stamp
	dh_testdir

	# Build the complete Eclipse SDK distribution. This takes a long time.
	# The libsconfig argument tells the build to build the native
	# components as well.
	cd $(SOURCE_TREE) && \
	$(ECJ_ANT_RUN) \
		-Djava5.home=/usr/lib/jvm/java-gcj \
		-Djava.endorsed.dirs=$(SOURCE_TREE)/plugins/org.eclipse.tomcat \
		-Dnobootstrap=true \
		-DinstallOs=linux \
		-DinstallWs=gtk \
		-DinstallArch=$(ECLIPSE_PLATFORM) \
		-Dlibsconfig=true \
		compilelibs
	# Build done

	touch build-java-stamp


install-eclipse: install-eclipse-stamp
install-eclipse-stamp: build-java-stamp

	# Run the Eclipse installation procedure for the selected architecture.
	# This creates a tar file. We do this in a seperate target for
	# debugging purposes: it takes a long time.
	cd $(SOURCE_TREE) && \
	$(ECJ_ANT_RUN) \
		-Djava5.home=/usr/lib/jvm/java-gcj \
		-Dconfiguration=linux.gtk.$(ECLIPSE_PLATFORM) \
		-DinstallOs=linux \
		-DinstallWs=gtk \
		-DinstallArch=$(ECLIPSE_PLATFORM) \
		install
	# Install done

	touch install-eclipse-stamp


install: install-stamp
install-stamp: DH_OPTIONS=
install-stamp: build-java-stamp install-eclipse-stamp post-install-stamp gcj-install-stamp
	dh_installdirs
	dh_install $(foreach p,$(DEB_GCJ_PACKAGES),-N$(p)-gcj)
ifeq ($(enable_native),yes)
	dh_install --sourcedir=debian/tmp-native $(foreach p,$(DEB_GCJ_PACKAGES),-p$(p)-gcj)
endif
	touch install-stamp

post-install-stamp:
	dh_testdir
	dh_testroot

	# Install the tar file into our destination directory.
	install -d $(DEBIAN_TMP)/$(ECLIPSE_HOME)
	tar xzvf $(SOURCE_TREE)/result/*.tar.gz -C $(DEBIAN_TMP)/$(ECLIPSE_HOME)/..

	# Builds any Debian-specific extra files.

	mkdir -p $(BUILD_TREE)

	# Put debian version into about.mappings of org.eclipse.sdk to show it
	# in Eclispe about dialog.
	plugin_dir=$$(ls -d $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.sdk_$(UPSTREAM_VERSION)*) ; \
	sed -e "s/\(0=.*\)/\1 ($(DISTRIBUTION) version: $(SOURCE_VERSION))/" < $$plugin_dir/about.mappings > $$plugin_dir/about.mappings.tmp ; \
	mv $$plugin_dir/about.mappings.tmp $$plugin_dir/about.mappings

	# Extract our icon. It is uuencoded because binary files cannot be
	# included in a source package.
	mkdir -p $(DEBIAN_TMP)/usr/share/pixmaps
	cp $(SOURCE_TREE)/plugins/org.eclipse.platform/eclipse*.png $(DEBIAN_TMP)/usr/share/pixmaps/

	# Because Java cannot read Unix soft links, it simply copies the data
	# of all our previously replaced Jar files. We must now go through the
	# process of linking them back to the Debian versions.

ifeq ($(with_tomcat),yes)
	cat $(EXTRA)/package-links.txt | while read FROM TO; do \
		if [ ! -d $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$(dirname $$TO) ]; then \
			mkdir -p $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$(dirname $$TO); \
		fi; \
		ln -sf $$FROM $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$TO; \
	done
else
	cat $(EXTRA)/package-links.txt | grep -v tomcat | while read FROM TO; do \
		if [ ! -d $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$(dirname $$TO) ]; then \
			mkdir -p $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$(dirname $$TO); \
		fi; \
		ln -sf $$FROM $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/$$TO; \
	done
endif

	# Preinitialize the Eclipse directory. This extracts bundles
	# which contain .so files. This prevents the .so files from being
	# extracted to the user's workspace during runtime.
	cd $(DEBIAN_TMP)/$(ECLIPSE_HOME) && \
	$(JAVA_RUN) -cp startup.jar \
		org.eclipse.core.launcher.Main -consolelog \
		-application org.eclipse.core.runtime.initializer \
		-fileInitializer $(EXTRA)/filenamepatterns.txt

	# Version-less SWT Jar links.
	mkdir -p $(DEBIAN_TMP)/usr/lib/java && \
	cd $(DEBIAN_TMP)/usr/lib/java && \
	ln -sf ../eclipse/plugins/org.eclipse.swt.gtk.linux.$(ECLIPSE_PLATFORM)_$(UPSTREAM_VERSION).$(REL).jar swt3.2-gtk.jar && \
	ln -sf swt3.2-gtk.jar swt-gtk.jar && \
	ln -sf swt3.2-gtk.jar swt.jar

	# Missing permissions.
	chmod a+x $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/bin/ant
	chmod a+x $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/bin/antRun*

	# This files are not required for our Eclipse distribution.
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/bin/*.bat
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/bin/runant.*
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/bin/complete-ant-cmd.pl
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/about_files/LICENSE.dom.txt
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.apache.ant_*/about_files/LICENSE.sax.txt
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.tomcat_*/about_files/mx4j.license
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.jdt.source_*/src/org.eclipse.jdt.apt.core_*/mirror-api-license.txt
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.platform.source_*/src/org.apache.ant_*/about_files/LICENSE.sax.txt
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.platform.source_*/src/org.eclipse.tomcat_*/mx4j.license
	rm -f $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins/org.eclipse.rcp.source.linux.gtk.x86_*/src/org.eclipse.swt.gtk.linux.x86_*/about_files/pixman-licenses.txt

	# Install extra Debian-specific Eclipse files into our installation
	# directory. We don't use dh_install to do this purely for
	# organization.
	mkdir -p                                    $(DEBIAN_TMP)/usr/share/applications/
	cp $(EXTRA)/eclipse.desktop                 $(DEBIAN_TMP)/usr/share/applications/eclipse.desktop
	mkdir -p                                    $(DEBIAN_TMP)/usr/bin/
	sed 's,@MOZILLA_FIVE_HOME_DEFAULT@,$(MOZILLA_HOME),g' $(EXTRA)/eclipse.sh \
	    > $(DEBIAN_TMP)/usr/bin/eclipse
	chmod 755 $(DEBIAN_TMP)/usr/bin/eclipse
	cp $(EXTRA)/efj.sh                          $(DEBIAN_TMP)/usr/bin/efj
	mkdir -p                                    $(DEBIAN_TMP)/usr/share/pixmaps/
	cp $(EXTRA)/eclipse32.xpm                   $(DEBIAN_TMP)/usr/share/pixmaps/eclipse32.xpm
	mkdir -p                                    $(DEBIAN_TMP)/$(ECLIPSE_HOME)/links/
	cp $(EXTRA)/*.link                          $(DEBIAN_TMP)/$(ECLIPSE_HOME)/links/

	touch post-install-stamp

gcj-install: gcj-install-stamp
gcj-install-stamp: post-install-stamp
ifeq ($(enable_native),yes)
	mkdir -p debian/tmp-native
	for jar in $$(find $(DEBIAN_TMP)/$(ECLIPSE_HOME)/plugins ! -type l -name '*.jar'); do \
	  case "$$jar" in \
	    *ant*.jar|*catalina.jar) continue;; \
	    *org.eclipse.jface.text) continue;; \
	    *org.eclipse.ui.workbench) continue;; \
	    *org.eclipse.ui.forms) continue;; \
	  esac; \
	  djar=$$(echo $$jar | sed 's,$(DEBIAN_TMP),debian/tmp-native,'); \
	  ddir=$$(dirname $$djar); \
	  if ! cmp --quiet $$jar $$djar; then \
	    mkdir -p $$ddir; \
	    cp -p $$jar $$djar; \
	  fi; \
	done

	$(AOT_COMPILE) -L /usr/lib/gcj/eclipse \
		debian/tmp-native debian/tmp-native/usr/lib/gcj/eclipse
endif
	touch gcj-install-stamp

binary-indep: DH_OPTIONS=-i
binary-indep: install-stamp
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_fixperms

	dh_makeshlibs
	dh_shlibdeps
	dh_compress
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb


ifeq ($(enable_native),yes)
binary-arch:	DH_OPTIONS=-s
else
binary-arch:	DH_OPTIONS=-s $(foreach p,$(DEB_GCJ_PACKAGES),-N$(p)-gcj)
endif
binary-arch: install-stamp
	dh_testdir
	dh_testroot
	dh_listpackages
ifeq ($(enable_native),yes)
	for p in $(DEB_GCJ_PACKAGES); do \
	  mkdir -p debian/$$p-gcj/usr/share/gcj/classmap.d; \
	    mv debian/$$p-gcj/usr/lib/gcj/eclipse/*.db \
	      debian/$$p-gcj/usr/share/gcj/classmap.d/; \
	done
# don't merge classmaps yet. makes debugging easier
#	$(MAKE) -f debian/rules generate-classmaps
	dh_nativejava --onlyscripts $(foreach p,$(DEB_GCJ_PACKAGES),-p$(p)-gcj)
endif
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman
	dh_installinfo
	dh_installchangelogs
	dh_link
	dh_fixperms

	dh_strip
	dh_compress
	dpkg-shlibdeps \
		-dDepends \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-atk-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-awt-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-cairo-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-pi-gtk-3235.so \
		-dRecommends \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-gnome-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-mozilla-gtk-3235.so \
			debian/libswt3.2-gtk-jni/usr/lib/jni/libswt-glx-gtk-3235.so \
		-Tdebian/libswt3.2-gtk-jni.substvars
	dh_shlibdeps -Nlibswt3.2-gtk-jni
	dh_makeshlibs
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb


binary: binary-indep binary-arch

generate-classmaps:

	# After all packages have been installed, generate the GCJ native
	# mapping database for each package.
ifeq ($(enable_native),yes)
	@for package in $(DEB_GCJ_PACKAGES); do \
		echo "generating classmaps for $${package} ... "; \
		mkdir -p debian/$${package}-gcj/usr/share/gcj-$(GCJ_VERSION)/classmap.d; \
		if test -d debian/$${package}/$(ECLIPSE_HOME)/plugins; then \
			( cd debian/$${package}/$(ECLIPSE_HOME)/plugins && \
			for jar in $$(find . -name '*.jar' -type f); do \
				echo '  ' $${package}/$(ECLIPSE_HOME)/plugins/$${jar} '->' $(GCJ_JARDIR)/$${jar}.so; \
				$(GCJ_DBTOOL) \
					-f $(CURDIR)/debian/$${package}-gcj/usr/share/gcj-$(GCJ_VERSION)/classmap.d/$${package}.db \
					$${jar} $(GCJ_JARDIR)/$${jar}.so || exit 1; \
			done ); \
		fi; \
	done

	# TODO: Is this the second time to do this?
	@for package in libswt3.2-gtk; do \
		echo "generating classmaps for $${package} ... "; \
		mkdir -p debian/$${package}-gcj/usr/share/gcj-$(GCJ_VERSION)/classmap.d; \
		if test -d debian/$${package}-java/$(ECLIPSE_HOME)/plugins; then \
			( cd debian/$${package}-java/$(ECLIPSE_HOME)/plugins && \
			for jar in $$(find . -name '*.jar' -type f); do \
				echo '  ' $${package}-java/$(ECLIPSE_HOME)/plugins/$${jar} '->' $(GCJ_JARDIR)/$${jar}.so; \
				$(GCJ_DBTOOL) \
					-f $(CURDIR)/debian/$${package}-gcj/usr/share/gcj-$(GCJ_VERSION)/classmap.d/$${package}.db \
					$${jar} $(GCJ_JARDIR)/$${jar}.so || exit 1; \
			done ); \
		fi; \
	done
endif


clean:
	dh_testdir

	rm -rf $(SOURCE_TREE) $(BUILD_TREE) *-stamp patch-stampT dpatch-stampT
	rm -rf $(DEBIAN_TMP) debian/tmp-native compilelog.txt
	rm -rf debian/patched
	rm -f debian/patches/00list
	dh_clean