summaryrefslogtreecommitdiff
blob: 1d456656f8a5c9506ee45b2145cee980e67c322b (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/qtjambi/qtjambi-4.4.3.ebuild,v 1.2 2009/01/19 15:15:48 yngwin Exp $

JAVA_PKG_IUSE="doc source"

inherit eutils java-pkg-2 java-ant-2

QTVERSION=4.4.2
PATCHRELEASE=01

DESCRIPTION="QtJambi is a set of Java bindings and utilities for the Qt C++ toolkit."
HOMEPAGE="http://www.trolltech.com/"

MY_PV=${PV}_${PATCHRELEASE}

SRC_URI="ftp://ftp.trolltech.no/qtjambi/source/qtjambi-src-gpl-${MY_PV}.tar.gz"
S=${WORKDIR}/qtjambi-src-gpl-${MY_PV}

LICENSE="GPL-2"
SLOT="4"
KEYWORDS="~amd64 ~x86"

IUSE="debug sqlite opengl phonon webkit xmlpatterns examples"

DEPEND=">=x11-libs/qt-gui-${QTVERSION}
	>=virtual/jdk-1.5
	dev-java/ant-trax
	sqlite? ( dev-db/sqlite )
	opengl? ( >=x11-libs/qt-opengl-${QTVERSION} )
	phonon? ( >=x11-libs/qt-phonon-${QTVERSION} )
	webkit? ( >=x11-libs/qt-webkit-${QTVERSION} )
	xmlpatterns? ( >=x11-libs/qt-xmlpatterns-${QTVERSION} )"

RDEPEND=">=x11-libs/qt-gui-${QTVERSION}
	>=virtual/jre-1.5
	sqlite? ( dev-db/sqlite )
	opengl? ( >=x11-libs/qt-opengl-${QTVERSION} )
	phonon? ( >=x11-libs/qt-phonon-${QTVERSION} )
	webkit? ( >=x11-libs/qt-webkit-${QTVERSION} )
	xmlpatterns? ( >=x11-libs/qt-xmlpatterns-${QTVERSION} )"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/generator-${PV}.patch"
	epatch "${FILESDIR}/configuration-${PV}.patch"
	java-ant_rewrite-classpath
}

src_compile() {

	cd "${S}"

	# Set build configuration
	local extraArgs="-Dgentoo.qtdir=/usr/$(get_libdir)/qt4"

	use debug && extraArgs="${extraArgs} -Dqtjambi.config=debug"

	if use sqlite ; then
	  extraArgs="${extraArgs} -Dgentoo.sqlite=true"
	else
	  extraArgs="${extraArgs} -Dgentoo.sqlite=false"
	fi

	if use opengl ; then
	  extraArgs="${extraArgs} -Dgentoo.opengl=true"
	else
	  extraArgs="${extraArgs} -Dgentoo.opengl=false"
	fi

	if use phonon ; then
	  extraArgs="${extraArgs} -Dgentoo.phonon=true"
	else
	  extraArgs="${extraArgs} -Dgentoo.phonon=false"
	fi

	if use webkit ; then
	  extraArgs="${extraArgs} -Dgentoo.webkit=true"
	else
	  extraArgs="${extraArgs} -Dgentoo.webkit=false"
	fi

	if use xmlpatterns ; then
	  extraArgs="${extraArgs} -Dgentoo.xmlpatterns=true"
	else
	  extraArgs="${extraArgs} -Dgentoo.xmlpatterns=false"
	fi

	# Step 1, Build and run the Qt Jambi generator. The generator relies on QTDIR for include.
	einfo "Building and running the Qt Jambi generator"
	ANT_TASKS="ant-trax" QTDIR="/usr/include/qt4" eant -Dgentoo.classpath="$(java-pkg_getjar --build-only ant-core ant.jar)" ${extraArgs} generator

	# Step 2, Build the native library
	einfo "Building the native library"
	eant ${extraArgs} library.native.qmake library.native.compile

	# Step 3, Build the Java library
	einfo "Building the Java library"
	eant ${extraArgs} library.java

	# Step 4, Build the Examples
	use examples && einfo "Building Examples" && eant ${extraArgs} examples

	# Step 5, Build API documentation
	use doc && einfo "Generating Javadoc" && javadoc -J-Xmx128m -d javadoc -subpackages com

	# Step 6, generate start script for jambi-designer
	cat > bin/jambi-designer <<-EOF
		#! /bin/sh
		LD_LIBRARY_PATH=/usr/lib/qt4 CLASSPATH=/usr/share/qtjambi-4/lib/qtjambi.jar:\${CLASSPATH} /usr/bin/designer
	EOF
}

src_install() {

	# Install built jar
	java-pkg_newjar qtjambi-${MY_PV}.jar

	# Install examples jar
	use examples && java-pkg_newjar qtjambi-examples-${MY_PV}.jar ${PN}-examples.jar

	# Install designer plugins
	insinto "/usr/$(get_libdir)/qt4/plugins/designer"
	insopts -m0755
	doins plugins/designer/*.so

	# Install native library
	#java-pkg_doso "${S}"/lib/* # does not work see #251500
	java-pkg_doso "${S}"/lib/*.so.1.0.0 "${S}"/lib/*.so.1.0 "${S}"/lib/*.so.1 "${S}"/lib/*.so # works

	# Install sources
	use source && java-pkg_dosrc "${S}"/com

	# Install javadoc
	use doc && java-pkg_dojavadoc "${S}"/javadoc

	# Install other documentation
	use doc && dohtml "${S}"/readme.html

	# Install examples
	use examples && java-pkg_doexamples "${S}"/com/trolltech/examples

	# Install launcher-scripts
	dobin "${S}"/bin/*
	use examples && java-pkg_dolauncher jambi --main com.trolltech.launcher.Launcher \
		--java_args "-Djava.library.path=/usr/$(get_libdir)/qt4:/usr/$(get_libdir)/qtjambi-4"
}