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
|
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.java.mk - Support for Java-based ports.
#
# Created by: Ernst de Haan <znerd@FreeBSD.org>
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to CVS yourself.
#
# $FreeBSD$
#
.if !defined(Java_Include)
Java_Include= bsd.java.mk
Java_Include_MAINTAINER= znerd@FreeBSD.org
#
# There are the following stages:
#
# Stage 1: Define constants
# Stage 2: Deal with JAVA_HOME if it is already set
# Stage 3: Determine which JDK ports are installed
# Stage 4: Determine which JDK ports are suitable
# Stage 5: Decide the exact JDK to use (or install)
# Stage 6: Define all settings for the port to use
# Stage 7: Add any dependencies if necessary
#
. if defined(USE_JAVA)
#-----------------------------------------------------------------------------
# Stage 1: Define constants
#
# System-global directories
JAVASHAREDIR?= ${PREFIX}/share/java
JAVAJARDIR?= ${JAVASHAREDIR}/classes
# The complete list of Java versions, os and vendors supported.
_JAVA_VERSIONS= 1.1 1.2 1.3 1.4
_JAVA_VERSIONS_ALL= ${_JAVA_VERSIONS} ${_JAVA_VERSIONS:S/$/+/}
_JAVA_OS_LIST= native linux
_JAVA_VENDORS= freebsd bsdjava sun blackdown ibm
# Set all meta-information about JDK ports:
# port location, corresponding JAVA_HOME, JDK version, OS, vendor
_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO= java/diablo-jdk13 ${LOCALBASE}/diablo-jdk1.3.1 1.3 native freebsd
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO= java/jdk11 ${LOCALBASE}/jdk1.1.8 1.1 native bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO= java/jdk12 ${LOCALBASE}/jdk1.2.2 1.2 native bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO= java/jdk13 ${LOCALBASE}/jdk1.3.1 1.3 native bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO= java/jdk14 ${LOCALBASE}/jdk1.4.2 1.4 native bsdjava
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO= java/linux-blackdown-jdk12 ${LOCALBASE}/linux-blackdown-jdk1.2.2 1.2 linux blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO= java/linux-blackdown-jdk13 ${LOCALBASE}/linux-blackdown-jdk1.3.1 1.3 linux blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO= java/linux-blackdown-jdk14 ${LOCALBASE}/linux-blackdown-jdk1.4.2 1.3 linux blackdown
_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO= java/linux-ibm-jdk13 ${LOCALBASE}/linux-ibm-jdk1.3.1 1.3 linux ibm
_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO= java/linux-ibm-jdk14 ${LOCALBASE}/linux-ibm-jdk1.4.1 1.4 linux ibm
_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO= java/linux-sun-jdk12 ${LOCALBASE}/linux-sun-jdk1.2.2 1.2 linux sun
_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO= java/linux-sun-jdk13 ${LOCALBASE}/linux-sun-jdk1.3.1 1.3 linux sun
_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO= java/linux-sun-jdk14 ${LOCALBASE}/linux-sun-jdk1.4.2 1.4 linux sun
_JAVA_VENDOR_freebsd= "FreeBSD Foundation"
_JAVA_VENDOR_bsdjava= "BSD Java Porting Team"
_JAVA_VENDOR_blackdown= Blackdown
_JAVA_VENDOR_ibm= IBM
_JAVA_VENDOR_sun= Sun
_JAVA_OS_native= Native
_JAVA_OS_linux= Linux
# Set the JAVA_HOME directories for all recognized JDK's
_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_1!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_NATIVE_FREEBSD_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_IBM_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_IBM_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_SUN_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_SUN_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO}" | ${AWK} '{ print $$2 }'
_JAVA_HOME_LINUX_SUN_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO}" | ${AWK} '{ print $$2 }'
# Set the JDK ports for all recognized JDK's
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_IBM_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_IBM_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_SUN_JDK_1_2!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_SUN_JDK_1_3!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO}" | ${AWK} '{ print $$1 }'
_JAVA_PORT_LINUX_SUN_JDK_1_4!= ${ECHO_CMD} "${_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO}" | ${AWK} '{ print $$1 }'
# Set the name of the file that indicates that a JDK is indeed installed, as a
# relative path within the JAVA_HOME directory.
_JDK_FILE=bin/javac
# Set the path to Jikes and define the Jikes dependency
_JIKES_PATH= ${LOCALBASE}/bin/jikes
_DEPEND_JIKES= ${_JIKES_PATH}:${PORTSDIR}/java/jikes
#-----------------------------------------------------------------------------
# Stage 2: Determine which JDK ports are installed
#
. undef _JAVA_PORTS_INSTALLED
. if exists(${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_1}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1
. endif
. if exists(${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_2}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2
. endif
. if exists(${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_3}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3
. endif
. if exists(${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_4}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
. endif
. if exists(${_JAVA_HOME_NATIVE_FREEBSD_JDK_1_3}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_NATIVE_FREEBSD_JDK_1_3
. endif
. if exists(${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_2}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2
. endif
. if exists(${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_3}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3
. endif
. if exists(${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_4}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4
. endif
. if exists(${_JAVA_HOME_LINUX_IBM_JDK_1_3}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_IBM_JDK_1_3
. endif
. if exists(${_JAVA_HOME_LINUX_IBM_JDK_1_4}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_IBM_JDK_1_4
. endif
. if exists(${_JAVA_HOME_LINUX_SUN_JDK_1_2}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_SUN_JDK_1_2
. endif
. if exists(${_JAVA_HOME_LINUX_SUN_JDK_1_3}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_SUN_JDK_1_3
. endif
. if exists(${_JAVA_HOME_LINUX_SUN_JDK_1_4}/${_JDK_FILE})
_JAVA_PORTS_INSTALLED+= JAVA_PORT_LINUX_SUN_JDK_1_4
. endif
#-----------------------------------------------------------------------------
# Stage 3: Deal with JAVA_HOME if it is already set
#
# See if JAVA_HOME points to a known JDK. If it does, then undefine JAVA_HOME
# and actually use JAVA_PORT instead, so that we do not screw with our
# dependencies.
. if defined(JAVA_HOME)
_JAVA_HOME= ${JAVA_HOME}
. undef(JAVA_HOME)
. if ${_JAVA_HOME} == ${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_1}
JAVA_PORT= ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_2}
JAVA_PORT= ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_3}
JAVA_PORT= ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_NATIVE_BSDJAVA_JDK_1_4}
JAVA_PORT= ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_NATIVE_FREEBSD_JDK_1_3}
JAVA_PORT= ${_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_2}
JAVA_PORT= ${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_3}
JAVA_PORT= ${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_BLACKDOWN_JDK_1_4}
JAVA_PORT= ${_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_IBM_JDK_1_3}
JAVA_PORT= ${_JAVA_PORT_LINUX_IBM_JDK_1_3}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_IBM_JDK_1_4}
JAVA_PORT= ${_JAVA_PORT_LINUX_IBM_JDK_1_4}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_SUN_JDK_1_2}
JAVA_PORT= ${_JAVA_PORT_LINUX_SUN_JDK_1_2}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_SUN_JDK_1_3}
JAVA_PORT= ${_JAVA_PORT_LINUX_SUN_JDK_1_3}
. elif ${_JAVA_HOME} == ${_JAVA_HOME_LINUX_SUN_JDK_1_4}
JAVA_PORT= ${_JAVA_PORT_LINUX_SUN_JDK_1_4}
. else
JAVA_HOME= ${_JAVA_HOME}
. endif
. endif
#-----------------------------------------------------------------------------
# Stage 4: Determine which JDK ports are suitable
#
# First detect if we are using bsd.java.mk v1.0
_USE_BSD_JAVA_MK_1_0!= ${ECHO_CMD} "${_JAVA_VERSIONS_ALL}" \
| ${TR} " " "\n" \
| ${GREP} -q "^${USE_JAVA}$$" && ${ECHO_CMD} "yes" || ${ECHO_CMD} "no"
. if (${_USE_BSD_JAVA_MK_1_0} == "yes") && !defined(JAVA_VERSION)
# Then affect the variables so that we may use v2.0
JAVA_VERSION= ${USE_JAVA}
. endif
# From here, the port is using bsd.java.mk v2.0
# List JDK ports by version
_JAVA_PORTS_1_4= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
JAVA_PORT_LINUX_SUN_JDK_1_4 \
JAVA_PORT_LINUX_IBM_JDK_1_4
_JAVA_PORTS_1_3= JAVA_PORT_NATIVE_FREEBSD_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_IBM_JDK_1_3
_JAVA_PORTS_1_2= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_SUN_JDK_1_2
_JAVA_PORTS_1_1= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1
# List JDK ports by OS
_JAVA_PORTS_NATIVE= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
JAVA_PORT_NATIVE_FREEBSD_JDK_1_3
_JAVA_PORTS_LINUX= JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
JAVA_PORT_LINUX_IBM_JDK_1_3 \
JAVA_PORT_LINUX_IBM_JDK_1_4 \
JAVA_PORT_LINUX_SUN_JDK_1_2 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_4
# List JDK ports by vendor
_JAVA_PORTS_FREEBSD= JAVA_PORT_NATIVE_FREEBSD_JDK_1_3
_JAVA_PORTS_BSDJAVA= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
_JAVA_PORTS_BLACKDOWN= JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4
_JAVA_PORTS_SUN= JAVA_PORT_LINUX_SUN_JDK_1_2 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_4
_JAVA_PORTS_IBM= JAVA_PORT_LINUX_IBM_JDK_1_3 \
JAVA_PORT_LINUX_IBM_JDK_1_4
# List all JDK ports
_JAVA_PORTS_ALL= ${_JAVA_PORTS_1_1} \
${_JAVA_PORTS_1_2} \
${_JAVA_PORTS_1_3} \
${_JAVA_PORTS_1_4}
# Build the list of possible JDK ports by version
. if defined(JAVA_VERSION)
_JAVA_VERSION= ${JAVA_VERSION:S/1.1+/1.1 1.2 1.3 1.4/:S/1.2+/1.2 1.3 1.4/:S/1.3+/1.3 1.4/:S/1.4+/1.4/}
. undef(_JAVA_PORTS_BY_VERSION)
. if ${_JAVA_VERSION:M1.1} == "1.1"
_JAVA_PORTS_BY_VERSION+= ${_JAVA_PORTS_1_1}
. endif
. if ${_JAVA_VERSION:M1.2} == "1.2"
_JAVA_PORTS_BY_VERSION+= ${_JAVA_PORTS_1_2}
. endif
. if ${_JAVA_VERSION:M1.3} == "1.3"
_JAVA_PORTS_BY_VERSION+= ${_JAVA_PORTS_1_3}
. endif
. if ${_JAVA_VERSION:M1.4} == "1.4"
_JAVA_PORTS_BY_VERSION+= ${_JAVA_PORTS_1_4}
. endif
. if !defined(_JAVA_PORTS_BY_VERSION)
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: \"${JAVA_VERSION}\" is not a valid value for JAVA_VERSION. It should be one or more of: ${_JAVA_VERSIONS} (with an optional \"+\" suffix.)";
@${FALSE}
. endif
. else
_JAVA_PORTS_BY_VERSION= ${_JAVA_PORTS_ALL}
. endif
# Build the list of possible JDK ports by OS
. if defined(JAVA_OS)
. undef(_JAVA_PORTS_BY_OS)
. if ${JAVA_OS:Mnative} == "native"
_JAVA_PORTS_BY_OS+= ${_JAVA_PORTS_NATIVE}
. endif
. if ${JAVA_OS:Mlinux} == "linux"
_JAVA_PORTS_BY_OS+= ${_JAVA_PORTS_LINUX}
. endif
. if !defined(_JAVA_PORTS_BY_OS)
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: \"${JAVA_OS}\" is not a valid value for JAVA_OS. It should be one or more of: ${_JAVA_OS_LIST}";
@${FALSE}
. endif
. else
_JAVA_PORTS_BY_OS= ${_JAVA_PORTS_ALL}
. endif
# Build the list of possible JDK ports by vendor
. if defined(JAVA_VENDOR)
. undef(_JAVA_PORTS_BY_VENDOR)
. if ${JAVA_VENDOR:Mfreebsd} == "freebsd"
_JAVA_PORTS_BY_VENDOR+= ${_JAVA_PORTS_FREEBSD}
. endif
. if ${JAVA_VENDOR:Mbsdjava} == "bsdjava"
_JAVA_PORTS_BY_VENDOR+= ${_JAVA_PORTS_BSDJAVA}
. endif
. if ${JAVA_VENDOR:Mblackdown} == "blackdown"
_JAVA_PORTS_BY_VENDOR+= ${_JAVA_PORTS_BLACKDOWN}
. endif
. if ${JAVA_VENDOR:Msun} == "sun"
_JAVA_PORTS_BY_VENDOR+= ${_JAVA_PORTS_SUN}
. endif
. if ${JAVA_VENDOR:Mibm} == "ibm"
_JAVA_PORTS_BY_VENDOR+= ${_JAVA_PORTS_IBM}
. endif
. if !defined(_JAVA_PORTS_BY_VENDOR)
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: \"${JAVA_VENDOR}\" is not a valid value for JAVA_VENDOR. It should be one or more of: ${_JAVA_VENDORS}";
@${FALSE}
. endif
. else
_JAVA_PORTS_BY_VENDOR= ${_JAVA_PORTS_ALL}
. endif
_MY_JAVA_PORTS:= ${_JAVA_PORTS_ALL:S/^/\${_/:S/$/_INFO} @ /}
# Build the list of possible JDK ports by version, OS and vendor
_JAVA_PORTS_BY_VERSION!= ${ECHO_CMD} "${_JAVA_PORTS_BY_VERSION}" | ${TR} " " "\n" | ${SORT} | /usr/bin/uniq
_JAVA_PORTS_BY_OS!= ${ECHO_CMD} "${_JAVA_PORTS_BY_OS}" | ${TR} " " "\n" | ${SORT} | /usr/bin/uniq
_JAVA_PORTS_BY_VENDOR!= ${ECHO_CMD} "${_JAVA_PORTS_BY_VENDOR}" | ${TR} " " "\n" | ${SORT} | /usr/bin/uniq
_JAVA_PORTS_POSSIBLE!= ${ECHO_CMD} "${_JAVA_PORTS_BY_VERSION} ${_JAVA_PORTS_BY_OS} ${_JAVA_PORTS_BY_VENDOR}" \
| ${TR} " " "\n" \
| ${SORT} -r \
| /usr/bin/uniq -c \
| ${SED} "s/^\( *\)//" \
| ${GREP} "^3 " \
| ${AWK} '{ print $$2 }'
#-----------------------------------------------------------------------------
# Stage 5: Decide the exact JDK to use (or install)
#
# Find an installed JDK port that matches the requirements of the port
_JAVA_PORTS_INSTALLED_POSSIBLE!= ${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE} ${_JAVA_PORTS_INSTALLED}" \
| ${TR} " " "\n" \
| ${SORT} -r \
| /usr/bin/uniq -c \
| ${SED} "s/^\( *\)//" \
| ${GREP} "^2 " \
| ${AWK} '{ print $$2 }'
. if ${_JAVA_PORTS_INSTALLED_POSSIBLE} != ""
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_INSTALLED_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
# If no installed JDK port fits, then pick one from the list of possible ones
. else
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
. endif
_JAVA_PORT_INFO:= ${_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORT_INFO}" | ${AWK} '{ print $$1 }'
JAVA_HOME!= ${ECHO_CMD} "${_JAVA_PORT_INFO}" | ${AWK} '{ print $$2 }'
JAVA_PORT_VERSION!= ${ECHO_CMD} "${_JAVA_PORT_INFO}" | ${AWK} '{ print $$3 }'
JAVA_PORT_OS!= ${ECHO_CMD} "${_JAVA_PORT_INFO}" | ${AWK} '{ print $$4 }'
JAVA_PORT_VENDOR!= ${ECHO_CMD} "${_JAVA_PORT_INFO}" | ${AWK} '{ print $$5 }'
JAVA_PORT_VENDOR_DESCRIPTION:= ${JAVA_PORT_VENDOR:S/^/\${_JAVA_VENDOR_/:S/$/}/}
JAVA_PORT_OS_DESCRIPTION:= ${JAVA_PORT_OS:S/^/\${_JAVA_OS_/:S/$/}/}
# Debug target
# (will probably get removed in the final version)
java-debug:
@${ECHO_CMD} "_USE_BSD_JAVA_MK_1_0= ${_USE_BSD_JAVA_MK_1_0}"
@${ECHO_CMD}
@${ECHO_CMD} "# User specified parameters:"
@${ECHO_CMD} "JAVA_VERSION= ${JAVA_VERSION} (${_JAVA_VERSION})"
@${ECHO_CMD} "JAVA_OS= ${JAVA_OS}"
@${ECHO_CMD} "JAVA_VENDOR= ${JAVA_VENDOR}"
@${ECHO_CMD}
@${ECHO_CMD} "# JDK port dependency selection process:"
@${ECHO_CMD} "_JAVA_PORTS_POSSIBLE= ${_JAVA_PORTS_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED= ${_JAVA_PORTS_INSTALLED}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED_POSSIBLE= ${_JAVA_PORTS_INSTALLED_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORT= ${_JAVA_PORT}"
@${ECHO_CMD} "_JAVA_PORT_INFO= ${_JAVA_PORT_INFO:S/\t/ /}"
@${ECHO_CMD}
@${ECHO_CMD} "# Selected JDK port:"
@${ECHO_CMD} "JAVA_PORT= ${JAVA_PORT}"
@${ECHO_CMD} "JAVA_HOME= ${JAVA_HOME}"
@${ECHO_CMD} "JAVA_PORT_VERSION= ${JAVA_PORT_VERSION}"
@${ECHO_CMD} "JAVA_PORT_OS= ${JAVA_PORT_OS} (${JAVA_PORT_OS_DESCRIPTION})"
@${ECHO_CMD} "JAVA_PORT_VENDOR= ${JAVA_PORT_VENDOR} (${JAVA_PORT_VENDOR_DESCRIPTION})"
#-----------------------------------------------------------------------------
# Stage 6: Define all settings for the port to use
# At this stage both JAVA_HOME and JAVA_PORT are definitely given a value.
# Define the location of the Java compiler. If USE_JIKES is set to YES, then
# use Jikes. If USE_JIKES is set to NO, then don't use it. If it is set to a
# different value, then fail with an error message. Otherwise USE_JIKES is not
# set, in which case it is checked if Jikes is already installed. If it is,
# then it will be used, otherwise it will not be used.
# Only define JAVAC if NEED_JAVAC is defined
. undef JAVAC
# The default value for NEED_JAVAC is temporarily (!) YES
# This will change as soon as the affecting ports have NEED_JAVAC=YES
. if !defined(NEED_JAVAC)
NEED_JAVAC= NO
. endif
. if (${NEED_JAVAC} == "YES") || (${NEED_JAVAC} == "yes")
. if defined(USE_JIKES)
. if (${USE_JIKES} == "YES") || (${USE_JIKES} == "yes")
JAVAC= ${_JIKES_PATH}
WITH_JIKES= YES
. elif !((${USE_JIKES} == "NO") || (${USE_JIKES} == "no"))
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
. elif exists(${_JIKES_PATH}) && !defined(NO_BUILD)
JAVAC= ${_JIKES_PATH}
WITH_JIKES= YES
. endif
. if !defined(JAVAC)
JAVAC= ${JAVA_HOME}/bin/javac
. endif
. endif
# Define the location of some more executables.
APPLETVIEWER= ${JAVA_HOME}/bin/appletviewer
JAR= ${JAVA_HOME}/bin/jar
JAVA= ${JAVA_HOME}/bin/java
JAVADOC= ${JAVA_HOME}/bin/javadoc
JAVAH= ${JAVA_HOME}/bin/javah
JAVAP= ${JAVA_HOME}/bin/javap
JAVA_N2A= ${JAVA_HOME}/bin/native2ascii
JAVA_SERIALVER= ${JAVA_HOME}/bin/serialver
RMIC= ${JAVA_HOME}/bin/rmic
RMIREGISTRY= ${JAVA_HOME}/bin/rmiregistry
# Some executables only exists in JDK 1.2 and up
. if ${JAVA_PORT} != ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1}
JAVA_KEYTOOL= ${JAVA_HOME}/bin/keytool
JAVA_POLICYTOOL= ${JAVA_HOME}/bin/policytool
RMID= ${JAVA_HOME}/bin/rmid
. endif
# Set the location of the ZIP or JAR file with all standard Java classes.
. if ${JAVA_PORT} == ${_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1}
JAVA_CLASSES= ${JAVA_HOME}/lib/classes.zip
. else
JAVA_CLASSES= ${JAVA_HOME}/jre/lib/rt.jar
. endif
#-----------------------------------------------------------------------------
# Stage 7: Add any dependencies if necessary
# Possibly add Jikes to the dependencies
. if defined(JAVAC) && (${JAVAC} == ${_JIKES_PATH})
. if !defined(NO_BUILD_DEPENDS_JAVA)
BUILD_DEPENDS+= ${_DEPEND_JIKES}
. endif
. if !defined(NO_RUN_DEPENDS_JAVA)
RUN_DEPENDS+= ${_DEPEND_JIKES}
. endif
. endif
# Add the JDK port to the dependencies
. if defined(NO_BUILD_DEPENDS_JAVA) && defined(NO_RUN_DEPENDS_JAVA)
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time.";
@${FALSE}
. endif
. if defined(JAVA_BUILD) && defined(NO_BUILD)
.BEGIN:
@${ECHO_CMD} "${PKGNAME}: JAVA_BUILD and NO_BUILD cannot be set at the same time.";
@${FALSE}
. endif
_DEPEND_JAVA= ${JAVA}:${PORTSDIR}/${JAVA_PORT}
. if !defined(JAVA_EXTRACT) && !defined(JAVA_BUILD) && !defined(JAVA_RUN)
# In general, an EXTRACT_DEPENDS on java is not wanted, so only
# automatically set up BUILD_DEPENDS and RUN_DEPENDS
. if !defined(NO_BUILD_DEPENDS_JAVA) && !defined(NO_BUILD)
BUILD_DEPENDS+= ${_DEPEND_JAVA}
. endif
. if !defined(NO_RUN_DEPENDS_JAVA)
RUN_DEPENDS+= ${_DEPEND_JAVA}
. endif
. else
. if defined(JAVA_EXTRACT)
EXTRACT_DEPENDS+= ${_DEPEND_JAVA}
. endif
. if defined(JAVA_BUILD)
BUILD_DEPENDS+= ${_DEPEND_JAVA}
. endif
. if defined(JAVA_RUN)
RUN_DEPENDS+= ${_DEPEND_JAVA}
. endif
. endif
. endif
.endif
|