File: rules

package info (click to toggle)
ecj 3.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,268 kB
  • ctags: 14,957
  • sloc: java: 138,182; python: 526; makefile: 213; sh: 35; xml: 32
file content (282 lines) | stat: -rwxr-xr-x 8,587 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
#!/usr/bin/make -f

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

VERSION       := $(shell dpkg-parsechangelog --show-field Version | sed 's/-[^-]*//')
UVERSION      := $(shell echo $(VERSION) | sed 's/~.*//')

GCC_VERSION   := $(shell ls -l /usr/bin/gcj | sed 's/.*-> gcj-\(.*\)/\1/')
GCC_VERSION   := 6

LIBGCJ_EXT    := $(shell ls -l /usr/lib/$(DEB_HOST_MULTIARCH)/libgcj_bc.so.1 | sed 's/.*\.//')
LIBGCJ_SOVER  = $(LIBGCJ_EXT)
LIBGCJ_SOVER  = 17
REQ_VERSION   = 4.4.6

GCJ = gcj-$(GCC_VERSION)
GIJ = gij-$(GCC_VERSION)
GCJDBTOOL = gcj-dbtool-$(GCC_VERSION)
GCJSUBDIR = /usr/lib/$(DEB_HOST_MULTIARCH)/gcj-$(GCC_VERSION)-$(LIBGCJ_SOVER)

# work around ecj1 having fallen out of the gcc search path
PATH := $(CURDIR):$(PATH)
export PATH

with_native := yes
with_rebuild := yes
with_sourcebuild := yes

ifneq (,$(filter $(DEB_HOST_ARCH), m68k powerpcspe ppc64 s390x sh4 sparc64))
  with_sourcebuild :=
endif

ifneq (,$(filter $(DEB_HOST_ARCH), arm armel))
  with_rebuild := no
endif

ifneq (,$(filter $(DEB_HOST_ARCH), arm))
  with_sourcebuild := no
endif

DEB_DH_GENCONTROL_ARGS = -- \
	'-Vpkg:gij=gcj-$(GCC_VERSION)-jre-headless (>= $(REQ_VERSION))' \
	'-Vpkg:libgcjjar=gcj-$(GCC_VERSION)-jre-lib (>= $(REQ_VERSION))'

JAR = eclipse-ecj.jar

eclipse_root = $(CURDIR)/../eclipse

%:
	dh $@

override_dh_auto_build-indep: build/stamp-bytecode

override_dh_auto_build-arch: build/stamp-nativecode

build/stamp-bytecode:
ifneq (,$(findstring $(DEB_HOST_ARCH),arm))
	@echo 'Sorry ecj is no longer built on $(DEB_HOST_ARCH) due to a lack of porters'
	@echo 'supporting gij/gcj on this architecture. Please consider helping if you can.'
	false
endif
	rm -rf build/bin
	mkdir -p build/bin

