@@ -43,6 +43,8 @@ keep_list="${scriptdir}/slim-java_rtjar_keep.list"
43
43
del_list=" ${scriptdir} /slim-java_rtjar_del.list"
44
44
# jmod files to be deleted
45
45
del_jmod_list=" ${scriptdir} /slim-java_jmod_del.list"
46
+ # bin files to be deleted
47
+ del_bin_list=" ${scriptdir} /slim-java_bin_del.list"
46
48
47
49
# We only support 64 bit builds now
48
50
proc_type=" 64bit"
@@ -71,6 +73,16 @@ function parse_platform_specific() {
71
73
esac
72
74
}
73
75
76
+ # Which vm implementation are we running on at the moment.
77
+ function get_vm_impl() {
78
+ impl=" $( java -version | grep " OpenJ9" ) " ;
79
+ if [ ! -z " ${impl} " ]; then
80
+ echo " OpenJ9" ;
81
+ else
82
+ echo " Hotspot" ;
83
+ fi
84
+ }
85
+
74
86
# Strip debug symbols from the given jar file.
75
87
function strip_debug_from_jar() {
76
88
jar=$1
@@ -119,15 +131,22 @@ function jre_files() {
119
131
120
132
# Exclude the zOS specific charsets
121
133
function charset_files() {
134
+
135
+ # This optimization is only for Eclipse OpenJ9 at this time.
136
+ vm_impl=$( get_vm_impl) ;
137
+ if [ " ${vm_impl} " != " OpenJ9" ]; then
138
+ return ;
139
+ fi
140
+
122
141
# 2.3 Special treat for removing ZOS specific charsets
123
142
echo -n " INFO: Trimming charsets..."
124
143
mkdir -p ${root} /charsets_class
125
144
pushd ${root} /charsets_class > /dev/null
126
145
jar -xf ${root} /jre/lib/charsets.jar
127
146
ibmEbcdic=" 290 300 833 834 838 918 930 933 935 937 939 1025 1026 1046 1047 1097 1112 1122 1123 1364"
128
147
129
- # Generate slim -excludes-charsets list as well
130
- [ ! -e ${root} /jre/lib/slim/sun/nio/cs/ext/slim -excludes-charsets ] || rm -rf ${root} /jre/lib/slim /sun/nio/cs/ext/slim -excludes-charsets
148
+ # Generate sfj -excludes-charsets list as well. (OpenJ9 expects the file to be named sfj-excludes-charsets).
149
+ [ ! -e ${root} /jre/lib/slim/sun/nio/cs/ext/sfj -excludes-charsets ] || rm -rf ${root} /jre/lib/sfj /sun/nio/cs/ext/sfj -excludes-charsets
131
150
exclude_charsets=" "
132
151
133
152
for charset in ${ibmEbcdic} ;
@@ -138,8 +157,8 @@ function charset_files() {
138
157
exclude_charsets=" ${exclude_charsets} IBM${charset} "
139
158
done
140
159
mkdir -p $root /jre/lib/slim/sun/nio/cs/ext
141
- echo ${exclude_charsets} > ${root} /jre/lib/slim/sun/nio/cs/ext/slim -excludes-charsets
142
- cp ${root} /jre/lib/slim/sun/nio/cs/ext/slim -excludes-charsets sun/nio/cs/ext/
160
+ echo ${exclude_charsets} > ${root} /jre/lib/slim/sun/nio/cs/ext/sfj -excludes-charsets
161
+ cp ${root} /jre/lib/slim/sun/nio/cs/ext/sfj -excludes-charsets sun/nio/cs/ext/
143
162
144
163
jar -cfm ${root} /jre/lib/charsets.jar META-INF/MANIFEST.MF *
145
164
popd > /dev/null
@@ -230,6 +249,27 @@ function jmod_files() {
230
249
popd > /dev/null
231
250
}
232
251
252
+ # Remove unnecessary tools
253
+ function bin_files() {
254
+ echo -n " INFO: Trimming bin dir..."
255
+ pushd ${target} /bin > /dev/null
256
+ for binfile in $( cat ${del_bin_list} | grep -v " ^#" ) ;
257
+ do
258
+ rm -rf ${binfile}
259
+ done
260
+ popd > /dev/null
261
+ }
262
+
263
+ # Remove unnecessary tools and jars from lib dir
264
+ function lib_files() {
265
+ echo -n " INFO: Trimming bin dir..."
266
+ pushd ${target} /lib > /dev/null
267
+ rm -f ct.sym
268
+ rm -f jexec
269
+ rm -f tools.jar
270
+ popd > /dev/null
271
+ }
272
+
233
273
# Create a new target directory and copy over the source contents.
234
274
cd ${basedir}
235
275
mkdir -p ${target}
@@ -273,6 +313,12 @@ pushd ${target} >/dev/null
273
313
# Remove unnecessary jmod files
274
314
jmod_files
275
315
316
+ # Remove unnecessary tools and jars from lib dir
317
+ lib_files
318
+
319
+ # Remove unnecessary tools
320
+ bin_files
321
+
276
322
# Remove temp folders
277
323
rm -rf ${root} /jre/lib/slim ${src}
278
324
popd > /dev/null
0 commit comments