summaryrefslogtreecommitdiff
blob: ceee1747ecf82c58913c2c28f6d9d3fae522580f (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
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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/eclipse-sdk/eclipse-sdk-3.1_pre5.ebuild,v 1.5 2005/05/05 23:12:40 swegener Exp $

inherit eutils java-utils

# karltk: Portage 2.0.51_pre13 needs this
MY_A="eclipse-sourceBuild-srcIncluded-3.1M5a.zip"
DESCRIPTION="Eclipse Tools Platform"
HOMEPAGE="http://www.eclipse.org/"
SRC_URI="http://download.eclipse.org/downloads/drops/S-3.1M5a-200502191500/${MY_A}"
IUSE="gtk motif gnome kde mozilla"
SLOT="3.1"
LICENSE="CPL-1.0"
KEYWORDS="~x86 ~ppc"

RDEPEND="|| ( >=virtual/jdk-1.4.2 =dev-java/blackdown-jdk-1.4.2* )
	gtk? ( >=x11-libs/gtk+-2.2.4 )
	!gtk? (	kde? ( kde-base/kdelibs x11-libs/openmotif )
		!kde? ( motif? ( x11-libs/openmotif )
			!motif? ( >=x11-libs/gtk+-2.2.4 )
		      )
	      )
	mozilla? ( >=www-client/mozilla-1.7 )
	gnome? ( =gnome-base/gnome-vfs-2* =gnome-base/libgnomeui-2* )
	!media-fonts/unifont"

DEPEND="${RDEPEND}
	>=dev-java/ant-1.5.3
	>=sys-apps/findutils-4.1.7
	>=app-shells/tcsh-6.11
	app-arch/unzip
	app-arch/zip"

pkg_setup() {

	check-ram
	check-cflags

	java-utils_setup-vm

	java-utils_ensure-vm-version-ge 1 4 2

	if (java-utils_is-vm-version-ge 1 5 0) ; then
		die "${P} cannot be compiled with a 1.5.x VM, set your system VM to a 1.4.x VM."
	fi

	${use_gtk} && use mozilla && detect-mozilla

	setup-dir-vars

	use gtk && use_gtk='true' || use_gtk='false'
	use motif && use_motif='true' || use_motif='false'

	# If gtk+ enabled, disable motif
	${use_gtk} && use_motif='false'

	# If neither enabled, default to gtk+
	${use_gtk} || ${use_motif} || use_gtk='true'

	# If both enabled, use gtk+ only
	${use_gtk} && ${use_motif} && use_motif='false'

	einfo "Compiling gtk+ frontend  : ${use_gtk}"
	einfo "Compiling Motif frontend : ${use_motif}"

}

src_unpack() {
	mkdir ${S}
	cd ${S}
	unpack ${MY_A} || die "Could not unpack ${MY_A}"

	einfo "Setting up virtual machine"
	java-utils_setup-vm

	einfo "Patching build.xmls"
	process-build-xmls

	einfo "Cleaning out prebuilt code"
	clean-prebuilt-code

	einfo "Patching gtk+ frontend"
	patch-gtk-frontend

	einfo "Patching Motif frontend"
	patch-motif-frontend

	einfo "Set build version in Help->About"
	patch-about
}

src_compile() {

	# karltk: this should be handled by the java-pkg eclass in setup-vm 
	addwrite "/proc/self/maps"
	addwrite "/proc/cpuinfo"
	addwrite "/dev/random"

	# Figure out correct boot classpath
	# karltk: this should be handled by the java-pkg eclass in setup-vm
	if [ ! -z "`java-config --java-version | grep IBM`" ] ; then
		# IBM JRE
		ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/core.jar:$(java-config --jdk-home)/jre/lib/xml.jar:$(java-config --jdk-home)/jre/lib/graphics.jar"
	else
		# Sun derived JREs (Blackdown, Sun)
		ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/rt.jar"
	fi

	export ANT_OPTS=-Xmx768m

	einfo "Building resources.core plugin"
	cd ${S}/${core_src_dir}
	make JDK_INCLUDE="-I`java-config -O`/include -I`java-config -O`/include/linux" || die "Failed to build resource.core plugin"
	mkdir -p ${S}/"${core_dest_dir}"
	mv *.so ${S}/"${core_dest_dir}"
	cd ${S}

	# Build selected native frontend code
	${use_gtk} && build-gtk-native
	${use_motif} && build-motif-native

	# Compile all Java code
	${use_gtk} && build-gtk-java compile
	${use_motif} && build-motif-java compile

	# Install all Java code
	${use_gtk} && build-gtk-java install
	${use_motif} && build-motif-java install


	create-desktop-entry
}

src_install() {
	eclipse_dir="/usr/lib/eclipse-${SLOT}"

	dodir /usr/lib

	einfo "Installing features and plugins"
	if ${use_gtk} ; then
		[ -f result/org.eclipse.sdk-I*-linux.gtk.${ARCH}.zip ] || die "gtk zip bundle was not build properly!"
		tar zxf result/org.eclipse.sdk-I*-linux.gtk.${ARCH}.zip -C ${D}/usr/lib
	fi
	if ${use_motif} ; then
		[ -f result/org.eclipse.sdk-I*-linux.motif.${ARCH}.zip ] || die "motif zip bundle was not build properly!"
		tar zxf result/org.eclipse.sdk-I*-linux.motif.${ARCH}.zip -C ${D}/usr/lib
	fi

	mv ${D}/usr/lib/eclipse ${D}/${eclipse_dir}

	insinto ${eclipse_dir}

	# Install launchers and native code
	exeinto ${eclipse_dir}
	if ${use_gtk} ; then
		einfo "Installing eclipse-gtk binary"
		doexe ${gtk_launcher_src_dir}/eclipse-gtk \
			|| die "Failed to install eclipse-gtk"
	fi
	if ${use_motif} ; then
		einfo "Installing eclipse-motif binary"
		doexe ${motif_launcher_src_dir}/eclipse-motif \
			|| die "Failed to install eclipse-motif"
	fi

	doins plugins/org.eclipse.platform/{startup.jar,splash.bmp}

	# Install startup script
	exeinto /usr/bin
	doexe ${FILESDIR}/eclipse-${SLOT}

	install-desktop-entry

	doman ${FILESDIR}/eclipse.1

	install-link-files
}

pkg_postinst()
{
	check-cflags
}

# -----------------------------------------------------------------------------
#  Helper functions
# -----------------------------------------------------------------------------

function detect-mozilla()
{
	mozilla_dir="--mozdir-unset---"

	if [ -f ${ROOT}/usr/lib/mozilla/libgtkembedmoz.so ] ; then
		einfo "Compiling against www-client/mozilla"
		mozilla_dir=/usr/lib/mozilla
#	elif [ -f ${ROOT}/usr/lib/MozillaFirefox/libgtkembedmoz.so ] ; then
#		einfo "Compiling against www-client/mozilla-firefox"
#		mozilla_dir=/usr/lib/MozillaFirefox
	else
		eerror "You need either Mozilla, compiled against gtk+ v2.0 or newer"
		eerror "To merge it, do USE=\"gtk2\" emerge mozilla."
		eerror "Otherwise, remove \"mozilla\" from use flags"
		die "Need Mozilla compiled with gtk+-2.x support"
	fi
}

function setup-dir-vars() {
	gtk_launcher_src_dir="features/org.eclipse.launchers/library/gtk"
	motif_launcher_src_dir="features/org.eclipse.launchers/library/motif"
	gtk_swt_src_dir="plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library"
	motif_swt_src_dir="plugins/org.eclipse.swt/Eclipse SWT PI/motif/library"

	core_src_dir="plugins/org.eclipse.core.resources.linux/src"

	case ${ARCH} in
		sparc)
			gtk_swt_dest_dir="plugins/org.eclipse.swt.gtk/os/solaris/sparc"
			motif_swt_dest_dir="plugins/org.eclipse.swt.motif/os/solaris/sparc"
			core_dest_dir="plugins/org.eclipse.core.resources.linux/os/solaris/sparc"
			;;
		x86)
			gtk_swt_dest_dir="plugins/org.eclipse.swt.gtk/os/linux/x86"
			motif_swt_dest_dir="plugins/org.eclipse.swt.motif/os/linux/x86"
			core_dest_dir="plugins/org.eclipse.core.resources.linux/os/linux/x86"
			;;
		ppc)
			gtk_swt_dest_dir="plugins/org.eclipse.swt.gtk/os/linux/ppc"
			motif_swt_dest_dir="plugins/org.eclipse.swt.motif/os/linux/ppc"
			core_dest_dir="plugins/org.eclipse.core.resources.linux/os/linux/ppc/"
			;;
		amd64)
			gtk_swt_dest_dir="plugins/org.eclipse.swt.gtk64/os/linux/amd64"
			motif_swt_dest_dir="plugins/org.eclipse.swt.motif/os/linux/amd64"
			core_dest_dir="plugins/org.eclipse.core.resources.linux/os/linux/amd64"
			;;
	esac
}