ifeq ($(with_sourcebuild),yes)
	cp -r src/org.eclipse.jdt.core/org build/bin/
	cat gcc.properties \
	    >> build/bin/org/eclipse/jdt/internal/compiler/batch/messages.properties
	rm -rf build/bin/org/eclipse/jdt/internal/compiler/apt
	rm -rf build/bin/org/eclipse/jdt/internal/compiler/tool

	# Replace the bundle_version parameter with the actual version
	sed -i 's/bundle_qualifier, bundle_version/$(UVERSION)/' \
	    build/bin/org/eclipse/jdt/internal/compiler/batch/messages.properties

	find build/bin -name '*.java' > build/sourcefiles
	split -l 25 build/sourcefiles ecj-sources.
	ls -l
	mv ecj-sources.* build/bin
	ls -l . build/bin

	ln -sf /usr/lib/gcc/ecj1 $(CURDIR)/ecj1
	set -e; \
	for list in $$(find build/bin -name 'ecj-sources.*'); do \
	    echo "building files in $$list ..."; \
	    echo $(GCJ) -d build/bin -C -g \
		-I/usr/share/ant/lib/ant.jar \
		-Ibuild/bin \
		$$(cat $$list); \
	    $(GCJ) -v -d build/bin -C -g \
		-I/usr/share/ant/lib/ant.jar \
		-Ibuild/bin \
	        -Wno-all -Wno-unchecked -Wno-raw -Wno-resource \
		$$(cat $$list); \
	done

	find build/bin -name 'sources.list' -exec rm -f {} \;
	find build/bin -name '*.java' -exec rm -f {} \;
	find build/bin -name '*.html' -exec rm -f {} \;

	mkdir -p build/bootstrap
	fastjar -c -C build/bin . -f build/bootstrap/$(JAR)

  ifeq ($(with_rebuild),yes)
	: # rebuild the compiler
	rm -rf build/bin
	mkdir -p build/bin
	cp -r src/org.eclipse.jdt.core/org build/bin/
	cat gcc.properties \
	    >> build/bin/org/eclipse/jdt/internal/compiler/batch/messages.properties
	rm -rf build/bin/org/eclipse/jdt/internal/compiler/apt
	rm -rf build/bin/org/eclipse/jdt/internal/compiler/tool

	# Replace the bundle_version parameter with the actual version
	sed -i 's/bundle_qualifier, bundle_version/$(UVERSION)/' \
	    build/bin/org/eclipse/jdt/internal/compiler/batch/messages.properties

	time $(GIJ) \
	    -classpath build/bootstrap/$(JAR):/usr/share/ant/lib/ant.jar \
	    org.eclipse.jdt.internal.compiler.batch.Main \
	    -bootclasspath /usr/share/java/libgcj-$(GCC_VERSION).jar \
	    build/bin

	find build/bin -name '*.java' -exec rm -f {} \;
	find build/bin -name '*.html' -exec rm -f {} \;

	mkdir -p build/dist
	fastjar -c -C build/bin . -f build/dist/$(JAR)
  else
	mkdir -p build/dist
	cp -p build/bootstrap/$(JAR) build/dist/$(JAR)
  endif
else
	mkdir -p build/bin
	unzip -d build/bin -q /usr/share/java/eclipse-ecj.jar
	mkdir -p build/dist
	cp -p /usr/share/java/eclipse-ecj.jar build/dist/$(JAR)
endif
	mkdir -p build/exe
	cp build/dist/$(JAR) build/exe/ecj-standalone.jar
	zip -d build/exe/ecj-standalone.jar \
		'org/eclipse/jdt/core/JDTCompilerAdapter*'

	touch build/stamp-bytecode

build/stamp-nativecode: build/stamp-bytecode
	find build/dist -name '*.jar.*.jar' | xargs -r rm -f
ifeq ($(with_native),yes)
	: # $(JAR).so

	cd build/bin && find -name '*.rsc' -o -name '*.properties' -o -name '*.props' \
	    | fastjar -c -@ - -f $(CURDIR)/build/resources.jar
	$(GCJ) \
	    -c -O2 -g -fPIC -fjni -findirect-dispatch \
	    -o build/dist/resources.o build/resources.jar
	cp -p build/dist/resources.o build/exe/

	PYTHONPATH=$(CURDIR)/debian \
	RPATH=-Wl,-rpath,$(GCJSUBDIR) \
	  time python debian/aot-compile \
	    --gcj=$(GCJ) --dbtool=$(GCJDBTOOL) \
	    -L /usr/lib/gcj build/dist build/dist

	PYTHONPATH=$(CURDIR)/debian \
	RPATH=-Wl,-rpath,$(GCJSUBDIR) \
	  time python debian/aot-compile \
	    --gcj=$(GCJ) --dbtool=$(GCJDBTOOL) \
	    -L /usr/lib/gcj build/exe build/exe

  ifeq (0,1)
	: # ecj-gcj
	time $(GCJ) \
	    -O1 -g -Wl,-O1 -Wl,-rpath,$(GCJSUBDIR) -Wl,-z,relro \
	    --main=org.eclipse.jdt.internal.compiler.batch.Main \
	    -o build/dist/ecj-gcj build/exe/ecj-standalone.jar
	: # ecj1
	time $(GCJ) \
	    -O1 -g -Wl,-O1 -Wl,-rpath,$(GCJSUBDIR) -Wl,-z,relro \
	    --main=org.eclipse.jdt.internal.compiler.batch.GCCMain \
	    -o build/dist/ecj1 build/exe/ecj-standalone.jar
  endif
endif
	touch build/stamp-nativecode


override_dh_install-indep:
	dh_install -i

	mh_installpoms -plibecj-java
	mh_installjar -plibecj-java -l debian/poms/ecj.pom build/dist/$(JAR) \
		--usj-name=eclipse-ecj

