7c0c62b73351ff9560f7fac13b6cbfaab89d4b6b
[ub0rlay.git] / dev-java / sun-wtk-bin / sun-wtk-bin-2.5.2.ebuild
blob7c0c62b73351ff9560f7fac13b6cbfaab89d4b6b
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 JAVA_PKG_IUSE="doc source"
7 inherit java-pkg-2
9 DESCRIPTION="Java 2 Micro Edition Wireless Toolkit for developing wireless applications"
10 HOMEPAGE="http://java.sun.com/products/j2mewtoolkit/"
12 DOWNLOAD_URL="http://java.sun.com/products/sjwtoolkit/download.html?feed=JSC"
13 BINARY="sun_java_wireless_toolkit-${PV//./_}-linux.bin"
14 #PATCH="j2me_wireless_toolkit-2_2-update_2-linux.zip"
16 #SRC_URI="${BINARY} ${PATCH}"
17 SRC_URI="${BINARY}"
18 LICENSE="sun-bcla-j2me"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="doc examples"
22 RESTRICT="fetch"
24 COMMON_DEP="
25 dev-java/sun-jaf
26 dev-java/sun-javamail
27 dev-java/xsdlib"
28 RDEPEND="${COMMON_DEP}
29 >=virtual/jdk-1.4.2"
30 DEPEND="${COMMON_DEP}
31 app-arch/unzip"
33 S=${WORKDIR}
35 MY_FILE=${DISTDIR}/${BINARY}
37 pkg_nofetch() {
39 einfo "Please navigate your browser to ${DOWNLOAD_URL}"
40 einfo "scroll down and notice the two download buttons."
41 einfo "Click the first Download button for J2ME Wireless Toolkit 2.2"
42 einfo "and download ${BINARY} to ${DISTDIR} and resume the installation"
44 }
46 src_unpack() {
48 if [[ ! -r ${MY_FILE} ]]; then
50 eerror "cannot read ${A}. Please check the permission and try again."
51 die
53 fi
55 #extract compressed data and unpack
56 ebegin "Unpacking ${BINARY}"
57 dd bs=1024 if=${MY_FILE} of=install.zip skip=26 2>/dev/null || die
59 unzip install.zip || die
60 eend $?
61 rm install.zip
63 #unpack ${PATCH}
65 #Set the java-bin-path in some scripts
66 for file in ktoolbar emulator mekeytool prefs utils wscompile defaultdevice; do
67 sed -i -e \
68 "s@pathtowtk=\$@pathtowtk=\`java-config --jdk-home\`\"/bin/\"@" \
69 ${WORKDIR}/bin/${file} || die
70 done
72 cd ${S}/bin
73 rm -f activation.jar mail.jar xsdlib.jar
75 }
77 src_install() {
78 local DIR=/opt/${P}
79 cd ${WORKDIR}
81 einfo "Copying files"
82 dodir ${DIR}
83 cp -r j2mewtk_template j2mewtk_template/appdb bin lib wtklib ${D}/${DIR}
84 use examples && cp -r apps ${D}/${DIR}
86 einfo "Setting permissions"
87 chmod 755 ${D}/${DIR}/bin/* || die
88 chmod 644 ${D}/${DIR}/bin/*.jar || die
90 einfo "Installing documentation"
91 dohtml *.html
92 use doc && java-pkg_dohtml -r docs/*
94 cd ${D}/${DIR}/bin
95 java-pkg_jar-from sun-jaf activation.jar
96 java-pkg_jar-from sun-javamail mail.jar
97 java-pkg_jar-from xsdlib xsdlib.jar
99 einfo "Registering jar files"
100 # The zip files are somehow broken and python zip handling errors on them
101 JAVA_PKG_STRICT= java-pkg_regjar \
102 ${D}${DIR}/lib/*.jar \
103 ${D}${DIR}/wtklib/kenv.zip \
104 ${D}${DIR}/wtklib/*.jar
106 if java-config --select-vm=emul-linux-x86-java -O 2> /dev/null > /dev/null ; then
107 sed -i ${D}/${DIR}/bin/emulator -e 's:java-config --jdk-home:java-config --select-vm=emul-linux-x86-java --jdk-home:'
108 fi
110 dodir /usr/bin
111 dosym ${DIR}/bin/ktoolbar /usr/bin/ktoolbar