Use https by default
[gentoo.git] / dev-util / netbeans / netbeans-8.0.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6 inherit eutils java-pkg-2 java-ant-2
7
8 DESCRIPTION="Netbeans IDE"
9 HOMEPAGE="http://netbeans.org/"
10 SLOT="8.0"
11 SOURCE_URL="http://download.netbeans.org/netbeans/8.0.2/final/zip/netbeans-8.0.2-201411181905-src.zip"
12 PATCHES_URL="https://dev.gentoo.org/~fordfrog/distfiles/netbeans-8.0.2-build.xml.patch.bz2"
13 L10N_URL="https://dev.gentoo.org/~fordfrog/distfiles/netbeans-l10n-8.0.1-20141110.tar.bz2"
14 ALL_URLS="${SOURCE_URL} ${PATCHES_URL} ${L10N_URL}"
15 SRC_URI="linguas_af? ( ${ALL_URLS} )
16         linguas_ar? ( ${ALL_URLS} )
17         linguas_bg? ( ${ALL_URLS} )
18         linguas_ca? ( ${ALL_URLS} )
19         linguas_cs? ( ${ALL_URLS} )
20         linguas_de? ( ${ALL_URLS} )
21         linguas_el? ( ${ALL_URLS} )
22         linguas_es? ( ${ALL_URLS} )
23         linguas_fr? ( ${ALL_URLS} )
24         linguas_gl? ( ${ALL_URLS} )
25         linguas_hi_IN? ( ${ALL_URLS} )
26         linguas_id? ( ${ALL_URLS} )
27         linguas_it? ( ${ALL_URLS} )
28         linguas_ja? ( ${ALL_URLS} )
29         linguas_ko? ( ${ALL_URLS} )
30         linguas_lt? ( ${ALL_URLS} )
31         linguas_nl? ( ${ALL_URLS} )
32         linguas_pl? ( ${ALL_URLS} )
33         linguas_pt_BR? ( ${ALL_URLS} )
34         linguas_pt_PT? ( ${ALL_URLS} )
35         linguas_ro? ( ${ALL_URLS} )
36         linguas_ru? ( ${ALL_URLS} )
37         linguas_si? ( ${ALL_URLS} )
38         linguas_sq? ( ${ALL_URLS} )
39         linguas_sr? ( ${ALL_URLS} )
40         linguas_sv? ( ${ALL_URLS} )
41         linguas_ta_IN? ( ${ALL_URLS} )
42         linguas_tl? ( ${ALL_URLS} )
43         linguas_tr? ( ${ALL_URLS} )
44         linguas_vi? ( ${ALL_URLS} )
45         linguas_zh_CN? ( ${ALL_URLS} )
46         linguas_zh_TW? ( ${ALL_URLS} )
47 "
48 LICENSE="|| ( CDDL GPL-2-with-linking-exception )"
49 KEYWORDS="amd64 x86"
50 IUSE_NETBEANS_MODULES="
51         +netbeans_modules_apisupport
52         netbeans_modules_cnd
53         netbeans_modules_dlight
54         netbeans_modules_enterprise
55         netbeans_modules_ergonomics
56         netbeans_modules_extide
57         netbeans_modules_groovy
58         +netbeans_modules_java
59         netbeans_modules_javacard
60         +netbeans_modules_javafx
61         netbeans_modules_mobility
62         netbeans_modules_php
63         +netbeans_modules_profiler
64         netbeans_modules_webcommon
65         +netbeans_modules_websvccommon"
66 IUSE_LINGUAS="
67         linguas_af
68         linguas_ar
69         linguas_bg
70         linguas_ca
71         linguas_cs
72         linguas_de
73         linguas_el
74         linguas_es
75         linguas_fr
76         linguas_gl
77         linguas_hi_IN
78         linguas_id
79         linguas_it
80         linguas_ja
81         linguas_ko
82         linguas_lt
83         linguas_nl
84         linguas_pl
85         linguas_pt_BR
86         linguas_pt_PT
87         linguas_ro
88         linguas_ru
89         linguas_si
90         linguas_sq
91         linguas_sr
92         linguas_sv
93         linguas_ta_IN
94         linguas_tl
95         linguas_tr
96         linguas_vi
97         linguas_zh_CN
98         linguas_zh_TW"
99 IUSE="doc ${IUSE_NETBEANS_MODULES} ${IUSE_LINGUAS}"
100 S="${WORKDIR}"
101
102 DEPEND="virtual/jdk:1.7
103         dev-java/javahelp:0"
104 RDEPEND=">=virtual/jdk-1.7
105         ~dev-java/netbeans-harness-${PV}
106         ~dev-java/netbeans-ide-${PV}
107         ~dev-java/netbeans-nb-${PV}
108         ~dev-java/netbeans-platform-${PV}
109         netbeans_modules_apisupport? ( ~dev-java/netbeans-apisupport-${PV} )
110         netbeans_modules_cnd? ( ~dev-java/netbeans-cnd-${PV} )
111         netbeans_modules_dlight? ( ~dev-java/netbeans-dlight-${PV} )
112         netbeans_modules_enterprise? ( ~dev-java/netbeans-enterprise-${PV} )
113         netbeans_modules_ergonomics? ( ~dev-java/netbeans-ergonomics-${PV} )
114         netbeans_modules_extide? ( ~dev-java/netbeans-extide-${PV} )
115         netbeans_modules_groovy? ( ~dev-java/netbeans-groovy-${PV} )
116         netbeans_modules_java? ( ~dev-java/netbeans-java-${PV} )
117         netbeans_modules_javacard? ( ~dev-java/netbeans-javacard-${PV} )
118         netbeans_modules_javafx? ( ~dev-java/netbeans-javafx-${PV} )
119         netbeans_modules_mobility? ( ~dev-java/netbeans-mobility-${PV} )
120         netbeans_modules_php? ( ~dev-java/netbeans-php-${PV} )
121         netbeans_modules_profiler? ( ~dev-java/netbeans-profiler-${PV} )
122         netbeans_modules_webcommon? ( ~dev-java/netbeans-webcommon-${PV} )
123         netbeans_modules_websvccommon? ( ~dev-java/netbeans-websvccommon-${PV} )
124         doc? ( ~dev-java/netbeans-javadoc-${PV} )"
125 JAVA_PKG_BSFIX="off"
126 NBLOCALES=""
127
128 pkg_setup() {
129         for lingua in ${IUSE_LINGUAS} ; do
130                 local lang=${lingua/linguas_/}
131
132                 if [[ "${lang}" = "ar" ]] ; then
133                         lang="ar_EG,ar_SA"
134                 elif [[ "${lang}" = "es" ]] ; then
135                         lang="es,es_CO"
136                 elif [[ "${lang}" = "gl" ]] ; then
137                         lang="gl_ES"
138                 elif [[ "${lang}" = "id" ]] ; then
139                         lang="in_ID"
140                 elif [[ "${lang}" = "nl" ]] ; then
141                         lang="nl_BE,nl_NL"
142                 elif [[ "${lang}" = "tl" ]] ; then
143                         lang="fil_PH"
144                 fi
145
146                 if use ${lingua} ; then
147                         if [ -z "${NBLOCALES}" ] ; then
148                                 NBLOCALES="${lang}"
149                         else
150                                 NBLOCALES="${NBLOCALES},${lang}"
151                         fi
152                 fi
153         done
154
155         java-pkg-2_pkg_setup
156 }
157
158 src_unpack() {
159         if [ -n "${NBLOCALES}" ] ; then
160                 unpack $(basename ${SOURCE_URL})
161                 unpack $(basename ${L10N_URL})
162
163                 einfo "Deleting bundled jars..."
164                 find -name "*.jar" -type f -delete
165
166                 unpack netbeans-8.0.2-build.xml.patch.bz2
167         fi
168 }
169
170 src_prepare() {
171         if [ -n "${NBLOCALES}" ] ; then
172                 einfo "Deleting bundled class files..."
173                 find -name "*.class" -type f | xargs rm -vf
174
175                 epatch netbeans-8.0.2-build.xml.patch
176
177                 # Support for custom patches
178                 if [ -n "${NETBEANS80_PATCHES_DIR}" -a -d "${NETBEANS80_PATCHES_DIR}" ] ; then
179                         local files=`find "${NETBEANS80_PATCHES_DIR}" -type f`
180
181                         if [ -n "${files}" ] ; then
182                                 einfo "Applying custom patches:"
183
184                                 for file in ${files} ; do
185                                         epatch "${file}"
186                                 done
187                         fi
188                 fi
189
190                 einfo "Symlinking external libraries..."
191                 java-pkg_jar-from --build-only --into javahelp/external javahelp jhall.jar jhall-2.0_05.jar
192         fi
193
194         java-pkg-2_src_prepare
195 }
196
197 src_compile() {
198         if [ -n "${NBLOCALES}" ] ; then
199                 einfo "Compiling support for locales: ${NBLOCALES}"
200                 eant -f nbbuild/build.xml bootstrap || die
201                 eant -Dlocales=${NBLOCALES} -Ddist.dir=../nbbuild/netbeans -Dnbms.dir="" -Dnbms.dist.dir="" \
202                         -Dpermit.jdk7.builds=true -f l10n/build.xml build || die
203         fi
204 }
205
206 src_install() {
207         if [ -n "${NBLOCALES}" ] ; then
208                 pushd "${S}"/nbbuild/netbeans >/dev/null || die
209
210                 for cluster in apisupport cnd dlight enterprise ergonomics groovy harness ide java javacard javafx mobility php platform profiler webcommon websvccommon ; do
211                         if [ -d "${cluster}" ] ; then
212                                 insinto /usr/share/netbeans-${cluster}-${SLOT}
213                                 doins -r ${cluster}/*
214                         fi
215                 done
216
217                 if [ -d nb ] ; then
218                         insinto /usr/share/netbeans-nb-${SLOT}/nb
219                         doins -r nb/*
220                 fi
221
222                 popd >/dev/null || die
223         fi
224 }
225
226 pkg_postinst() {
227         if [ -n "${NBLOCALES}" ] ; then
228                 einfo "Netbeans automatically starts with the locale you have set in your user profile, if"
229                 einfo "the locale is built for Netbeans."
230                 einfo "If you want to force specific locale, use --locale argument, for example:"
231                 einfo "${PN}-${SLOT} --locale de"
232                 einfo "${PN}-${SLOT} --locale pt:BR"
233         fi
234
235         if use linguas_ar ; then
236                 einfo
237                 einfo "You selected Arabic locale so you can choose either ar:EG or ar:SA variant."
238         fi
239
240         if use linguas_es ; then
241                 einfo
242                 einfo "You selected Spanish locale so you can choose either es or es:CO variant."
243         fi
244
245         if use linguas_gl ; then
246                 einfo
247                 einfo "You selected Galician locale which has locale code gl:ES in Netbeans."
248         fi
249
250         if use linguas_id ; then
251                 einfo
252                 einfo "You selected Indonesian locale which has locale code in:ID in Netbeans."
253         fi
254
255         if use linguas_nl ; then
256                 einfo
257                 einfo "You selected Dutch locale so you can choose either nl:BE or nl:NL variant."
258         fi
259
260         if use linguas_tl ; then
261                 einfo
262                 einfo "You selected Tagalog locale which has for Filipino locale code fil:PH in Netbeans."
263         fi
264 }