override_dh_install-arch:
	# ecj
	mkdir -p debian/tmp/usr/bin
	sed 's/@ver@/$(GCC_VERSION)/g' debian/ecj.in \
	  > debian/tmp/usr/bin/ecj
	chmod 755 debian/tmp/usr/bin/ecj

ifeq ($(with_native),yes)
	# libecj-java-gcj
	mkdir -p debian/tmp/usr/lib/gcj
	install -m 644 build/dist/$(JAR).so debian/tmp/usr/lib/gcj

	mkdir -p debian/tmp/usr/share/gcj/classmap.d
	install -m 644 build/dist/*.db \
		debian/tmp/usr/share/gcj/classmap.d/
endif

ifeq ($(with_native),yes)
	# ecj1::
	mkdir -p debian/ecj1/usr/lib/$(DEB_HOST_MULTIARCH)/gcc
	install -m 755 build/exe/ecj1 debian/ecj1/usr/lib/$(DEB_HOST_MULTIARCH)/gcc/
	dh_link -p ecj1 \
	  /usr/lib/$(DEB_HOST_MULTIARCH)/gcc/ecj1 /usr/lib/gcc/ecj1
endif

	# ecj-gcj
ifeq ($(with_native),yes)
	mkdir -p debian/tmp/usr/bin
	install -m 755 build/exe/ecj-gcj debian/tmp/usr/bin/
endif
	mkdir -p debian/ecj-gcj/usr/bin

	mkdir -p debian/ecj-gcj/usr/share/man/man1
	ln -sf ecj.1.gz \
	  debian/ecj-gcj/usr/share/man/man1/ecj-gcj.1.gz

	dh_install -a


override_dh_clean:
	dh_clean
	rm -rf build
	rm -f debian/*.pyc ecj1
	rm -rf debian/.mh

TAG = R4_5_1
DIR = ecj-$(VERSION)

MAVEN_REPO  := http://repo1.maven.org/maven2
PACKAGE := ecj

get-orig-pom:
	mkdir -p debian/poms
	wget  -U NoSuchBrowser/1.0 -O debian/poms/$(PACKAGE).pom \
        $(MAVEN_REPO)/org/eclipse/jdt/core/compiler/$(PACKAGE)/$(VERSION)/$(PACKAGE)-$(VERSION).pom

get-orig-source:
	rm -rf $(DIR) $(TAG).tar.gz $(TAG)
	wget http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/snapshot/$(TAG).tar.gz
	tar xf $(TAG).tar.gz
	mkdir -p $(DIR)/src/org.eclipse.jdt.core
	cp -p $(TAG)/org.eclipse.jdt.core/scripts/about.html \
		$(DIR)/src/org.eclipse.jdt.core/
	cp -p $(TAG)/org.eclipse.jdt.core/scripts/build.xml \
		$(DIR)/src/org.eclipse.jdt.core/

	tar -c -f - -C $(TAG)/org.eclipse.jdt.core/compiler org \
	    | tar -x -f - -C $(DIR)/src/org.eclipse.jdt.core/

	tar -c -f - -C $(TAG)/org.eclipse.jdt.core/antadapter org META-INF \
	    | tar -x -f - -C $(DIR)/src/org.eclipse.jdt.core/

	find $(DIR) -name CheckDebugAttributes.java | xargs -r rm -f
	find $(DIR) -name BuildJarIndex.java | xargs -r rm -f

	tar -c -f - -C $(TAG)/org.eclipse.jdt.core/batch org \
	    | tar -x -f - -C $(DIR)/src/org.eclipse.jdt.core/

	mkdir -p $(DIR)/src/org.eclipse.jdt.core/META-INF/services
#	cp -p $(TAG)/org.eclipse.jdt.core/scripts/META-INF/MANIFEST.MF \
#	    $(DIR)/src/org.eclipse.jdt.core/META-INF/
	printf 'org.eclipse.jdt.internal.compiler.tool.EclipseCompiler #Eclipse compiler' \
	    > $(DIR)/src/org.eclipse.jdt.core/META-INF/services/javax.tools.JavaCompiler

	# Create the upstream tarball
	tar -c -J -f ../ecj_$(VERSION).orig.tar.xz $(DIR)

	# Remove the temporary files
	rm -rf $(DIR) $(TAG).tar.gz $(TAG)