aboutsummaryrefslogtreecommitdiffstats
path: root/java/jdk15/Makefile
blob: 18ba5d312809ea4074a95c25ddc70cad3baba3b4 (plain) (blame)
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
# New ports collection makefile for:    jdk15
# Date created:             12 January 2005
# Whom:                 Alexey Zelkin <phantom@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   jdk
PORTVERSION=    ${JDK_VERSION}.${JDK_UPDATE_VERSION}p${JDK_PATCHSET_VERSION}
PORTREVISION=   15
PORTEPOCH=  1
CATEGORIES= java devel
MASTER_SITES=   # http://download.java.net/tiger/
#        http://www.eyesbeyond.com/freebsddom/java/jdk15.html
#        http://java.sun.com/javase/downloads/index.jsp
DISTFILES=  ${JRL_SRCFILE} ${JRL_BINFILE} ${PATCHSETFILE}
EXTRACT_ONLY=   ${JRL_SRCFILE} ${JRL_BINFILE}

MAINTAINER= glewis@FreeBSD.org
COMMENT=    Java Development Kit 1.5.0

BUILD_DEPENDS=  gm4:${PORTSDIR}/devel/m4 \
        zip:${PORTSDIR}/archivers/zip \
        ${LOCALBASE}/lib/libXm.so:${PORTSDIR}/x11-toolkits/open-motif
RUN_DEPENDS=    javavm:${PORTSDIR}/java/javavmwrapper

OPTIONS=    DEBUG   "Enable debugging support"  off \
        IPV6    "Enable IPv6 support"       off \
        WEB "Enable the browser plugin and Java Web Start"  on \
        POLICY  "Install the Unlimited Strength Policy Files"   off \
        TZUPDATE    "Update the time zone data"     on \
        JAIL    "Port is being built within a jail"     off

WANT_GNOME= yes
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL=   ${WRKDIR}/pkg-deinstall
SUB_FILES+= pkg-install \
        pkg-deinstall
SUB_LIST+=  JRE_HOME=${PREFIX}/jdk${JDK_VERSION}/jre \
        ARCH=${MACHINE_ARCH}

WRKSRC=     ${WRKDIR}/control/make

USE_ZIP=    yes
MAKE_JOBS_UNSAFE=   yes
IS_INTERACTIVE= yes

JRL_SRCFILE=    jdk-${JDK_VERSION:S/./_/g}_${JDK_UPDATE_VERSION}-fcs-src-b${JDK_BUILD_NUMBER}-jrl-${JDK_BUILD_DATE}.jar
JRL_BINFILE=    jdk-${JDK_VERSION:S/./_/g}_${JDK_UPDATE_VERSION}-fcs-bin-b${JDK_BUILD_NUMBER}-jrl-${JDK_BUILD_DATE}.jar
PATCHSETFILE=   bsd-jdk15-patches-${JDK_PATCHSET_VERSION}.tar.bz2
POLICYFILE= jce_policy-${JDK_VERSION:S/./_/g}.zip
TZUPDATEFILE=   tzupdater-${TZUPDATE_VERSION}-${TZUPDATE_TZVERSION}.zip

JDK_VERSION=    1.5.0
JDK_UPDATE_VERSION= 16
JDK_PATCHSET_VERSION=   9
JDK_BUILD_NUMBER=   02
JDK_BUILD_DATE=     28_may_2008
LATEST_LINK=    jdk15

TZUPDATE_VERSION=   1_3_39
TZUPDATE_TZVERSION= 2011g

.include <bsd.port.pre.mk>

.if !defined(WITH_LINUX_BOOTSTRAP)
NATIVE_BOOTSTRAP_JDKS=  ${LOCALBASE}/diablo-jdk1.6.0 \
            ${LOCALBASE}/diablo-jdk1.5.0 \
            ${LOCALBASE}/jdk1.5.0 \
            ${LOCALBASE}/jdk1.6.0 \
            ${LOCALBASE}/jdk1.4.2
.endif

LINUX_BOOTSTRAP_JDKS=   ${LOCALBASE}/linux-sun-jdk1.5.0 \
            ${LOCALBASE}/linux-sun-jdk1.6.0 \
            ${LOCALBASE}/linux-sun-jdk1.4.2

.if defined(WITH_IPV6)
CATEGORIES+=    ipv6
.endif

.if defined(WITH_POLICY)
DISTFILES+= ${POLICYFILE}
EXTRACT_ONLY+=  ${POLICYFILE}
.endif

