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
|
# $NetBSD: Makefile,v 1.140 2020/01/26 17:31:30 rillig Exp $
JDK_MICRO= 141
DISTNAME= openjdk-1.7.${JDK_MICRO}-20170813
PKGNAME= openjdk7-1.7.${JDK_MICRO}
PKGREVISION= 12
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_LOCAL:=openjdk7/}
EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://openjdk.java.net/
COMMENT= Open-source implementation of the Java Platform, Standard Edition
LICENSE= gnu-gpl-v2
DISTFILES= ${DEFAULT_DISTFILES}
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
DIST_SUBDIR= openjdk7
JAVA_NAME= openjdk7
JAVA_HOME= ${PREFIX}/java/${JAVA_NAME}
JAVA_WRAPPERS= jar java javac javadoc javah javap jcmd jhat jps jstack \
keytool orbd policytool rmid rmiregistry servertool tnameserv
NOT_PAX_MPROTECT_SAFE+= java/${JAVA_NAME}/bin/[a-ik-z]*
NOT_PAX_MPROTECT_SAFE+= java/${JAVA_NAME}/bin/j[b-z]*
NOT_PAX_MPROTECT_SAFE+= java/${JAVA_NAME}/bin/jar*
NOT_PAX_MPROTECT_SAFE+= java/${JAVA_NAME}/bin/java
NOT_PAX_MPROTECT_SAFE+= java/${JAVA_NAME}/bin/java[a-z]*
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "NetBSD" && defined(TOOLS_PLATFORM.paxctl)
SUBST_CLASSES+= set-paxctl
SUBST_STAGE.set-paxctl= pre-build
SUBST_MESSAGE.set-paxctl= Setting NetBSD paxctl
SUBST_FILES.set-paxctl= make/Defs-internal.gmk
SUBST_FILES.set-paxctl+= jdk/make/com/sun/jmx/Makefile
SUBST_SED.set-paxctl+= -e 's,/usr/sbin/paxmark.sh,${PAXCTL},'
SUBST_SED.set-paxctl+= -e 's,-vmsp,+m,'
SUBST_SED.set-paxctl+= -e 's,-vm,+m,'
SUBST_SED.set-paxctl+= -e 's,\^PaX,.,'
.endif
MAKE_ENV+= PKGSRC_ZIPEXE=${TOOLS_PATH.zip}
MAKE_ENV+= PKGSRC_UNZIP=${TOOLS_PATH.unzip}
MAKE_ENV+= PKGSRC_UNZIPSFX=${TOOLS_PATH.unzip}sfx
BUILD_DEPENDS+= mozilla-rootcerts>=1.0.20140820nb2:../../security/mozilla-rootcerts
NO_CONFIGURE= yes
USE_LANGUAGES= c c++03
USE_TOOLS+= gmake pax unzip:run zip:run # patch
UNLIMIT_RESOURCES= datasize stacksize
WRKSRC= ${WRKDIR}/openjdk
PLIST_SRC+= ${PLIST_SRC_DFLT}
CHECK_SHLIBS_SKIP= java/${JAVA_NAME}/jre/lib/${LIBDIR_ARCH}/libfontmanager.so
CHECK_SHLIBS_SKIP+= java/${JAVA_NAME}/jre/lib/${LIBDIR_ARCH}/libjawt.so
CHECK_SHLIBS_SKIP+= java/${JAVA_NAME}/jre/lib/${LIBDIR_ARCH}/libsunec.so
BUILDLINK_PASSTHRU_DIRS+= ${ALT_BOOTDIR}
PREPEND_PATH+= ${ALT_BOOTDIR}/bin
MAKE_ENV+= ALT_BOOTDIR=${ALT_BOOTDIR}
MAKE_ENV+= ALT_DROPS_DIR=${DISTDIR}/${DIST_SUBDIR}
MAKE_ENV+= ALT_FREETYPE_LIB_PATH=${BUILDLINK_PREFIX.freetype2}/lib
MAKE_ENV+= ALT_FREETYPE_HEADERS_PATH=${BUILDLINK_PREFIX.freetype2}/include
MAKE_ENV+= ALT_CUPS_HEADERS_PATH=${BUILDLINK_PREFIX.cups-base}/include
MAKE_ENV+= ALT_COMPILER_PATH=${WRAPPER_DIR}/bin
MAKE_ENV+= ALT_PACKAGE_PATH=${PREFIX}
MAKE_ENV+= RHINO_JAR=${WRKDIR}/${RHINO}/js.jar
MAKE_ENV+= BUILDLINK_PREFIX.iconv=${BUILDLINK_PREFIX.iconv:Q}
MAKE_ENV+= ZLIB_LIBS="-L${BUILDLINK_PREFIX.zlib}/lib ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.zlib}/lib -lz"
MAKE_ENV+= ALT_PARALLEL_COMPILE_JOBS=${MAKE_JOBS:U1}
MAKE_ENV+= HOTSPOT_BUILD_JOBS=${MAKE_JOBS}
MAKE_ENV+= USE_PRECOMPILED_HEADER=0
MAKE_ENV+= HOTSPOT_BUILD_USER=pkgsrc
MAKE_ENV+= JDK_MICRO_VERSION="0_${JDK_MICRO}"
MAKE_ENV+= NO_DOCS=true
MAKE_ENV+= SKIP_COMPARE_IMAGES=true
# Avoid build errors when JAVA_HOME and CLASSPATH are defined by user.
MAKE_ENV+= JAVA_HOME=
MAKE_ENV+= CLASSPATH=
BUILD_OPSYS= ${OPSYS:C/.*BSD/bsd/:S/DragonFly/bsd/:S/SunOS/solaris/}
BUILD_ARCH= ${MACHINE_ARCH:S/i386/i586/:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
LIBDIR_ARCH= ${MACHINE_ARCH:S/x86_64/amd64/:S/sparc64/sparcv9/:C/^e?arm.*$/arm/}
BUILDDIR= ${WRKSRC}/build/${BUILD_OPSYS}-${BUILD_ARCH}
LD_LIBRARY_PATH= ${WRKDIR}/bootstrap/jre/lib/${LIBDIR_ARCH}:${WRKDIR}/bootstrap/jre/lib/${LIBDIR_ARCH}/jli:${WRKDIR}/bootstrap/jre/lib/${LIBDIR_ARCH}/server
MAKE_ENV+= LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
BUILDLINK_PASSTHRU_RPATHDIRS+= ${PREFIX}/java/${JAVA_NAME}/jre/lib/${LIBDIR_ARCH}
PLIST_SUBST+= ARCH=${LIBDIR_ARCH}
PLIST_SUBST+= LOWER_OPSYS=${LOWER_OPSYS}
.include "../../mk/compiler.mk"
.if ${OPSYS} == "SunOS" && !empty(PKGSRC_COMPILER:Mgcc)
MAKE_ENV+= USE_GCC=1
MAKE_ENV+= ARCH_DATA_MODEL=${ABI:Q}
.endif
SUBST_CLASSES+= libpath
SUBST_STAGE.libpath= pre-build
SUBST_FILES.libpath+= hotspot/src/os/bsd/vm/os_bsd.cpp
SUBST_VARS.libpath= PREFIX
# SmartOS has ccs tools in /usr/bin
.if ${OS_VARIANT} == "SmartOS"
SUBST_CLASSES+= ccspath
SUBST_STAGE.ccspath= pre-build
SUBST_FILES.ccspath= jdk/make/common/shared/Defs-utils.gmk
SUBST_FILES.ccspath+= hotspot/make/solaris/makefiles/build_vm_def.sh
SUBST_SED.ccspath= -e 's/UNIXCCS_PATH/UNIXCOMMAND_PATH/g'
SUBST_SED.ccspath+= -e 's,/usr/ccs/bin,/usr/bin,g'
.endif
SUBST_CLASSES.SunOS+= mapfix
SUBST_STAGE.mapfix= pre-build
SUBST_FILES.mapfix= jdk/make/com/sun/java/pack/mapfile-vers
SUBST_FILES.mapfix+= jdk/make/java/main/java/mapfile-amd64
SUBST_FILES.mapfix+= jdk/make/java/main/java/mapfile-i586
SUBST_SED.mapfix= -e '/__fsr_init_value/d'
SUBST_SED.mapfix+= -e '/__progname/d'
# environ should only be removed from this file (added by patches)
SUBST_CLASSES.SunOS+= mapfix2
SUBST_STAGE.mapfix2= pre-build
SUBST_FILES.mapfix2= jdk/make/com/sun/java/pack/mapfile-vers
SUBST_SED.mapfix2= -e '/environ/d'
CFLAGS+= -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
CXXFLAGS+= -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
.if !empty(PKGSRC_COMPILER:Mgcc) && empty(CC_VERSION:Mgcc-[2345].*)
CFLAGS+= -fno-lifetime-dse
CFLAGS+= -fno-delete-null-pointer-checks
.endif
# no multilib support on aarch64 yet
.if !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64)
BUILDLINK_TRANSFORM+= rm:-m64
.endif
.if !empty(PKGSRC_COMPILER:Mclang)
_WRAP_EXTRA_ARGS.CXX+= -Wno-parentheses -Wno-sign-conversion \
-Wno-shorten-64-to-32 -Wno-conversion \
-Wno-unused-value -Wno-switch-enum -Wno-switch \
-Wno-tautological-compare \
-Wno-delete-non-virtual-dtor \
-Wno-return-type -Wno-unused-parameter \
-Wno-parentheses-equality -Wno-empty-body
CWRAPPERS_APPEND.cxx+= -Wno-parentheses -Wno-sign-conversion \
-Wno-shorten-64-to-32 -Wno-conversion \
-Wno-unused-value -Wno-switch-enum -Wno-switch \
-Wno-tautological-compare \
-Wno-delete-non-virtual-dtor \
-Wno-return-type -Wno-unused-parameter \
-Wno-parentheses-equality -Wno-empty-body
. if ${OPSYS} != "FreeBSD"
_WRAP_EXTRA_ARGS.CXX+= -Wno-new-returns-null
CWRAPPERS_APPEND.cxx+= -Wno-new-returns-null
. endif
BUILDLINK_TRANSFORM+= rm:-fcheck-new
BUILDLINK_TRANSFORM+= rm:-fpch-deps
. if ${MACHINE_ARCH} == "x86_64"
_WRAP_EXTRA_ARGS.CXX+= -mstackrealign
CWRAPPERS_APPEND.cxx+= -mstackrealign
. endif
.endif
.include "bootstrap.mk"
.include "icedtea-extras.mk"
.include "options.mk"
SUBST_CLASSES+= add-rpaths
SUBST_STAGE.add-rpaths= pre-build
SUBST_MESSAGE.add-rpaths= adding X11 run path flags to Makefiles
SUBST_FILES.add-rpaths= jdk/make/sun/awt/Makefile \
jdk/make/sun/awt/mawt.gmk \
jdk/make/sun/jawt/Makefile \
jdk/make/sun/jdga/Makefile \
jdk/make/sun/splashscreen/Makefile \
jdk/make/sun/xawt/Makefile
SUBST_SED.add-rpaths= -e 's|-L$$(OPENWIN_LIB)|-L$$(OPENWIN_LIB) -Wl,-R$$(OPENWIN_LIB)|g'
SUBST_CLASSES+= fontpaths
SUBST_STAGE.fontpaths= pre-build
SUBST_MESSAGE.fontpaths= fixing font paths
SUBST_FILES.fontpaths= jdk/src/solaris/classes/sun/awt/fontconfigs/bsd.fontconfig.properties
SUBST_FILES.fontpaths+= jdk/src/solaris/native/sun/awt/fontpath.c
SUBST_VARS.fontpaths= PREFIX
SUBST_VARS.fontpaths+= BUILDLINK_PREFIX.fontconfig
PLIST_VARS+= i386
.if ${MACHINE_ARCH} == "i386"
PLIST.i386= yes
.endif
PLIST_VARS+= sctp alsa
.if ${OPSYS} == "FreeBSD"
PLIST.sctp= yes
PLIST.alsa= yes
.include "../../audio/alsa-lib/buildlink3.mk"
.endif
post-extract:
chmod +x ${ANT_BIN}/ant
${LN} -s mapfile-i586 ${WRKSRC}/jdk/make/java/main/java/mapfile-arm
${LN} -s mapfile-amd64 ${WRKSRC}/jdk/make/java/main/java/mapfile-aarch64
# These libs are bundled w/ the netbsd-7 bootstrap to facilitate building with
# MKLLVM=yes / MKGCC=no. Nuke them from bootstrap if they are present in base.
.if exists(/lib/libgcc_s.so.1)
${RM} -f ${ALT_BOOTDIR}/jre/lib/${LIBDIR_ARCH}/libgcc_s.so*
.endif
.if exists(/usr/lib/libstdc++.so.7)
${RM} -f ${ALT_BOOTDIR}/jre/lib/${LIBDIR_ARCH}/libstdc++.so*
.endif
.if defined(TOOLS_PLATFORM.paxctl)
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/[a-ik-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/j[b-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/jar*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/java
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/java[a-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/jre/bin/*
.endif
do-build: ${WRKDIR}/stage3-done
# stage 1 builds a native JDK using the bootstrap binaries
${WRKDIR}/stage1-done:
${_ULIMIT_CMD} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${JDK_MAKE_TARGET}
rm -rf ${ALT_BOOTDIR}
cd ${BUILDDIR} && mv j2sdk-image ${ALT_BOOTDIR}
mv ${BUILDDIR} ${BUILDDIR}-stage1
touch ${.TARGET}
# stage 1.5 reconfigures, since the bootstrap JDK major version might have changed now
${WRKDIR}/stage1_5-done: ${WRKDIR}/stage1-done
.if defined(TOOLS_PLATFORM.paxctl)
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/[a-ik-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/j[b-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/jar*
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/java
${PAXCTL} +m ${WRKDIR}/bootstrap/bin/java[a-z]*
${PAXCTL} +m ${WRKDIR}/bootstrap/jre/bin/*
.endif
touch ${.TARGET}
# stage 2 rebuilds the JDK using native tools
${WRKDIR}/stage2-done: ${WRKDIR}/stage1_5-done
${_ULIMIT_CMD} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${JDK_MAKE_TARGET}
touch ${BUILDDIR}/j2sdk-image/jre/lib/applet/.keep
touch ${.TARGET}
# stage 3 builds third party add-ons
${WRKDIR}/stage3-done: ${WRKDIR}/stage2-done ${WRKDIR}/cacerts.out
touch ${.TARGET}
${WRKDIR}/cacerts.out:
.if defined(TOOLS_PLATFORM.paxctl)
${PAXCTL} +m ${WRKSRC}/build/*/bin/keytool
.endif
mkdir ${WRKDIR}/cacerts && cd ${WRKDIR}/cacerts && \
${PREFIX}/sbin/mozilla-rootcerts extract
for cert in ${WRKDIR}/cacerts/*.pem; do \
${INFO_MSG} "Importing $$cert" && \
${SETENV} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} LC_ALL=C \
${BUILDDIR}/bin/keytool \
-noprompt \
-importcert \
-keystore ${.TARGET} \
-alias `${ECHO} $$cert | sed 's,.*/\\([^/]*\\)\\.pem,\\1,'` \
-file $$cert \
-storepass changeit; \
done
do-install:
${INSTALL_DATA_DIR} ${DESTDIR}${JAVA_HOME}
cd ${BUILDDIR}/j2sdk-image && pax -rwpp . \
${DESTDIR}${JAVA_HOME}/.
${INSTALL_DATA} ${WRKDIR}/cacerts.out \
${DESTDIR}${JAVA_HOME}/jre/lib/security/cacerts
rm -f ${DESTDIR}${JAVA_HOME}/include/jni_md.h
ln -s ${LOWER_OPSYS}/jni_md.h \
${DESTDIR}${JAVA_HOME}/include/jni_md.h
.if ${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD"
TOOLS_PLATFORM.unzip=
.endif
# Include binutils for objcopy and GNU strip on SmartOS
.if ${OS_VARIANT} == "SmartOS"
.include "../../devel/binutils/buildlink3.mk"
BUILDLINK_DEPMETHOD.binutils?= build
MAKE_ENV+= ALT_OBJCOPY=${PREFIX}/bin/gobjcopy
MAKE_ENV+= STRIP=${PREFIX}/bin/gstrip
.endif
.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../fonts/fontconfig/buildlink3.mk"
.include "../../graphics/freetype2/buildlink3.mk"
# Headers from CUPS are required to build the native implementation of
# sun.print.* which is used by java.awt.print.
BUILDLINK_DEPMETHOD.cups-base?= build
.include "../../print/cups-base/buildlink3.mk"
.include "../../mk/java-env.mk"
.include "../../mk/bsd.pkg.mk"
|