move jdownloader
[ub0rlay.git] / dev-java / proguard / proguard-4.3.ebuild
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-java/proguard/proguard-4.3.ebuild,v 1.1 2009/02/04 20:08:58 serkan Exp $
4
5 JAVA_PKG_IUSE="doc source"
6 inherit java-pkg-2 java-ant-2
7
8 DESCRIPTION="Free Java class file shrinker, optimizer, and obfuscator."
9 HOMEPAGE="http://proguard.sourceforge.net/"
10 MY_P=${P/-/}
11 MY_P=${MY_P/_/}
12 SRC_URI="mirror://sourceforge/proguard/${MY_P}.tar.gz"
13
14 LICENSE="GPL-2-with-linking-exception"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="examples j2me"
18
19 DEPEND=">=virtual/jdk-1.4
20                 j2me? ( dev-java/sun-wtk-bin )
21                 dev-java/ant-core"
22 RDEPEND=">=virtual/jre-1.4
23                 j2me? ( dev-java/sun-wtk-bin )
24                 dev-java/ant-core"
25
26 S=${WORKDIR}/${MY_P}
27
28 src_unpack() {
29         unpack ${A}
30         find "${S}" -name "*.jar" | xargs rm -v
31 }
32
33 src_compile() {
34         # create jars
35         mkdir dist
36
37         einfo "Compiling ${PN}.jar"
38         mkdir -p build/proguard/classes
39         ejavac -sourcepath src -d build/proguard/classes src/proguard/ProGuard.java || die "Cannot compile 'proguard'"
40         jar -cf "${S}"/dist/${PN}.jar -C build/proguard/classes proguard || die "Cannot create ${PN}.jar"
41
42         einfo "Compiling ${PN}gui.jar"
43         mkdir -p build/proguardgui/classes
44         ejavac -sourcepath src -d build/proguardgui/classes src/proguard/gui/ProGuardGUI.java || die "Cannot compile 'proguardgui'"
45         cp src/proguard/gui/*.gif build/proguardgui/classes/proguard/gui/
46         cp src/proguard/gui/*.pro build/proguardgui/classes/proguard/gui/
47         cp src/proguard/gui/*.properties build/proguardgui/classes/proguard/gui/
48         jar -cf "${S}"/dist/${PN}gui.jar -C build/proguardgui/classes proguard || die "Cannot create ${PN}gui.jar"
49
50         einfo "Compiling retrace.jar"
51         mkdir -p build/retrace/classes
52         ejavac -sourcepath src -d build/retrace/classes src/proguard/retrace/ReTrace.java || die "Cannot compile 'retrace'"
53         jar -cf "${S}"/dist/retrace.jar -C build/retrace/classes proguard || die "Cannot create retrace.jar"
54
55         einfo "Compiling ${PN}-ant.jar"
56         mkdir -p build/ant/classes
57         ejavac -sourcepath src -classpath $(java-pkg_getjars ant-core) \
58                 -d build/ant/classes src/proguard/ant/ProGuardTask.java || die "Cannot compile 'proguard-ant'"
59         jar -cf "${S}"/dist/${PN}-ant.jar -C build/ant/classes proguard || die "Cannot create ${PN}-ant.jar"
60
61         if use j2me ; then
62                 einfo "Compiling ${PN}-wtk.jar"
63                 mkdir -p build/wtk/classes
64                 ejavac -sourcepath src -classpath $(java-pkg_getjars sun-wtk-bin) \
65                         -d build/wtk/classes src/proguard/wtk/ProGuardObfuscator.java || die "Cannot compile 'proguard-wtk'"
66                 jar -cf "${S}"/dist/${PN}-wtk.jar -C build/wtk/classes proguard || die "Cannot create ${PN}-wtk.jar"
67         fi
68
69         # generate javadoc
70         if use doc ; then
71                 mkdir javadoc
72                 local cp=$(java-pkg_getjars ant-core)
73                 use j2me && cp="${cp}:$(java-pkg_getjars sun-wtk-bin)"
74                 javadoc -d javadoc -sourcepath src -classpath $${cp} -subpackages proguard || die "Cannot compile javadoc"
75         fi
76 }
77
78 src_install() {
79         java-pkg_dojar dist/*
80         java-pkg_dolauncher ${PN} --main proguard.ProGuard
81         java-pkg_dolauncher ${PN}gui --main proguard.gui.ProGuardGUI
82         java-pkg_dolauncher ${PN}_retrace --main proguard.retrace.ReTrace
83
84         if use doc; then
85                 dohtml -r docs/*
86                 java-pkg_dojavadoc javadoc
87         fi
88
89         if use examples; then
90                 dohtml -r examples
91         fi
92 }
93
94 pkg_postinst() {
95         elog "Please see http://proguard.sourceforge.net/GPL_exception.html"
96         elog "for linking exception information about ${PN}"
97 }