.if defined(WITH_TZUPDATE)
DISTFILES+= ${TZUPDATEFILE}
EXTRACT_ONLY+=  ${TZUPDATEFILE}
.endif

# do we have valid native jdk installed?
.if !defined(WITH_LINUX_BOOTSTRAP)
.for CJDK in ${NATIVE_BOOTSTRAP_JDKS}
.  if !defined(BOOTSTRAPJDKDIR) && exists(${CJDK}/bin/javac)
BOOTSTRAPJDKDIR=    ${CJDK}
.  endif
.endfor
.endif

# do we have valid linux jdk installed?
.if !defined(BOOTSTRAPJDKDIR)
.for CJDK in ${LINUX_BOOTSTRAP_JDKS}
.  if !defined(BOOTSTRAPJDKDIR) && exists(${CJDK}/bin/javac)
BOOTSTRAPJDKDIR=    ${CJDK}
WITH_LINUX_BOOTSTRAP=   YES
.  endif
.endfor
.endif

# if no valid jdk found, set dependency
.if !defined(BOOTSTRAPJDKDIR) || !exists(${BOOTSTRAPJDKDIR}/bin/javac)
BOOTSTRAPJDKDIR=    ${LOCALBASE}/diablo-jdk1.6.0
BUILD_DEPENDS+=     ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/diablo-jdk16
.endif

.if defined(WITHOUT_WEB)
MAKE_ENV+=  DONT_BUILD_DEPLOY="YES"
.else
USE_GNOME=  desktopfileutils
LIB_DEPENDS=    nspr4.1:$(PORTSDIR)/devel/nspr
.endif

ONLY_FOR_ARCHS= i386 amd64
USE_GMAKE=  YES
USE_ICONV=  YES
USE_XORG+=  x11 xext xi xmu xp xt xtst xft
RESTRICTED= Redistribution of pre-compiled binaries is not permitted
NO_CDROM=   Redistribution of pre-compiled binaries is not permitted

MAKE_ENV+=  ALT_BOOTDIR="${BOOTSTRAPJDKDIR}" \
        ALT_MOTIF_DIR="${LOCALBASE}" \
        X11DIR="${LOCALBASE}" \
        LOCALDIR="${LOCALBASE}" \
        DEFAULT_LD_LIBRARY_PATH="/usr/lib:${LOCALBASE}/lib" \
        SYS_CFLAGS="${CFLAGS}" \
        LANG="C" \
        JAVA_HOME="" \
        CLASSPATH="" \
        LD_LIBRARY_PATH="" \
        MAKEFLAGS="" \
        SKIP_COMPARE_IMAGES="YES"
.if !defined(WITH_IPV6)
MAKE_ENV+=  DONT_ENABLE_IPV6="YES"
.endif

.if !defined(DISABLE_MAKE_JOBS)
.if defined(MAKE_JOBS_NUMBER)
BUILD_JOBS_NUMBER=  ${MAKE_JOBS_NUMBER}
.else
BUILD_JOBS_NUMBER=  `${SYSCTL} -n kern.smp.cpus`
.endif
MAKE_ENV+=  HOTSPOT_BUILD_JOBS=${BUILD_JOBS_NUMBER}
.endif

ALL_TARGET= all

PLIST_FILES=    jdk${JDK_VERSION}/jre/.systemPrefs/.system.lock \
        jdk${JDK_VERSION}/jre/.systemPrefs/.systemRootModFile
.if !defined(WITHOUT_WEB)
PLIST_FILES+=   share/applications/sun_java15.desktop
.endif
PLIST_DIRS= jdk${JDK_VERSION}/jre/.systemPrefs

.if (${ARCH} == amd64)
HOTSPOTARCH=amd64
.else
HOTSPOTARCH=i586
.endif

JDKIMAGEDIR=    ${WRKSRC}/../build/bsd-${HOTSPOTARCH}/j2sdk-image
JDKIMAGEDIR_G=  ${WRKSRC}/../build/bsd-${HOTSPOTARCH}/j2sdk-debug-image

PTHREAD_FILES=  ../../hotspot/build/bsd/makefiles/vm.make \
        ../../j2se/make/com/sun/java/pack/Makefile \
        ../../j2se/make/common/Defs.gmk \
        ../../j2se/make/common/Defs-bsd.gmk \
        ../../j2se/make/common/Program.gmk \
        ../../j2se/make/java/hpi/native/Makefile \
        ../../j2se/make/java/net/Makefile \
        ../../j2se/make/java/nio/Makefile \
        ../../j2se/make/jpda/transport/socket/Makefile \
        ../../j2se/make/sun/cmm/Makefile \
        ../../j2se/make/sun/xawt/Makefile