function process-build-xmls() {

	# Turn off verbose mode and on errors in all build.xml files
	find . -type f -name "build.xml" | while read x ; do
		sed -i -r \
			-e 's/failonerror="[^"]+"/failonerror="true"/' \
			-e 's/verbose="[^"]+"/verbose="false"/' "$x"
	done
}

function patch-gtk-frontend() {

	# Move around some source code that should have been handled by the build system
	local m="Failed to move native files for SWT gtk+"
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Mozilla/common/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Program/gnome/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ AWT/gtk/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Program/kde/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}

	if use gnome ; then
	    gnome_lib=`pkg-config --libs gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 | sed -e "s:-pthread:-lpthread:" -e "s:-Wl,--export:--export:"`
	fi

	if ${use_gtk} ; then
		gtk_lib="`pkg-config --libs gtk+-2.0 | sed -e 's:-pthread:-lpthread:' -e 's:-Wl,::'` -L/usr/X11R6/lib -lXtst"
		atk_lib=`pkg-config --libs atk gtk+-2.0 | sed -e "s:-Wl,--export:--export:"`
	fi

	sed -e "s:\`pkg-config --libs gtk+-2.0\`:${gtk_lib}:" \
		-e "s:\`pkg-config --libs atk gtk+-2.0\`:${atk_lib}:" \
		-e "s:\`pkg-config --libs gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0\`:${gnome_lib}:" \
		-e "s:-I\$(JAVA_HOME)/include:-I\$(JAVA_HOME)/include -I\$(JAVA_HOME)/include/linux:" \
		-e "s:-I\$(JAVA_HOME)\t:-I\$(JAVA_HOME)/include -I\$(JAVA_HOME)/include/linux:" \
		-e "s:-L\$(GECKO_SDK)/embed_base/bin -lembed_base_s:-L${mozilla_dir} -lgtkembedmoz:" \
		-e "s:\(^.*\)\(-L.*-lembedstring.*\)\(\\\\$\):\1\3:" \
		-e "s:\(^.*\)\(-L.*/xpcom/bin.*\)\(\\\\$\):\1\3:" \
		-e "s:\(^.*-L.*-lnspr4.*$\)::" \
		-e "s:MOZILLACFLAGS = -O:MOZILLACFLAGS = -O -DNO_nsEmbedString_1Equals -I${mozilla_dir}/include/java:" \
		-e "s:\(-include \)\(\$(GECKO_SDK)\)\(/mozilla-config.h\):\1${mozilla_dir}/include\3:" \
		-e "s:\(-I\$(GECKO_SDK)\)\(/.*\)\(/include\):-I${mozilla_dir}/include\2:g" \
		-e "s:\$(XTEST_LIB_PATH):/usr/X11R6/lib:" \
		-e "s:\$(GECKO_SDK):${mozilla_dir}:" \
		-i "${S}/${gtk_swt_src_dir}/make_linux.mak" || die "Failed to patch ${gtk_swt_src_dir}/make_linux.mak"

	sed \
		-e "s:GECKO_INCLUDES *=.*:GECKO_INCLUDES=\"-include \$\{GECKO_SDK\}/include/mozilla-config.h -I\$\{GECKO_SDK\}/include/nspr -I\$\{GECKO_SDK\}/include/nspr -I\$\{GECKO_SDK\}/include/xpcom -I\$\{GECKO_SDK\}/include/string -I\$\{GECKO_SDK\}/include/embed_base\":" \
		-e "s:GECKO_LIBS *=.*:GECKO_LIBS=\"-L\$\{GECKO_SDK\} -lgtkembedmoz\":" \
		-e "s:\(JAVA_HOME *=\)\(.*$\):\1${JAVA_HOME}:" \
		-e "s:\(GECKO_SDK *=\)\(.*$\):\1${mozilla_dir:-/usr/lib/mozilla}:" \
		-e "s:\(AWT_LIB_PATH *=\)\(.*$\):\1\$JAVA_HOME/jre/lib/${ARCH}:" \
		-e "s:KDE_LIB_PATH=.*:KDE_LIB_PATH=`kde-config --prefix`/lib:" \
		-e "s:KDE_INCLUDE_PATH=.*:KDE_INCLUDE_PATH=`kde-config --prefix`/include:" \
		-i "${S}/${gtk_swt_src_dir}/build.sh" || die "Failed to patch ${gtk_swt_src_dir}/build.sh"

}

