summaryrefslogtreecommitdiff
blob: 47e3b7db9140fd699015018b4c46b4f899ad8724 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/swt/swt-3.0.ebuild,v 1.1 2004/07/31 23:21:23 karltk Exp $

inherit eutils java-pkg

IUSE="gnome mozilla"
DESCRIPTION="SWT library"
HOMEPAGE="http://www.eclipse.org/"
SRC_URI="http://download.eclipse.org/downloads/drops/R-3.0-200406251208/swt-3.0-linux-gtk.zip"
LICENSE="CPL-1.0 LGPL-2.1 MPL-1.1"
SLOT="0"
KEYWORDS="~x86"

RDEPEND=">=x11-libs/gtk+-2.2.4
	mozilla? ( >=net-www/mozilla-1.5 )
	gnome? ( =gnome-base/gnome-vfs-2* =gnome-base/libgnomeui-2* )"
DEPEND="${RDEPEND}
	>=virtual/jdk-1.4
	dev-java/ant
	app-arch/unzip"

src_unpack() {
	mkdir ${S} && cd ${S}
	unpack ${A}

	# remove some files
	rm -f *.so *.jar
	use mozilla || rm -f swt-mozillasrc.zip

	for i in *.zip
	do
		einfo "Unpacking ${i} to ${S}"
		unzip ${i} &> /dev/null
	done
	use mozilla && mv library/xpcom.cpp ${S}

	mkdir src && mv org src/
	cp ${FILESDIR}/build-${PV}.xml ${S}/build.xml
}

src_compile() {
	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

	gtk_lib=`pkg-config --libs gtk+-2.0 gthread-2.0 | sed -e "s:-pthread:-lpthread:" -e "s:-Wl,--export:--export:"`
	atk_lib=`pkg-config --libs atk gtk+-2.0 | sed -e "s:-Wl,--export:--export:"`

	sed -e "s:/bluebird/teamswt/swt-builddir/IBMJava2-141:$JAVA_HOME:" \
		-e "s:/bluebird/teamswt/swt-builddir/jdk1.5.0:$JAVA_HOME:" \
		-e "s:/mozilla/mozilla/1.6/linux_gtk2/mozilla/dist:$MOZILLA_FIVE_HOME:" \
		-e "s:/usr/lib/mozilla-1.6:$MOZILLA_FIVE_HOME:" \
		-e "s:\`pkg-config --libs gtk+-2.0 gthread-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\$(MOZILLA_HOME)/lib -lembed_base_s:-L\$(MOZILLA_HOME) -lgtkembedmoz:" \
		-e "s:MOZILLACFLAGS = -O:MOZILLACFLAGS = -O -fPIC:" \
		-e "s:\$(JAVA_HOME)/jre/bin:\$(JAVA_HOME)/jre/lib/i386:" \
		make_gtk.mak > Makefile

	make make_swt || die "Failed to build platform-independent SWT support"
	make make_atk || die "Failed to build atk support"

	if use gnome ; then
		einfo "Building GNOME VFS support"
		make make_gnome || die "Failed to build GNOME VFS support"
	fi

	if use mozilla ; then
		einfo "Building Mozilla component"
		make make_mozilla || die "Failed to build Mozilla support"
	fi

	einfo "Building java source"
	ant jar
}

src_install() {
	java-pkg_dojar swt.jar || die "install failed."
	install *.so ${D}/usr/share/${PN}/lib/ || die "install failed"

	dohtml about.html
}