X11_FILES=  ../../j2se/make/sun/motif21/Makefile \
        ../../j2se/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java \
        ../../j2se/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java

# Check for JDK sources and patch file
.if !defined(PACKAGE_BUILDING) && (!exists(${DISTDIR}/${JRL_SRCFILE}) || !exists(${DISTDIR}/${JRL_BINFILE}) || (defined(WITH_POLICY) && !exists(${DISTDIR}/${POLICYFILE})) || (defined(WITH_TZUPDATE) && !exists(${DISTDIR}/${TZUPDATEFILE})) || !exists(${DISTDIR}/${PATCHSETFILE}))#{
DISTFILE_INSTRUCTIONS=\n\
Due to licensing restrictions, certain files must be fetched manually.\n\n
.if !exists(${DISTDIR}/${JRL_SRCFILE}) || !exists(${DISTDIR}/${JRL_BINFILE})#{
DISTFILE_INSTRUCTIONS += Please open http://download.java.net/tiger/\n\
in a web browser.  Download the\n
.if !exists(${DISTDIR}/${JRL_SRCFILE})#{
DISTFILE_INSTRUCTIONS += Update ${JDK_UPDATE_VERSION} Source, ${JRL_SRCFILE}
.endif#}
.if !exists(${DISTDIR}/${JRL_BINFILE})#{
.if !exists(${DISTDIR}/${JRL_SRCFILE})#{
DISTFILE_INSTRUCTIONS += and the\n
.endif#}
DISTFILE_INSTRUCTIONS += Source Binaries, ${JRL_BINFILE}
.endif#}
DISTFILE_INSTRUCTIONS += .\n\n
.endif#}
.if defined(WITH_POLICY) && !exists(${DISTDIR}/${POLICYFILE})#{
DISTFILE_INSTRUCTIONS += Please open http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html\n\
in a web browser and follow the \"Download\" link for\n\
\"Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy\n\
Files 5.0\" to obtain the JCE policy file, ${POLICYFILE}.\n\n
.endif#}
.if defined(WITH_TZUPDATE) && !exists(${DISTDIR}/${TZUPDATEFILE})#{
DISTFILE_INSTRUCTIONS += Please open http://www.oracle.com/technetwork/java/javase/downloads/index.html\n\
in a web browser and follow the \"Download\" link for\n\
\"JDK DST Timezone Update Tool - ${TZUPDATE_VERSION}\" to obtain the\n\
time zone update file, ${TZUPDATEFILE}.\n\n
.endif#}
.if !exists(${DISTDIR}/${PATCHSETFILE})#{
DISTFILE_INSTRUCTIONS += Please download the patchset, ${PATCHSETFILE}, from\n\
http://www.eyesbeyond.com/freebsddom/java/jdk15.html.\n\n
.endif#}
DISTFILE_INSTRUCTIONS += Please place the downloaded file(s) in ${DISTDIR}
DISTFILE_INSTRUCTIONS += \n and restart the build.\n\n
.endif#}

pre-fetch:
    @${ECHO_MSG}
    @${ECHO_MSG} "IMPORTANT: To build the JDK 1.5.0 port, you should have at least"
    @${ECHO_MSG} "2.5Gb of free disk space in the build area!"
    @${ECHO_MSG}
.if defined(WITH_LINUX_BOOTSTRAP)
    @${ECHO_MSG} "IMPORTANT: To build the JDK 1.5.0 port, you should have linux emulation"
    @${ECHO_MSG} "enabled in the kernel and the linux procfs (linprocfs) filesystem"
    @${ECHO_MSG} "mounted."
    @${ECHO_MSG}
.endif
.if defined(DISTFILE_INSTRUCTIONS)
    @${PRINTF} "${DISTFILE_INSTRUCTIONS}"
    @exit 1
.endif

# Get JRL agreement
.if !defined(PACKAGE_BUILDING)
pre-extract:
    ${SH} ${FILESDIR}/license.sh
.endif

