summaryrefslogtreecommitdiff
blob: 057d75c90f07bb69480000d99d9d9cda77a3c8df (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/netbeans/netbeans-6.7.ebuild,v 1.1 2009/06/29 20:50:20 fordfrog Exp $

EAPI="2"
WANT_SPLIT_ANT="true"
inherit eutils java-pkg-2 java-ant-2

DESCRIPTION="NetBeans IDE for Java"
HOMEPAGE="http://www.netbeans.org"

SLOT="6.7"
SRC_URI="http://bits.netbeans.org/netbeans/6.7/community/fcs/zip/netbeans-6.7-200906261335-src.zip
	mirror://gentoo/netbeans-6.7-l10n-20090626125342.tar.bz2"

LICENSE="|| ( CDDL GPL-2-with-linking-exception )"
KEYWORDS="~amd64 ~x86"

IUSE_NETBEANS_MODULES="
	+netbeans_modules_apisupport
	netbeans_modules_cnd
	netbeans_modules_dlight
	netbeans_modules_enterprise
	netbeans_modules_ergonomics
	netbeans_modules_groovy
	+netbeans_modules_harness
	+netbeans_modules_ide
	netbeans_modules_identity
	+netbeans_modules_java
	netbeans_modules_mobility
	+netbeans_modules_nb
	netbeans_modules_php
	netbeans_modules_profiler
	netbeans_modules_ruby
	netbeans_modules_webcommon
	+netbeans_modules_websvccommon"
IUSE_LINGUAS="
	linguas_ar
	linguas_cs
	linguas_de
	linguas_es
	linguas_fr
	linguas_gl
	linguas_id
	linguas_it
	linguas_ja
	linguas_ko
	linguas_nl
	linguas_pl
	linguas_pt_BR
	linguas_ru
	linguas_sq
	linguas_sv
	linguas_tr
	linguas_zh_CN
	linguas_zh_TW"
IUSE="debug doc ${IUSE_NETBEANS_MODULES} ${IUSE_LINGUAS}"

RDEPEND=">=virtual/jdk-1.5
	java-virtuals/jdk-with-com-sun
	>=dev-java/javahelp-2:0
	dev-java/jna:0
	dev-java/jsr223:0
	>=dev-java/junit-4:4
	>=dev-java/swing-layout-1:1
	netbeans_modules_enterprise? (
		>=dev-java/antlr-2.7.7:0[java]
		>=dev-java/asm-3.1:3
		dev-java/bsf:2.3
		dev-java/commons-beanutils:1.7
		dev-java/commons-collections:0
		dev-java/commons-digester:0
		>=dev-java/commons-fileupload-1:0
		>=dev-java/commons-io-1.1:1
		>=dev-java/commons-logging-1.1:0
		>=dev-java/commons-validator-1.3:0
		dev-java/glassfish-deployment-api:1.2
		>=dev-java/httpunit-1.6:0
		dev-java/jakarta-jstl:0
		>=dev-java/jakarta-oro-2:2.0
		dev-java/jdom:1.0
		>=dev-java/jettison-1.0:0
		dev-java/jsr311-api:0
		>=dev-java/rome-0.9:0
	)
	netbeans_modules_harness? (
		dev-java/asm:2.2
		>=dev-java/jakarta-oro-2:2.0
		>=dev-java/log4j-1.2:0
	)
	netbeans_modules_ide? (
		>=dev-java/commons-codec-1.3:0
		>=dev-java/commons-httpclient-3.1:3
		>=dev-java/commons-lang-2.3:2.1
		>=dev-java/commons-logging-1.1:0
		>=dev-java/commons-net-1.4:0
		>=dev-java/flute-1.3:0
		>=dev-java/freemarker-2.3.8:2.3
		>=dev-java/jakarta-oro-2:2.0
		>=dev-java/jaxb-2:2
		>=dev-java/jdbc-mysql-5.1:0
		>=dev-java/jdbc-postgresql-8.3_p603:0
		>=dev-java/jsch-0.1.39:0
		dev-java/jsr173:0
		>=dev-java/jvyamlb-0.2.3:0
		dev-java/lucene:2.4
		>=dev-java/sac-1.3:0
		dev-java/sun-jaf:0
		~dev-java/tomcat-servlet-api-3:2.2
		>=dev-java/xerces-2.8.1:2
		>=dev-util/subversion-1.6:0[java]
	)
	netbeans_modules_java? (
		>=dev-java/ant-1.7:0
		>=dev-java/antlr-2.7.7:0[java]
		dev-java/asm:2.2
		>=dev-java/beansbinding-1.2.1:0
		>=dev-java/cglib-2.2_beta:2.2
		dev-java/commons-collections:0
		>=dev-java/dom4j-1.6:1
		dev-java/ehcache:1.2
		dev-java/fastinfoset:0
		dev-java/glassfish-persistence:0
		dev-java/glassfish-transaction-api:0
		dev-java/hibernate:3.1
		dev-java/javassist:3
		>=dev-java/jdom-1.0:1.0
		dev-java/jsr181:0
		dev-java/jsr250:0
		dev-java/jsr67:0
		dev-java/jtidy:0
		>=dev-java/junit-3.8.2:0
		dev-java/saaj:0
		dev-java/sjsxp:0
		dev-java/stax-ex:0
		dev-java/xmlstreambuffer:0
	)
	netbeans_modules_mobility? (
		>=dev-java/ant-contrib-1.0_beta:0
		>=dev-java/commons-codec-1.3:0
		dev-java/commons-httpclient:3
		dev-java/jakarta-slide-webdavclient:0
		dev-java/jdom:1.0
		>=dev-java/proguard-4.2:0
	)
	netbeans_modules_php? (
		>=dev-java/javacup-0.11a_beta20060608:0
	)
	netbeans_modules_ruby? (
		dev-java/asm:3
		dev-java/jline:0
		dev-java/jna-posix:0
		dev-java/joda-time:0
		dev-java/joni:0
		dev-java/jruby:0
		dev-util/jay:0[java]
	)"

DEPEND=">=virtual/jdk-1.5
	java-virtuals/jdk-with-com-sun
	app-arch/unzip
	>=dev-java/ant-core-1.7.1:0
	>=dev-java/ant-nodeps-1.7.1:0
	dev-java/ant-trax:0
	>=dev-java/javahelp-2:0
	dev-java/jna:0
	dev-java/jsr223:0
	>=dev-java/junit-4:4
	>=dev-java/swing-layout-1:1
	netbeans_modules_enterprise? (
		>=dev-java/commons-fileupload-1:0
		dev-java/glassfish-deployment-api:1.2
		>=dev-java/httpunit-1.6:0
		dev-java/jakarta-jstl:0
		dev-java/tomcat-servlet-api:2.3
	)
	netbeans_modules_harness? (
		dev-java/asm:2.2
		>=dev-java/jakarta-oro-2:2.0
		>=dev-java/log4j-1.2:0
	)
	netbeans_modules_ide? (
		>=dev-java/commons-codec-1.3:0
		>=dev-java/commons-httpclient-3.1:3
		>=dev-java/commons-lang-2.3:2.1
		>=dev-java/commons-logging-1.1:0
		>=dev-java/commons-net-1.4.1:0
		>=dev-java/flute-1.3:0
		>=dev-java/freemarker-2.3.8:2.3
		>=dev-java/jakarta-oro-2:2.0
		>=dev-java/javacc-3.2:0
		>=dev-java/jaxb-2.1:2
		>=dev-java/jdbc-mysql-5.1:0
		>=dev-java/jdbc-postgresql-8.3_p603:0
		>=dev-java/jsch-0.1.39:0
		dev-java/jsr173:0
		dev-java/jvyamlb:0
		dev-java/lucene:2.4
		>=dev-java/sac-1.3:0
		dev-java/sun-jaf:0
		~dev-java/tomcat-servlet-api-3:2.2
		>=dev-java/xerces-2.8.1:2
		>=dev-util/subversion-1.6:0[java]
	)
	netbeans_modules_java? (
		dev-java/beansbinding:0
		>=dev-java/cglib-2.2_beta:2.2
		dev-java/jdom:1.0
		>=dev-java/junit-3.8:0
	)
	netbeans_modules_mobility? (
		>=dev-java/ant-contrib-1.0_beta:0
		>=dev-java/commons-codec-1.3:0
		dev-java/commons-httpclient:3
		dev-java/jakarta-slide-webdavclient:0
		dev-java/jdom:1.0
		>=dev-java/proguard-4.2:0
	)
	netbeans_modules_php? (
		>=dev-java/javacup-0.11a_beta20060608:0
	)
	netbeans_modules_ruby? (
		dev-util/jay:0
	)"

S="${WORKDIR}"
BUILDDESTINATION="${S}/nbbuild/netbeans"
ENTERPRISE="5"
IDE_VERSION="11"
PLATFORM="10"
MY_FDIR="${FILESDIR}/${SLOT}"
DESTINATION="/usr/share/netbeans-${SLOT}"
JAVA_PKG_BSFIX="off"

pkg_setup() {
	local need_apisupport=""
	local need_cnd=""
	local need_dlight=""
	local need_enterprise=""
	local need_ergonomics=""
	local need_groovy=""
	local need_harness=""
	local need_ide=""
	local need_identity=""
	local need_java=""
	local need_mobility=""
	local need_nb=""
	local need_php=""
	local need_profiler=""
	local need_ruby=""
	local need_webcommon=""
	local need_websvccommon=""

	# direct deps: harness, ide, java
	if use netbeans_modules_apisupport ; then
		need_harness="1"
		need_ide="1"
		need_java="1"
	fi

	# direct deps: dlight, ide
	if use netbeans_modules_cnd ; then
		need_dlight="1"
		need_ide="1"
	fi

	# direct deps: ide
	if use netbeans_modules_dlight ; then
		need_ide="1"
	fi

	# direct deps: ide, java, profiler, webcommon
	if use netbeans_modules_enterprise ; then
		need_ide="1"
		need_java="1"
		need_profiler="1"
		need_webcommon="1"
	fi

	# direct deps: ide
	if use netbeans_modules_ergonomics ; then
		need_ide="1"
	fi

	# direct deps: ide, java
	if use netbeans_modules_groovy ; then
		need_ide="1"
		need_java="1"
	fi

	# direct deps: enterprise, ide, java
	if use netbeans_modules_identity ; then
		need_enterprise="1"
		need_ide="1"
		need_java="1"
	fi

	# direct deps: ide, websvccommon
	if use netbeans_modules_java ; then
		need_ide="1"
		need_websvccommon="1"
	fi

	# direct deps: apisupport, enterprise, ide, java
	# dependency on enterprise cluster: http://www.netbeans.org/issues/show_bug.cgi?id=151535
	if use netbeans_modules_mobility ; then
		need_apisupport="1"
		need_enterprise="1"
		need_ide="1"
		need_java="1"
	fi

	# direct deps: harness, ide
	if use netbeans_modules_nb ; then
		need_harness="1"
		need_ide="1"
	fi

	# direct deps: ide, webcommon, websvccommon
	if use netbeans_modules_php ; then
		need_ide="1"
		need_webcommon="1"
		need_websvccommon="1"
	fi

	# direct deps: ide, java
	if use netbeans_modules_profiler ; then
		need_ide="1"
		need_java="1"
	fi

	# direct deps: ide, webcommon
	if use netbeans_modules_ruby ; then
		need_ide="1"
		need_webcommon="1"
	fi

	# direct deps: ide
	if use netbeans_modules_webcommon ; then
		need_ide="1"
	fi

	# direct deps: ide
	if use netbeans_modules_websvccommon ; then
		need_ide="1"
	fi

	# currently we require all clusters when building javadoc, can be tested
	# what clusters are really needed to build javadoc
	if use doc ; then
		need_apisupport="1"
		need_cnd="1"
		need_dlight="1"
		need_enterprise="1"
		need_ergonomics="1"
		need_groovy="1"
		need_harness="1"
		need_ide="1"
		need_identity="1"
		need_java="1"
		need_mobility="1"
		need_nb="1"
		need_php="1"
		need_profiler="1"
		need_ruby="1"
		need_webcommon="1"
		need_websvccommon="1"
	fi

	if [ -n "${need_apisupport}" ] ; then
		need_harness="1"
		need_ide="1"
		need_java="1"
	fi

	if [ -n "${need_dlight}" ] ; then
		need_ide="1"
	fi

	if [ -n "${need_enterprise}" ] ; then
		need_ide="1"
		need_java="1"
		need_profiler="1"
		need_webcommon="1"
	fi

	if [ -n "${need_groovy}" ] ; then
		need_ide="1"
		need_java="1"
	fi

	if [ -n "${need_profiler}" ] ; then
		need_ide="1"
		need_java="1"
	fi

	if [ -n "${need_java}" ] ; then
		need_ide="1"
		need_websvccommon="1"
	fi

	if [ -n "${need_nb}" ] ; then
		need_harness="1"
		need_ide="1"
	fi

	if [ -n "${need_webcommon}" ] ; then
		need_ide="1"
	fi

	if [ -n "${need_websvccommon}" ] ; then
		need_ide="1"
	fi

	local missing=""
	[ -n "${need_apisupport}" ] && ! use netbeans_modules_apisupport && missing="${missing} apisupport"
	[ -n "${need_cnd}" ] && ! use netbeans_modules_cnd && missing="${missing} cnd"
	[ -n "${need_dlight}" ] && ! use netbeans_modules_dlight && missing="${missing} dlight"
	[ -n "${need_enterprise}" ] && ! use netbeans_modules_enterprise && missing="${missing} enterprise"
	[ -n "${need_ergonomics}" ] && ! use netbeans_modules_ergonomics && missing="${missing} ergonomics"
	[ -n "${need_groovy}" ] && ! use netbeans_modules_groovy && missing="${missing} groovy"
	[ -n "${need_harness}" ] && ! use netbeans_modules_harness && missing="${missing} harness"
	[ -n "${need_ide}" ] && ! use netbeans_modules_ide && missing="${missing} ide"
	[ -n "${need_identity}" ] && ! use netbeans_modules_identity && missing="${missing} identity"
	[ -n "${need_java}" ] && ! use netbeans_modules_java && missing="${missing} java"
	[ -n "${need_mobility}" ] && ! use netbeans_modules_mobility && missing="${missing} mobility"
	[ -n "${need_nb}" ] && ! use netbeans_modules_nb && missing="${missing} nb"
	[ -n "${need_php}" ] && ! use netbeans_modules_php && missing="${missing} php"
	[ -n "${need_profiler}" ] && ! use netbeans_modules_profiler && missing="${missing} profiler"
	[ -n "${need_ruby}" ] && ! use netbeans_modules_ruby && missing="${missing} ruby"
	[ -n "${need_webcommon}" ] && ! use netbeans_modules_webcommon && missing="${missing} webcommon"
	[ -n "${need_websvccommon}" ] && ! use netbeans_modules_websvccommon && missing="${missing} websvccommon"

	if [ -n "${missing}" ] ; then
		eerror "You need to add these modules to NETBEANS_MODULES because they are needed by modules you have selected."
		use doc && eerror "With \"doc\" USE flag enabled, all modules are required."
		eerror "   Missing NETBEANS_MODULES:${missing}"
		die "Missing NETBEANS_MODULES"
	fi

	if ! use netbeans_modules_nb ; then
		ewarn "You are building netbeans without 'nb' module, this way you will build only specified"
		ewarn "clusters, not a functional IDE. In case you want functional IDE, add 'nb' to NETBEANS_MODULES."
		epause 5
	fi

	java-pkg-2_pkg_setup
}

src_prepare () {
	# We need to disable downloading of jars
	epatch "${FILESDIR}"/${SLOT}/nbbuild_build.xml.patch \
		"${FILESDIR}"/${SLOT}/nbbuild_templates_projectized.xml.patch

	# Clean up nbbuild
	einfo "Removing prebuilt *.class files from nbbuild"
	find "${S}" -name "*.class" | xargs rm -v

	if [ -z "${JAVA_PKG_NB_USE_BUNDLED}" ] ; then
		place_unpack_symlinks
	fi

	if [ -z "${JAVA_PKG_NB_KEEP_BUNDLED}" ] ; then
		# We do not remove the jars that we ar not able to unbundle atm
		# More info at: https://overlays.gentoo.org/proj/java/wiki/Netbeans_Maintenance

		local tmpfile="${T}/bundled.txt"

		einfo "Removing rest of the bundled jars..."
		find "${S}" -type f -name "*.jar" > ${tmpfile} || die "Cannot put jars in tmp file"

		if use netbeans_modules_dlight ; then
			filter_file "dlight.db.h2/external/h2-1.0.79.jar" ${tmpfile}
			filter_file "dlight.derby.support/external/derby-10.2.2.0.jar" ${tmpfile}
		fi

		if use netbeans_modules_enterprise ; then
			filter_file "j2ee.sun.appsrv81/external/appservapis-2.0.58.3.jar" ${tmpfile}
			filter_file "j2ee.sun.appsrv81/external/org-netbeans-modules-j2ee-sun-appsrv81.jar" ${tmpfile}
			filter_file "libs.glassfish_logging/external/glassfish-logging-2.0.jar" ${tmpfile}
			# http://www.netbeans.org/issues/show_bug.cgi?id=164334
			filter_file "servletjspapi/external/servlet2.5-jsp2.1-api.jar" ${tmpfile}
			filter_file "spring.webmvc/external/spring-webmvc-2.5.jar" ${tmpfile}
			filter_file "web.jspparser/external/glassfish-jspparser-2.0.jar" ${tmpfile}
			# api documentation packaged as jar
			filter_file "websvc.restlib/external/jersey-api-doc.jar" ${tmpfile}
			# api documentation packaged as jar
			filter_file "websvc.restlib/external/jsr311-api-doc.jar" ${tmpfile}
		fi

		if use netbeans_modules_groovy ; then
			# heavily repackaged
			filter_file "groovy.editor/external/groovy-all-1.5.7.jar" ${tmpfile}
		fi

		if use netbeans_modules_harness ; then
			filter_file "apisupport.harness/external/cobertura-1.9.jar" ${tmpfile}
			filter_file "apisupport.harness/external/openjdk-javac-6-b12.jar" ${tmpfile}
			filter_file "jemmy/external/jemmy-2.3.0.0.jar" ${tmpfile}
		fi

		if use netbeans_modules_ide ; then
			# very old stuff
			filter_file "httpserver/external/tomcat-webserver-3.2.jar" ${tmpfile}
			filter_file "libs.bugtracking/external/org.eclipse.mylyn.commons.core_3.1.1.jar" ${tmpfile}
			filter_file "libs.bugtracking/external/org.eclipse.mylyn.commons.net_3.1.1.jar" ${tmpfile}
			filter_file "libs.bugtracking/external/org.eclipse.mylyn.tasks.core_3.1.1.jar" ${tmpfile}
			filter_file "libs.bugzilla/external/org.eclipse.mylyn.bugzilla.core_3.1.1.jar" ${tmpfile}
			filter_file "libs.bytelist/external/bytelist-0.1.jar" ${tmpfile}
			filter_file "libs.ini4j/external/ini4j-0.4.1.jar" ${tmpfile}
			filter_file "libs.svnClientAdapter/external/svnClientAdapter-1.6.0.jar" ${tmpfile}
			filter_file "libs.swingx/external/swingx-0.9.5.jar" ${tmpfile}
			filter_file "libs.smack/external/smack.jar" ${tmpfile}
			filter_file "libs.smack/external/smackx.jar" ${tmpfile}
			# packaged in a different way than we do
			filter_file "libs.jaxb/external/jaxb-impl.jar" ${tmpfile}
			# packaged in a different way than we do
			filter_file "libs.jaxb/external/jaxb-xjc.jar" ${tmpfile}
			# patched version of apache resolver
			filter_file "o.apache.xml.resolver/external/resolver-1.2.jar" ${tmpfile}
			# system core-renderer.jar causes deadlocks (in logging) when openning css files
			filter_file "web.flyingsaucer/external/core-renderer-R7final.jar" ${tmpfile}
		fi

		if use netbeans_modules_java ; then
			# netbeans bundles also toplink-essentials in the jar
			filter_file "j2ee.toplinklib/external/glassfish-persistence-v2ur1-build-09d.jar" ${tmpfile}
			# some patch
			filter_file "junit/external/Ant-1.7.1-binary-patch-72080.jar" ${tmpfile}
			# junit sources
			filter_file "junit/external/junit-4.5-src.jar" ${tmpfile}
			# some netbeans stuff
			filter_file "libs.javacapi/external/javac-api-nb-7.0-b07.jar" ${tmpfile}
			# some netbeans stuff
			filter_file "libs.javacimpl/external/javac-impl-nb-7.0-b07.jar" ${tmpfile}
			filter_file "libs.springframework/external/spring-2.5.jar" ${tmpfile}
			# maven stuff - ignoring for now
			filter_file "maven.embedder/external/maven-dependency-tree-1.2.jar" ${tmpfile}
			# maven stuff - ignoring for now
			filter_file "maven.embedder/external/maven-embedder-2.1-20080623-patched.jar" ${tmpfile}
			# maven stuff - ignoring for now
			filter_file "maven.indexer/external/nexus-indexer-2.0.0-shaded.jar" ${tmpfile}
			filter_file "swingapp/external/appframework-1.0.3.jar" ${tmpfile}
			filter_file "swingapp/external/swing-worker-1.1.jar" ${tmpfile}
		fi

		if use netbeans_modules_mobility ; then
			# if not commented, the jars are probably some netbeans jars related to mobility
			#
			# i didn't find sources of this
			filter_file "j2me.cdc.project.ricoh/external/RicohAntTasks-2.0.jar" ${tmpfile}
			filter_file "mobility.databindingme/lib/netbeans_databindingme.jar" ${tmpfile}
			filter_file "mobility.databindingme/lib/netbeans_databindingme_pim.jar" ${tmpfile}
			filter_file "mobility.databindingme/lib/netbeans_databindingme_svg.jar" ${tmpfile}
			# retired project
			filter_file "mobility.deployment.webdav/external/jakarta-slide-ant-webdav-2.1.jar" ${tmpfile}
			filter_file "mobility.j2meunit/external/jmunit4cldc10-1.2.1.jar" ${tmpfile}
			filter_file "mobility.j2meunit/external/jmunit4cldc11-1.2.1.jar" ${tmpfile}
			filter_file "o.n.mobility.lib.activesync/external/nbactivesync-5.0.jar" ${tmpfile}
			filter_file "svg.perseus/external/perseus-nb-1.0.jar" ${tmpfile}
			filter_file "vmd.components.midp/netbeans_midp_components_basic/dist/netbeans_midp_components_basic.jar" ${tmpfile}
			filter_file "vmd.components.midp.pda/netbeans_midp_components_pda/dist/netbeans_midp_components_pda.jar" ${tmpfile}
			filter_file "vmd.components.midp.wma/netbeans_midp_components_wma/dist/netbeans_midp_components_wma.jar" ${tmpfile}
			filter_file "vmd.components.svg/nb_svg_midp_components/dist/nb_svg_midp_components.jar" ${tmpfile}
		fi

		if use netbeans_modules_ruby ; then
			filter_file "libs.jrubyparser/external/jruby-parser-0.1.jar" ${tmpfile}
			filter_file "o.kxml2/external/kxml2-2.3.0.jar" ${tmpfile}
			filter_file "o.rubyforge.debugcommons/external/debug-commons-java-0.10.0.jar" ${tmpfile}
		fi

		if [ -n "${NB_FILTERFILESFAILED}" ] ; then
			die "Some files that should be filtered do not exist"
		fi

		for file in `cat ${tmpfile}` ; do
			rm -v ${file}
		done
	fi
}

src_compile() {
	local antflags="-Dstop.when.broken.modules=true -Dpermit.jdk6.builds=true"

	if use debug; then
		antflags="${antflags} -Dbuild.compiler.debug=true"
		antflags="${antflags} -Dbuild.compiler.deprecation=true"
	else
		antflags="${antflags} -Dbuild.compiler.deprecation=false"
	fi

	local clusters="-Dnb.clusters.list=nb.cluster.platform"
	for netbeans_module in ${IUSE_NETBEANS_MODULES} ; do
		netbeans_module=${netbeans_module/[+]/}
		local short_netbeans_module=${netbeans_module/netbeans_modules_/}
		use ${netbeans_module} && clusters="${clusters},nb.cluster.${short_netbeans_module}"
	done

	local build_target=""
	if use netbeans_modules_nb ; then
		build_target="build-nozip"
	else
		build_target="build-clusters"
		mkdir -p "${BUILDDESTINATION}" || die
	fi

	# Fails to compile
	java-pkg_filter-compiler ecj-3.2 ecj-3.3 ecj-3.4

	# Build the clusters
	local heap=""
	if use doc ; then
		heap="-Xmx1536m"
	else
		heap="-Xmx1g"
	fi

	ANT_TASKS="ant-nodeps ant-trax" ANT_OPTS="${heap} -Djava.awt.headless=true" \
		eant ${antflags} ${clusters} -f nbbuild/build.xml ${build_target} $(use_doc build-javadoc)

	local locales=""
	for lang in ${IUSE_LINGUAS} ; do
		local mylang=${lang/linguas_/}
		if use ${lang} ; then
			if [ "${mylang}" = "gl" ] ; then
				mylang="gl_ES"
			elif [ "${mylang}" = "id" ] ; then
				mylang="in_ID"
			fi

			if [ -z "${locales}" ] ; then
				locales="${mylang}"
			else
				locales="${locales},${mylang}"
			fi
		fi
	done

	if [ -n "${locales}" ] ; then
		einfo "Compiling support for locales: ${locales}"
		eant ${antflags} -Dlocales=${locales} -Ddist.dir=../nbbuild/netbeans -Dnbms.dir="" -Dnbms.dist.dir="" \
			-f l10n/build.xml build
	fi

	# Remove non-Linux binaries
	einfo "Removing libraries and scripts for non-linux archs..."
	find "${BUILDDESTINATION}" -type f \
		-name "*.exe" -o \
		-name "*.cmd" -o \
		-name "*.bat" -o \
		-name "*.dll"	  \
		| grep -v "/profiler3/" | xargs rm -fv

	if use netbeans_modules_cnd ; then
		rm -fv "${BUILDDESTINATION}"/cnd2/bin/*-SunOS-*
		rm -fv "${BUILDDESTINATION}"/cnd2/bin/*-Mac_OS_X-*
	fi

	# Removing external stuff. They are api docs from external libs.
	rm -f "${BUILDDESTINATION}"/ide${IDE_VERSION}/docs/*.zip

	# Remove zip files from generated javadocs.
	rm -f "${BUILDDESTINATION}"/javadoc/*.zip

	# Use the system ant
	if use netbeans_modules_java ; then
		cd "${BUILDDESTINATION}"/java2/ant || die "Cannot cd to "${BUILDDESTINATION}"/java2/ant"
		rm -fr lib
		rm -fr bin
	fi

	# Set initial default jdk
	if [[ -e "${BUILDDESTINATION}"/etc/netbeans.conf ]]; then
		echo "netbeans_jdkhome=\"\$(java-config -O)\"" >> "${BUILDDESTINATION}"/etc/netbeans.conf
	fi

	# Install Gentoo Netbeans ID
	# This ID is used to identify our netbeans package while contacting update center
	mkdir -p  "${BUILDDESTINATION}"/nb${SLOT}/config || die
	echo "NBGNT" > "${BUILDDESTINATION}"/nb${SLOT}/config/productid || die "Could not set Gentoo Netbeans ID"

	# fix paths per bug# 163483
	if [[ -e "${BUILDDESTINATION}"/bin/netbeans ]]; then
		sed -i -e 's:"$progdir"/../etc/:/etc/netbeans-6.7/:' "${BUILDDESTINATION}"/bin/netbeans
		sed -i -e 's:"${userdir}"/etc/:/etc/netbeans-6.7/:' "${BUILDDESTINATION}"/bin/netbeans
	fi
}

src_install() {
	insinto ${DESTINATION}

	einfo "Installing the program..."
	cd "${BUILDDESTINATION}"
	doins -r *

	# Remove the build helper files
	rm -f "${D}"/${DESTINATION}/nb.cluster.*
	rm -f "${D}"/${DESTINATION}/*.built
	rm -f "${D}"/${DESTINATION}/moduleCluster.properties
	rm -f "${D}"/${DESTINATION}/module_tracking.xml
	rm -f "${D}"/${DESTINATION}/build_info

	# Change location of etc files
	if [[ -e "${BUILDDESTINATION}"/etc ]]; then
		insinto /etc/${PN}-${SLOT}
		doins "${BUILDDESTINATION}"/etc/*
		rm -fr "${D}"/${DESTINATION}/etc
		dosym /etc/${PN}-${SLOT} ${DESTINATION}/etc
	fi

	# Replace bundled jars with system jars
	if [ -z "${JAVA_PKG_NB_USE_BUNDLED}" ] ; then
		symlink_extjars
	fi

	# Correct permissions on executables and possibly remove executables that are not needed on linux
	local nbexec_exe="${DESTINATION}/platform${PLATFORM}/lib/nbexec"
	fperms 775 ${nbexec_exe} || die
	if [[ -e "${D}"/${DESTINATION}/bin/netbeans ]] ; then
		fperms 755 "${DESTINATION}/bin/netbeans" || die
	fi
	if use netbeans_modules_cnd ; then
		cd "${D}"/${DESTINATION}/cnd2/bin || die
		for file in *.sh ; do
			fperms 755 ${file} || die
		done
		for file in *.so ; do
			fperms 755 ${file} || die
		done
	fi
	if use netbeans_modules_dlight ; then
		cd "${D}"/${DESTINATION}/dlight1/bin/nativeexecution || die
		fperms 755 dorun.sh || die
	fi
	if use netbeans_modules_profiler ; then
		cd "${D}"/${DESTINATION}/profiler3/remote-pack-defs || die
		for file in *.sh ; do
			fperms 755 ${file} || die
		done
	fi
	if use netbeans_modules_ruby ; then
		cd "${D}"/${DESTINATION}/ruby2/jruby-1.2.0/bin || die
		for file in * ; do
			fperms 755 ${file} || die
		done
	fi

	# Link netbeans executable from bin
	if [[ -f "${D}"/${DESTINATION}/bin/netbeans ]]; then
		dosym ${DESTINATION}/bin/netbeans /usr/bin/${PN}-${SLOT}
	else
		dosym ${DESTINATION}/platform7/lib/nbexec /usr/bin/${PN}-${SLOT}
	fi

	# Ant installation
	if use netbeans_modules_java ; then
		local ANTDIR="${DESTINATION}/java2/ant"
		dosym /usr/share/ant/lib ${ANTDIR}/lib
		dosym /usr/share/ant-core/bin ${ANTDIR}/bin
	fi

	# Documentation
	einfo "Installing Documentation..."

	cd "${D}"/${DESTINATION}
	dohtml CREDITS.html README.html netbeans.css
	rm -f build_info CREDITS.html README.html netbeans.css

	if use doc ; then
		rm "${S}"/nbbuild/build/javadoc/*.zip
		java-pkg_dojavadoc "${S}"/nbbuild/build/javadoc
	fi

	# Icons and shortcuts
	if use netbeans_modules_nb ; then
		einfo "Installing icon..."
		dodir /usr/share/icons/hicolor/32x32/apps
		dosym ${DESTINATION}/nb${SLOT}/netbeans.png /usr/share/icons/hicolor/32x32/apps/netbeans-${SLOT}.png
	fi

	make_desktop_entry netbeans-${SLOT} "Netbeans ${SLOT}" netbeans-${SLOT}.png Development
}

pkg_postinst() {
	if use netbeans_modules_nb ; then
		einfo "Netbeans automatically starts with the locale you have set in your user profile, if"
		einfo "the locale is built for netbeans."
		einfo "If you want to force specific locale, use --locale argument, for example:"
		einfo "${PN}-${SLOT} --locale de"
		einfo "${PN}-${SLOT} --locale pt:BR"
	fi
}

# Supporting functions for this ebuild

place_unpack_symlinks() {
	local target=""

	einfo "Symlinking compilation-time jars"

	dosymcompilejar "apisupport.harness/external" javahelp jhall.jar jsearch-2.0_05.jar
	dosymcompilejar "javahelp/external" javahelp jh.jar jh-2.0_05.jar
	dosymcompilejar "o.jdesktop.layout/external" swing-layout-1 swing-layout.jar swing-layout-1.0.3.jar
	dosymcompilejar "libs.jna/external" jna jna.jar jna-3.0.9.jar
	dosymcompilejar "libs.jsr223/external" jsr223 script-api.jar jsr223-api.jar
	dosymcompilejar "libs.junit4/external" junit-4 junit.jar junit-4.5.jar

	if use netbeans_modules_enterprise ; then
		dosymcompilejar "j2eeapis/external" glassfish-deployment-api-1.2 glassfish-deployment-api.jar jsr88javax.jar
		dosymcompilejar "libs.commons_fileupload/external" commons-fileupload commons-fileupload.jar commons-fileupload-1.0.jar
		dosymcompilejar "libs.httpunit/external" httpunit httpunit.jar httpunit-1.6.2.jar
		dosymcompilejar "web.jstl11/external" jakarta-jstl jstl.jar jstl-1.1.2.jar
		dosymcompilejar "web.jstl11/external" jakarta-jstl standard.jar standard-1.1.2.jar
		dosymcompilejar "web.monitor/external" tomcat-servlet-api-2.3 servlet.jar servlet-2.3.jar
	fi

	if use netbeans_modules_harness ; then
		dosymcompilejar "apisupport.harness/external" asm-2.2 asm.jar asm-2.2.1.jar
		dosymcompilejar "apisupport.harness/external" asm-2.2 asm-tree.jar asm-tree-2.2.1.jar
		dosymcompilejar "apisupport.harness/external" jakarta-oro-2.0 jakarta-oro.jar jakarta-oro-2.0.8.jar
		dosymcompilejar "apisupport.harness/external" log4j log4j.jar log4j-1.2.9.jar
	fi

	if use netbeans_modules_ide ; then
		dosymcompilejar "libs.commons_codec/external" commons-codec commons-codec.jar apache-commons-codec-1.3.jar
		dosymcompilejar "libs.commons_logging/external" commons-logging commons-logging.jar commons-logging-1.1.jar
		dosymcompilejar "libs.bugtracking/external" commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.1.jar
		dosymcompilejar "libs.bugtracking/external" commons-lang-2.1 commons-lang.jar commons-lang-2.3.jar
		dosymcompilejar "libs.jsch/external" jsch jsch.jar jsch-0.1.41.jar
		dosymcompilejar "libs.jvyamlb/external" jvyamlb jvyamlb.jar jvyamlb-0.2.3.jar
		dosymcompilejar "libs.svnClientAdapter/external" subversion svn-javahl.jar svnjavahl-1.6.0.jar
		dosymcompilejar "libs.lucene/external" lucene-2.4 lucene-core.jar lucene-core-2.3.2.jar
		dosymcompilejar "css.visual/external" sac sac.jar sac-1.3.jar
		dosymcompilejar "css.visual/external" flute flute.jar flute-1.3.jar
		dosymcompilejar "db.drivers/external" jdbc-mysql jdbc-mysql.jar mysql-connector-java-5.1.6-bin.jar
		dosymcompilejar "db.drivers/external" jdbc-postgresql jdbc-postgresql.jar postgresql-8.3-603.jdbc3.jar
		dosymcompilejar "db.sql.visualeditor/external" javacc javacc.jar javacc-3.2.jar
		dosymcompilejar "servletapi/external" tomcat-servlet-api-2.2 servlet.jar servlet-2.2.jar
		dosymcompilejar "libs.xerces/external" xerces-2 xercesImpl.jar xerces-2.8.0.jar
		dosymcompilejar "libs.jakarta_oro/external" jakarta-oro-2.0 jakarta-oro.jar jakarta-oro-2.0.8.jar
		dosymcompilejar "libs.commons_net/external" commons-net commons-net.jar commons-net-1.4.1.jar
		dosymcompilejar "libs.freemarker/external" freemarker-2.3 freemarker.jar freemarker-2.3.8.jar
		dosymcompilejar "libs.jaxb/external" jaxb-2 jaxb-api.jar jaxb-api.jar
		dosymcompilejar "libs.jaxb/external" jsr173 jsr173.jar jsr173_api.jar
		dosymcompilejar "libs.jaxb/external" sun-jaf activation.jar activation.jar
	fi

	if use netbeans_modules_java ; then
		dosymcompilejar "o.jdesktop.beansbinding/external" beansbinding beansbinding.jar beansbinding-1.2.1.jar
		dosymcompilejar "maven.embedder/external" jdom-1.0 jdom.jar jdom-1.0.jar
		dosymcompilejar "junit/external" junit junit.jar junit-3.8.2.jar
		dosymcompilejar "libs.cglib/external" cglib-2.2 cglib.jar cglib-2.2.jar
	fi

	if use netbeans_modules_mobility ; then
		dosymcompilejar "j2me.cdc.project.ricoh/external" commons-codec commons-codec.jar commons-codec-1.3.jar
		dosymcompilejar "j2me.cdc.project.ricoh/external" commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.0.jar
		dosymcompilejar "mobility.antext/external" ant-contrib ant-contrib.jar ant-contrib-1.0b3.jar
		dosymcompilejar "mobility.deployment.webdav/external" commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.0.1.jar
		dosymcompilejar "mobility.deployment.webdav/external" jdom-1.0 jdom.jar jdom-1.0.jar
		dosymcompilejar "mobility.deployment.webdav/external" jakarta-slide-webdavclient jakarta-slide-webdavlib.jar jakarta-slide-webdavlib-2.1.jar
		dosymcompilejar "mobility.proguard/external" proguard proguard.jar proguard4.2.jar
	fi

	if use netbeans_modules_php ; then
		dosymcompilejar "libs.javacup/external" javacup javacup.jar java-cup-11a.jar
	fi

	if use netbeans_modules_ruby ; then
		dosymcompilejar "libs.yydebug/external" jay yydebug.jar yydebug-1.0.2.jar
	fi

	if [ -n "${NB_DOSYMCOMPILEJARFAILED}" ] ; then
		die "Some compilation-time jars could not be symlinked"
	fi
}

symlink_extjars() {
	local targetdir=""

	einfo "Symlinking runtime jars"

	targetdir="platform${PLATFORM}/modules/ext"
	dosyminstjar ${targetdir} javahelp jh.jar jh-2.0_05.jar
	dosyminstjar ${targetdir} jna jna.jar jna-3.0.9.jar
	dosyminstjar ${targetdir} jsr223 script-api.jar script-api.jar
	dosyminstjar ${targetdir} junit-4 junit.jar junit-4.5.jar
	dosyminstjar ${targetdir} swing-layout-1 swing-layout.jar swing-layout-1.0.3.jar

	if use netbeans_modules_dlight ; then
		targetdir="dlight1/modules/ext"
		# derby-10.2.2.0.jar
		# h2-1.0.79.jar
	fi

	if use netbeans_modules_enterprise ; then
		targetdir="/enterprise5/modules/ext"
		dosyminstjar ${targetdir} commons-fileupload commons-fileupload.jar commons-fileupload-1.0.jar
		# glassfish-jspparser-2.0.jar
		# glassfish-logging-2.0.jar
		dosyminstjar ${targetdir} httpunit httpunit.jar httpunit-1.6.2.jar
		dosyminstjar ${targetdir} jakarta-jstl jstl.jar jstl.jar
		dosyminstjar ${targetdir} jakarta-jstl standard.jar standard.jar
		dosyminstjar ${targetdir} glassfish-deployment-api-1.2 glassfish-deployment-api.jar jsr88javax.jar
		# servlet2.5-jsp2.1-api.jar
		targetdir="enterprise5/modules/ext/spring"
		# spring-webmvc-2.5.jar
		targetdir="enterprise5/modules/ext/jsf-1_2"
		dosyminstjar ${targetdir} commons-beanutils-1.7 commons-beanutils.jar commons-beanutils.jar
		dosyminstjar ${targetdir} commons-collections commons-collections.jar commons-collections.jar
		dosyminstjar ${targetdir} commons-digester commons-digester.jar commons-digester.jar
		dosyminstjar ${targetdir} commons-logging commons-logging.jar commons-logging.jar
		# jsf-api.jar
		# jsf-impl.jar
		targetdir="enterprise5/modules/ext/struts"
		dosyminstjar ${targetdir} antlr antlr.jar antlr-2.7.2.jar
		dosyminstjar ${targetdir} bsf-2.3 bsf.jar bsf-2.3.0.jar
		dosyminstjar ${targetdir} commons-beanutils-1.7 commons-beanutils.jar commons-beanutils-1.7.0.jar
		# commons-chain-1.1.jar
		dosyminstjar ${targetdir} commons-digester commons-digester.jar commons-digester-1.8.jar
		dosyminstjar ${targetdir} commons-fileupload commons-fileupload.jar commons-fileupload-1.1.1.jar
		dosyminstjar ${targetdir} commons-io-1 commons-io.jar commons-io-1.1.jar
		dosyminstjar ${targetdir} commons-logging commons-logging.jar commons-logging-1.0.4.jar
		dosyminstjar ${targetdir} commons-validator commons-validator.jar commons-validator-1.3.1.jar
		dosyminstjar ${targetdir} jakarta-jstl jstl.jar jstl-1.0.2.jar
		dosyminstjar ${targetdir} jakarta-jstl standard.jar standard-1.0.2.jar
		dosyminstjar ${targetdir} jakarta-oro-2.0 jakarta-oro.jar oro-2.0.8.jar
		# struts-core-1.3.8.jar
		# struts-el-1.3.8.jar
		# struts-extras-1.3.8.jar
		# struts-faces-1.3.8.jar
		# struts-mailreader-dao-1.3.8.jar
		# struts-scripting-1.3.8.jar
		# struts-taglib-1.3.8.jar
		# struts-tiles-1.3.8.jar
		targetdir="enterprise5/modules/ext/metro"
		# webservices-api.jar
		# webservices-extra.jar
		# webservices-extra-api.jar
		# webservices-rt.jar
		# webservices-tools.jar
		targetdir="/enterprise5/modules/ext/rest"
		dosyminstjar ${targetdir} asm-3 asm.jar asm-3.1.jar
		# grizzly-servlet-webserver-1.7.3.2.jar
		# http.jar - com.sun.net.httpserver - part of JavaSE 6
		dosyminstjar ${targetdir} jdom-1.0 jdom.jar jdom-1.0.jar
		# jersey.jar
		# jersey-spring.jar
		dosyminstjar ${targetdir} jettison jettison.jar jettison-1.0-RC1.jar
		dosyminstjar ${targetdir} jsr311-api jsr311-api.jar jsr311-api.jar
		dosyminstjar ${targetdir} rome rome.jar rome-0.9.jar
		# wadl2java.jar - atm do not know what to do with it
	fi

	# if use netbeans_modules_groovy ; then
		# groovy-all.jar - heavily repackaged
	# fi

	if use netbeans_modules_harness ; then
		targetdir="harness/antlib"
		dosyminstjar ${targetdir} javahelp jhall.jar jsearch-2.0_05.jar
		# openjdk-javac-6-b12.jar
		targetdir="harness/testcoverage/cobertura"
		# cobertura-1.9.jar
		targetdir="harness/testcoverage/cobertura/lib"
		dosyminstjar ${targetdir} asm-2.2 asm.jar asm-2.2.1.jar
		dosyminstjar ${targetdir} asm-2.2 asm-tree.jar asm-tree-2.2.1.jar
		dosyminstjar ${targetdir} jakarta-oro-2.0 jakarta-oro.jar jakarta-oro-2.0.8.jar
		dosyminstjar ${targetdir} log4j log4j.jar log4j-1.2.9.jar
	fi

	if use netbeans_modules_ide ; then
		targetdir="ide${IDE_VERSION}/modules/ext"
		# bytelist-0.1.jar
		dosyminstjar ${targetdir} commons-codec commons-codec.jar apache-commons-codec-1.3.jar
		dosyminstjar ${targetdir} commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.1.jar
		dosyminstjar ${targetdir} commons-lang-2.1 commons-lang.jar commons-lang-2.3.jar
		dosyminstjar ${targetdir} commons-logging commons-logging.jar commons-logging-1.1.jar
		dosyminstjar ${targetdir} commons-net commons-net.jar commons-net-1.4.1.jar
		dosyminstjar ${targetdir} flute flute.jar flute-1.3.jar
		# core-renderer.jar - flyingsaucer - system one causes deadlock
		dosyminstjar ${targetdir} freemarker-2.3 freemarker.jar freemarker-2.3.8.jar
		# ini4j-0.4.1.jar
		dosyminstjar ${targetdir} jakarta-oro-2.0 jakarta-oro.jar jakarta-oro-2.0.8.jar
		dosyminstjar ${targetdir} jdbc-mysql jdbc-mysql.jar mysql-connector-java-5.1.6-bin.jar
		dosyminstjar ${targetdir} jdbc-postgresql jdbc-postgresql.jar postgresql-8.3-603.jdbc3.jar
		dosyminstjar ${targetdir} jsch jsch.jar jsch-0.1.41.jar
		dosyminstjar ${targetdir} jvyamlb jvyamlb.jar jvyamlb-0.2.3.jar
		dosyminstjar ${targetdir} lucene-2.4 lucene-core.jar lucene-core-2.3.2.jar
		# org.eclipse.mylyn.bugzilla.core_3.0.5.jar
		# org.eclipse.mylyn.commons.core_3.0.5.jar
		# org.eclipse.mylyn.commons.net_3.0.5.jar
		# org.eclipse.mylyn.tasks.core_3.0.5.jar
		# org-mozilla-rhino-patched.jar - some patched stuff
		dosyminstjar ${targetdir} sac sac.jar sac-1.3.jar
		# smack.jar
		# smackx.jar
		# resolver-1.2.jar - probably patched apache resolver
		# svnClientAdapter-1.6.0.jar
		dosyminstjar ${targetdir} subversion svn-javahl.jar svnjavahl-1.6.0.jar
		# swingx-0.9.5.jar
		dosyminstjar ${targetdir} tomcat-servlet-api-2.2 servlet.jar servlet-2.2.jar
		# webserver.jar
		dosyminstjar ${targetdir} xerces-2 xercesImpl.jar xerces-2.8.0.jar
		targetdir="ide${IDE_VERSION}/modules/ext/jaxb"
		dosyminstjar ${targetdir} sun-jaf activation.jar activation.jar
		# jaxb-impl.jar
		# jaxb-xjc.jar
		targetdir="ide${IDE_VERSION}/modules/ext/jaxb/api"
		dosyminstjar ${targetdir} jaxb-2 jaxb-api.jar jaxb-api.jar
		dosyminstjar ${targetdir} jsr173 jsr173.jar jsr173_api.jar
	fi

	if use netbeans_modules_java ; then
		targetdir="java2/ant/etc"
		dosyminstjar ${targetdir} ant ant-bootstrap.jar ant-bootstrap.jar
		targetdir="java2/ant/nblib"
		# bridge.jar
		targetdir="java2/ant/patches"
		# 72080.jar
		targetdir="java2/modules"
		# org-apache-tools-ant-module.jar
		targetdir="java2/modules/ext"
		# appframework-1.0.3.jar
		dosyminstjar ${targetdir} beansbinding beansbinding.jar beansbinding-1.2.1.jar
		dosyminstjar ${targetdir} cglib-2.2 cglib.jar cglib-2.2.jar
		# javac-api-nb-7.0-b07.jar
		# javac-impl-nb-7.0-b07.jar
		dosyminstjar ${targetdir} jdom-1.0 jdom.jar jdom-1.0.jar
		# maven-dependency-tree-1.2.jar
		# maven-embedder-2.1-20080623-patched.jar
		# nexus-indexer-2.0.0-shaded.jar
		dosyminstjar ${targetdir} junit junit.jar junit-3.8.2.jar
		# swing-worker-1.1.jar
		targetdir="java2/modules/ext/jaxws21"
		dosyminstjar ${targetdir} fastinfoset fastinfoset.jar FastInfoset.jar
		# http.jar
		# jaxws-rt.jar
		# jaxws-tools.jar
		# mimepull.jar - atm do not know what to do with it
		dosyminstjar ${targetdir} saaj saaj.jar saaj-impl.jar
		dosyminstjar ${targetdir} sjsxp sjsxp.jar sjsxp.jar
		dosyminstjar ${targetdir} stax-ex stax-ex.jar stax-ex.jar
		dosyminstjar ${targetdir} xmlstreambuffer streambuffer.jar streambuffer.jar
		targetdir="java2/modules/ext/jaxws21/api"
		# jaxws-api.jar
		dosyminstjar ${targetdir} jsr250 jsr250.jar jsr250-api.jar
		dosyminstjar ${targetdir} jsr67 jsr67.jar saaj-api.jar
		dosyminstjar ${targetdir} jsr181 jsr181.jar jsr181-api.jar
		targetdir="java2/modules/ext/hibernate"
		dosyminstjar ${targetdir} antlr antlr.jar antlr-2.7.6.jar
		dosyminstjar ${targetdir} asm-2.2 asm.jar asm.jar
		dosyminstjar ${targetdir} asm-2.2 asm-attrs.jar asm-attrs.jar
		dosyminstjar ${targetdir} cglib-2.2 cglib.jar cglib-2.1.3.jar
		dosyminstjar ${targetdir} commons-collections commons-collections.jar commons-collections-2.1.1.jar
		dosyminstjar ${targetdir} dom4j-1 dom4j.jar dom4j-1.6.1.jar
		dosyminstjar ${targetdir} ehcache-1.2 ehcache.jar ehcache-1.2.3.jar
		dosyminstjar ${targetdir} glassfish-persistence glassfish-persistence.jar ejb3-persistence.jar
		dosyminstjar ${targetdir} glassfish-transaction-api jta.jar jta.jar
		dosyminstjar ${targetdir} hibernate-3.1 hibernate3.jar hibernate3.jar
		# hibernate-annotations.jar
		# hibernate-commons-annotations.jar
		# hibernate-entitymanager.jar
		# hibernate-tools.jar
		dosyminstjar ${targetdir} javassist-3 javassist.jar javassist.jar
		# jdbc2_0-stdext.jar - obsolete package
		dosyminstjar ${targetdir} jtidy Tidy.jar jtidy-r8-20060801.jar
		targetdir="java2/modules/ext/spring"
		# spring-2.5.jar
		targetdir="java2/modules/ext/toplink"
		# toplink-essentials.jar
		# toplink-essentials-agent.jar
	fi

	if use netbeans_modules_mobility ; then
		targetdir="mobility8/modules/ext"
		dosyminstjar ${targetdir} ant-contrib ant-contrib.jar ant-contrib-1.0b3.jar
		# cdc-agui-swing-layout.jar - atm do not know what to do with it
		# cdc-pp-awt-layout.jar - atm do not know what to do with it
		dosyminstjar ${targetdir} commons-codec commons-codec.jar commons-codec-1.3.jar
		dosyminstjar ${targetdir} commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.0.jar
		dosyminstjar ${targetdir} commons-httpclient-3 commons-httpclient.jar commons-httpclient-3.0.1.jar
		dosyminstjar ${targetdir} jakarta-slide-webdavclient jakarta-slide-webdavlib.jar jakarta-slide-webdavlib-2.1.jar
		# jakarta-slide-ant-webdav-2.1.jar - retired package
		dosyminstjar ${targetdir} jdom-1.0 jdom.jar jdom-1.0.jar
		# jmunit4cldc10-1.2.1.jar
		# jmunit4cldc11-1.2.1.jar
		# perseus-nb-1.0.jar
		# RicohAntTasks-2.0.jar
		targetdir="mobility8/external/proguard"
		dosyminstjar ${targetdir} proguard proguard.jar proguard4.2.jar
	fi

	if use netbeans_modules_php ; then
		targetdir="php1/modules/ext"
		dosyminstjar ${targetdir} javacup javacup.jar java-cup-11a.jar
	fi

	if use netbeans_modules_ruby ; then
		targetdir="ruby2/modules/ext"
		dosyminstjar ${targetdir} asm-3 asm.jar asm-3.0.jar
		dosyminstjar ${targetdir} asm-3 asm-analysis.jar asm-analysis-3.0.jar
		dosyminstjar ${targetdir} asm-3 asm-commons.jar asm-commons-3.0.jar
		dosyminstjar ${targetdir} asm-3 asm-tree.jar asm-tree-3.0.jar
		dosyminstjar ${targetdir} asm-3 asm-util.jar asm-util-3.0.jar
		# debug-commons-java-0.10.0.jar
		# dynalang-0.3.jar
		dosyminstjar ${targetdir} jline jline.jar jline-0.9.93.jar
		dosyminstjar ${targetdir} jna-posix jna-posix.jar jna-posix.jar
		dosyminstjar ${targetdir} joda-time joda-time.jar joda-time-1.5.1.jar
		dosyminstjar ${targetdir} joni joni.jar joni.jar
		# jruby-parser-0.1.jar
		# kxml2-2.3.0.jar
		dosyminstjar ${targetdir} jay yydebug.jar yydebug-1.0.2.jar
	fi

	if [ -n "${NB_DOSYMINSTJARFAILED}" ] ; then
		die "Some runtime jars could not be symlinked"
	fi
}

dosymcompilejar() {
	if [ -z "${JAVA_PKG_NB_BUNDLED}" ] ; then
		local dest="${1}"
		local package="${2}"
		local jar_file="${3}"
		local target_file="${4}"

		# We want to know whether the target jar exists and fail if it doesn't so we know
		# something is wrong
		local target="${S}/${dest}/${target_file}"
		if [ -e "${target}" ] ; then
			java-pkg_jar-from --build-only --into "${S}"/${dest} ${package} ${jar_file} ${target_file}
		else
			ewarn "Target jar does not exist so will not create link: ${target}"
			NB_DOSYMCOMPILEJARFAILED="1"
		fi
	fi
}

dosyminstjar() {
	if [ -z "${JAVA_PKG_NB_BUNDLED}" ] ; then
		local dest="${1}"
		local package="${2}"
		local jar_file="${3}"
		local target_file=""
		if [ -z "${4}" ]; then
			target_file="${3}"
		else
			target_file="${4}"
		fi

		# We want to know whether the target jar exists and fail if it doesn't so we know
		# something is wrong
		local source="/usr/share/${package}/lib/${jar_file}"
		if [ ! -e "${source}" ] ; then
			ewarn "Cannot link jar, ${source} does not exist!"
			NB_DOSYMINSTJARFAILED="1"
		fi

		local target="${DESTINATION}/${dest}/${target_file}"
		if [ -e "${D}/${target}" ] ; then
			dosym /usr/share/${package}/lib/${jar_file} ${target}
		else
			ewarn "Target jar does not exist so will not create link: ${D}/${target}"
			NB_DOSYMINSTJARFAILED="1"
		fi
	fi
}

filter_file() {
	local filter_file="${1}"
	local tmp_file="${2}"

	if [ -f "${filter_file}" ] ; then
		local adjusted=$(echo "${filter_file}" | sed -e "s%\\/%\\\/%g" | sed -e "s/\./\\\./g")
		sed -e "/${adjusted}/d" -i "${tmp_file}" || die
	else
		ewarn "File that should be kept does not exist: ${filter_file}"
		NB_FILTERFILESFAILED="1"
	fi
}