function patch-motif-frontend()
{
	local m="Failed to move native files for SWT Motif"

	cp plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* ${S}/"${motif_swt_src_dir}" || die ${m}
	cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Program/kde/library/* ${S}/"${motif_swt_src_dir}" || die ${m}

	sed -e "s:/bluebird/teamswt/swt-builddir/IBMJava2-141:$JAVA_HOME:" \
		-e "s:/bluebird/teamswt/swt-builddir/motif21:/usr/X11R6:" \
		-e "s:/usr/lib/qt-3.1:/usr/qt/3:" \
		-e "s:-lkdecore:-L\`kde-config --prefix\`/lib -lkdecore:" \
		-e "s:-I/usr/include/kde:-I\`kde-config --prefix\`/include:" \
		-e "s:-I\$(JAVA_HOME)/include:-I\$(JAVA_HOME)/include -I\$(JAVA_HOME)/include/linux:" \
		-e "s:-I\$(JAVA_HOME)\t:-I\$(JAVA_HOME)/include -I\$(JAVA_HOME)/include/linux:" \
		-e "s:-L\$(MOZILLA_HOME)/lib -lembed_base_s:-L\$(MOZILLA_HOME):" \
		-e "s:-L\$(JAVA_HOME)/jre/bin:-L\$(JAVA_HOME)/jre/lib/i386:" \
		-i "${motif_swt_src_dir}"/make_linux.mak || die "Failed to modify ${motif_swt_src_dir}/make_linux.mak"

	sed \
		-e "s:KDE_LIB_PATH=.*:KDE_LIB_PATH=`kde-config --prefix`/lib:" \
		-e "s:KDE_INCLUDE_PATH=.*:KDE_INCLUDE_PATH=`kde-config --prefix`/include:" \
		-i "${S}/${motif_swt_src_dir}/build.sh" || die "Failed to patch ${motif_swt_src_dir}/build.sh"
}


function create-desktop-entry() {

	cat ${FILESDIR}/eclipse-${SLOT}.desktop | \
		sed -e "s/@PV@/${PV}/" \
		> eclipse-${SLOT}.desktop || die "Failed to create desktop entry"
}

function build-gtk-java() {
	local target=${1}

	einfo "Building GTK+ frontend (${target}) -- see compilelog.txt for details"
	LOCALCLASSPATH=jdtcore.jar:jdtCompilerAdapter.jar ant -q -q  \
		-buildfile build.xml \
		-DcollPlace="eclipse-${SLOT}" \
		-DinstallOs=linux \
		-DinstallWs=gtk \
		-DinstallArch=$ARCH \
		${ant_extra_opts} ${target} \
		|| die "Failed to ${target} Java code (gtk+)"
}

function build-motif-java() {
	local target=${1}

	einfo "Building Motif frontend (${target}) -- see compilelog.txt for details"
	LOCALCLASSPATH=jdtcore.jar:jdtCompilerAdapter.jar ant -q -q  \
		-buildfile build.xml \
		-DcollPlace="eclipse-${SLOT}" \
		-DinstallOs=linux \
		-DinstallWs=motif \
		-DinstallArch=$ARCH \
		${ant_extra_opts} ${target} \
		|| die "Failed to ${target} java code (Motif)"
}

function install-desktop-entry() {

	# Install GNOME .desktop file
	if use gnome ; then
		insinto /usr/share/gnome/apps/Development
		doins eclipse-${SLOT}.desktop
	fi

	# Install KDE .desktop file
	if use kde ; then
		insinto /usr/share/applnk/Development
		doins eclipse-${SLOT}.desktop
	fi
}

function build-gtk-native() {

	einfo "Building gtk+ SWT"

	# kludge to allow patches to applied at unpack, but correct compilation
	if [ ${ARCH} == "amd64" ] ; then
		gtk_swt_src_dir="plugins/org.eclipse.swt.gtk64/src/Eclipse SWT PI/gtk/library"
	fi

	# Perpare destination directory
	mkdir -p ${S}/"${gtk_swt_dest_dir}"

	# Build the eclipse gtk binary
	cd ${S}/${gtk_launcher_src_dir}
	case ${ARCH} in
		sparc|x86|ppc)
			bash ./build.sh -output eclipse-gtk -arch $ARCH || die "Failed to build eclipse-gtk"
			;;
		amd64)
			bash ./build.sh -output eclipse-gtk -arch $ARCH || die "Failed to build eclipse-gtk"
			;;
	esac


	cd ${S}/"${gtk_swt_src_dir}"
	case ${ARCH} in
		sparc|x86|ppc)
			bash ./build.sh make_swt || die "Failed to build platform-independent SWT support"
			bash ./build.sh make_atk || die "Failed to build atk support"
			;;
		amd64)
			bash ./build64.sh make_swt || die "Failed to build platform-independent SWT support"
			bash ./build64.sh make_atk || die "Failed to build atk support"
			;;
	esac

	if use gnome ; then
		einfo "Building GNOME VFS support"
		case ${ARCH} in
			sparc|x86|ppc)
				bash ./build.sh make_gnome || die "Failed to build GNOME VFS support"
				;;
			amd64)
				bash ./build64.sh make_gnome || die "Failed to build GNOME VFS support"
				;;
		esac
	fi

	if use kde ; then
		einfo "Building KDE support"
		bash ./build.sh make_kde || die "Failed to build KDE support"
	fi

	if use mozilla ; then
		einfo "Building Mozilla component"
		case $ARCH in
			sparc|x86|ppc)
				bash ./build.sh make_mozilla || die "Failed to build Mozilla support"
				;;
			amd64)
				bash ./build64.sh make_mozilla || die "Failed to build Mozilla support"
				;;
		esac
	fi

	# move the *.so files to the right path so eclipse can find them
	# karltk: do this incrementally at each step above, with || die
	mv *.so ${S}/"${gtk_swt_dest_dir}"
	cd ${S}

	einfo "Native gtk+ bindings built"
}

function build-motif-native() {

	einfo "Building Motif SWT"

	# Prepare destination directory
	mkdir -p ${S}/"${motif_swt_dest_dir}"

	# Build eclipse motif binary
	cd ${S}/${motify_launcher_src_dir}
	bash build.sh -output eclipse-motif -arch $ARCH || die "Failed to build eclipse-motif"

	cd ${S}/"${motif_swt_src_dir}"

	make -f make_linux.mak make_swt QT_HOME="${QTDIR}" || die "Failed to build Motif support"
	if use kde ; then
		make -f make_linux.mak make_kde QT_HOME="${QTDIR}" || die "Failed to build KDE support"
	fi

	# move the *.so files to the right path so eclipse can find them
	# karltk: do this incrementally at each step above, with || die
	mv *.so ${S}/"${motif_swt_dest_dir}"
	cd ${S}

	einfo "Native Motif bindings built"
}



function clean-prebuilt-code() {

	# Clean up all pre-built code
	ant -q -DinstallWs=gtk -DinstallOs=linux clean
	ant -q -DinstallWs=motif -DinstallOs=linux clean
	find ${S} -name '*.so' -exec rm -f {} \;
	find ${S} -name '*.so.*' -exec rm -f {} \;
	find ${S} -type f -name 'eclipse' -exec rm {} \;
	rm -f eclipse

}

function get-memory-total() {
	cat /proc/meminfo | grep MemTotal | sed -r "s/[^0-9]*([0-9]+).*/\1/"
}