# Extract the files
do-extract:
    @${RM} -rf ${WRKDIR}
    @${MKDIR} ${WRKDIR}
    @${CC} ${CFLAGS} -o ${WRKDIR}/x_x2zip ${FILESDIR}/x_x2zip.c
    @for file in ${EXTRACT_ONLY}; do \
        if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} "${DISTDIR}/$$file" ${EXTRACT_AFTER_ARGS}); \
        then \
            exit 1; \
        fi; \
        if [ `basename $$file .jar` != $$file ]; \
        then \
            if ! (cd ${WRKDIR} && ${WRKDIR}/x_x2zip 'YES I ACCEPT THE CLICK THROUGH LICENSE.  ' X_X && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${WRKDIR}/X_X.zip ${EXTRACT_AFTER_ARGS}); \
            then \
                exit 1; \
            fi; \
        fi \
    done

post-extract:
    cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
        j2se/make/tools/crypto/pkcs11/sunpkcs11_src.zip \
        ${EXTRACT_AFTER_ARGS}
    -${MKDIR} ${WRKDIR}/j2se/make/sun/security
    -${MKDIR} ${WRKDIR}/j2se/src/share/classes/sun/security
    -${MKDIR} ${WRKDIR}/j2se/src/share/native/sun/security
    -${MKDIR} ${WRKDIR}/j2se/src/solaris/native/sun/security
    ${MV} ${WRKDIR}/make/sun/security/pkcs11 \
        ${WRKDIR}/j2se/make/sun/security/pkcs11
    ${MV} ${WRKDIR}/src/share/classes/sun/security/pkcs11 \
        ${WRKDIR}/j2se/src/share/classes/sun/security/pkcs11
    ${MV} ${WRKDIR}/src/share/native/sun/security/pkcs11 \
        ${WRKDIR}/j2se/src/share/native/sun/security/pkcs11
    ${MV} ${WRKDIR}/src/solaris/native/sun/security/pkcs11 \
        ${WRKDIR}/j2se/src/solaris/native/sun/security/pkcs11
    cd ${WRKDIR} && ${RM} -rf src

pre-patch:
    @cd ${WRKDIR} &&  \
        ${BZIP2_CMD} -dc ${DISTDIR}/${PATCHSETFILE} | ${TAR} -xf - && \
        ${CHMOD} -R u+w * && \
        ${PATCH} -p0 < ${WRKDIR}/jdk15.patches

post-patch:
    @for file in ${PTHREAD_FILES}; do \
        ${REINPLACE_CMD} -e "s:-pthread:${PTHREAD_LIBS}:g" \
            ${WRKSRC}/$${file}; \
    done
    @for file in ${X11_FILES}; do \
        ${REINPLACE_CMD} -e "s:%%LOCALBASE%%:${LOCALBASE}:" \
            ${WRKSRC}/$${file}; \
    done
    @${REINPLACE_CMD} -e "s:%%PREFIX%%:${PREFIX}:g" \
        -e "s:%%JDK_VERSION%%:${JDK_VERSION}:g"\
        ${WRKSRC}/../../deploy/src/plugin/solaris/controlpanel/sun_java.desktop
    @${REINPLACE_CMD} -e "s:%%OSVERSION%%:${OSVERSION}:g" \
        ${WRKSRC}/../../j2se/make/common/Defs-bsd.gmk

.if defined(WITH_LINUX_BOOTSTRAP)
pre-build:
    @if [ "$${WRKDIRPREFIX}" -a \
         -L "/compat/linux/$${WRKDIRPREFIX}" -a \
         x`${LS} -ld "/compat/linux/$${WRKDIRPREFIX}" 2>/dev/null | ${AWK} '/->/{print $$NF;exit 0}END{exit 1}'` = x"$${WRKDIRPREFIX}" ]; \
    then \
        ${ECHO_MSG} "Please set WRKDIRPREFIX to something which doesn't"; \
        ${ECHO_MSG} "have a matching symbolic link in /compat/linux."; \
        ${ECHO_MSG} "This is known to cause problems during bootstrapping."; \
        exit 1; \
    fi
    @if [ `${SYSCTL} -n compat.linux.osname` != "Linux" ]; \
    then \
        ${ECHO_MSG} "Please set the value of the sysctl compat.linux.osname"; \
        ${ECHO_MSG} "to 'Linux' with the command:"; \
        ${ECHO_MSG} "   ${SYSCTL} compat.linux.osname=Linux"; \
        ${ECHO_MSG} "Having it set to other values, such as 'FreeBSD',"; \
        ${ECHO_MSG} "is known to cause problems during bootstrapping."; \
        exit 1; \
    fi
.if !defined(WITH_JAIL)#{
    @if [ "`/sbin/mount | ${GREP} ^linprocfs`" = "" ]; \
    then \
        ${ECHO_MSG} "ERROR: You must have LINPROCFS mounted before" ; \
        ${ECHO_MSG} "starting to build the native JDK 1.5.0." ; \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "You may do it with the following commands:" ; \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "# kldload linprocfs" ; \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "and" ; \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "# mount -t linprocfs linprocfs /compat/linux/proc" ; \
        ${ECHO_MSG} "" ; \
        exit 1 ; \
    fi
.endif#}
.endif

do-build:
    # Start of jdk build
    @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})

post-build:
    @# XXX don't install japanese manpages
    @${RM} -rf ${JDKIMAGEDIR}/man/ja
    @${RM} -rf ${JDKIMAGEDIR}/man/ja_JP.eucJP
.if defined(WITH_TZUPDATE)
    @# Update time zones
    @-${JDKIMAGEDIR}/bin/java -jar \
        ${WRKDIR}/tzupdater-${TZUPDATE_VERSION:S/_/./g}-${TZUPDATE_TZVERSION}/tzupdater.jar -u -bc
    @-${RM} -rf ${JDKIMAGEDIR}/jre/lib/zi.tzdata*
.endif

do-install:
    ${MKDIR} ${PREFIX}/jdk${JDK_VERSION}
    cd ${JDKIMAGEDIR} && ${FIND} . \
      | ${CPIO} -pdmu -R ${LIBOWN}:${LIBGRP} ${PREFIX}/jdk${JDK_VERSION}
.if !defined(WITHOUT_WEB)
    ${INSTALL_DATA} ${JDKIMAGEDIR}/jre/plugin/desktop/sun_java.desktop \
        ${PREFIX}/share/applications/sun_java15.desktop
.endif
    @${ECHO_MSG} "@unexec ${LOCALBASE}/bin/unregistervm ${PREFIX}/jdk${JDK_VERSION}/bin/java" >> ${TMPPLIST}
    @${FIND} -s ${JDKIMAGEDIR} -not -type d | \
      ${SED} -ne 's#^${JDKIMAGEDIR}#jdk${JDK_VERSION}#p' >> ${TMPPLIST}
.if !defined(WITHOUT_WEB)
    @${ECHO_MSG} '@exec ${LOCALBASE}/bin/update-desktop-database > /dev/null || /usr/bin/true' >> ${TMPPLIST}
.endif
.if defined(WITH_DEBUG)
    cd ${JDKIMAGEDIR_G} && ${FIND} . \
      | ${CPIO} -pdmu -R ${LIBOWN}:${LIBGRP} ${PREFIX}/jdk${JDK_VERSION}
    @${FIND} -s ${JDKIMAGEDIR_G} -not -type d | \
      ${SED} -ne 's#^${JDKIMAGEDIR_G}#jdk${JDK_VERSION}#p' >> ${TMPPLIST}
.endif
    ${INSTALL_DATA} ${FILESDIR}/cacerts \
      ${PREFIX}/jdk${JDK_VERSION}/jre/lib/security/cacerts
.if defined(WITH_POLICY)
    ${INSTALL_DATA} ${WRKDIR}/jce/*.jar ${PREFIX}/jdk${JDK_VERSION}/jre/lib/security
.endif
    @${FIND} -s -d ${PREFIX}/jdk${JDK_VERSION} -type d | \
      ${SED} -ne 's#^${PREFIX}/#@dirrm #p' >> ${TMPPLIST}
    @${ECHO_MSG} "@exec ${LOCALBASE}/bin/registervm ${PREFIX}/jdk${JDK_VERSION}/bin/java # FREEBSD-JDK${JDK_VERSION}" >> ${TMPPLIST}
.if !defined(WITHOUT_WEB)
    @${ECHO_MSG} '@unexec ${LOCALBASE}/bin/update-desktop-database > /dev/null || /usr/bin/true' >> ${TMPPLIST}
.endif

# XXX: put unregistervm into install script ?
post-install:
    @${LOCALBASE}/bin/registervm "${PREFIX}/jdk${JDK_VERSION}/bin/java # FREEBSD-JDK${JDK_VERSION}"
.if !defined(WITHOUT_WEB)
    @-update-desktop-database
.endif
    @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL

.include <bsd.port.post.mk>