function check-ram() {

	local mem=$(get-memory-total)
	[ $(get-memory-total) -lt 775000 ] &&
		(
		echo
		ewarn "To build Eclipse, at least 768MB of RAM is recommended."
		ewarn "Your machine has less RAM. Continuing anyway."
		echo
		)
}

function install-link-files() {
	dodir /usr/lib/eclipse-${SLOT}/links

	echo "path=/opt/eclipse-extensions-3" > ${D}/${eclipse_dir}/links/eclipse-binary-extensions-3.link
	echo "path=/opt/eclipse-extensions-3.1" > ${D}/${eclipse_dir}/links/eclipse-binary-extensions-3.1.link

	echo "path=/usr/lib/eclipse-extensions-3" > ${D}/${eclipse_dir}/links/eclipse-extensions-3.link
	echo "path=/usr/lib/eclipse-extensions-3.1" > ${D}/${eclipse_dir}/links/eclipse-extensions-3.1.link
}

function check-cflags() {
	local badflags="-fomit-frame-pointer -msse2"
	local error=false

	for x in ${badflags} ; do
		if [ ! -z "$(echo ${CFLAGS} | grep -- $x)" ] ; then
			ewarn "Found offending option $x in your CFLAGS"
			error=true
		fi
	done
	if [ ${error} == "true" ]; then
		echo
		ewarn "One or more potentially CFLAGS detected. When you run into trouble, please"
		ewarn "edit /etc/make.conf and remove all offending flags, then recompile"
		ewarn "Eclipse and all its dependencies before submitting a bug report."
		echo
		einfo "Tip: use equery depgraph \"=${PF}\" to list all dependencies"
		echo
		ebeep
	fi
}

function patch-about {

	find -type f -name about.mappings -exec sed -e "s/@build@/Gentoo Linux ${PF}/" -i \{\} \; \
		|| die "Failed to patch about.mappings"

	sed -e "s/@build@/Gentoo Linux ${PF}/" \
		-i features/org.eclipse.platform/gtk/configuration/config.ini \
		-i features/org.eclipse.platform/motif/configuration/config.ini \
		-i build.xml || die "Failed to set build version"
}