This commit is contained in:
J. Duke 2017-07-05 20:08:17 +02:00
commit 0689cd758e
48 changed files with 2492 additions and 659 deletions

@ -282,3 +282,4 @@ c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
723a67b0c442391447b1d8aad8b249d06d1032e8 jdk9-b37
d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40

@ -143,31 +143,37 @@ help:
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
$(info . make images # Create complete j2sdk and j2re images)
$(info . make images # Create complete jdk and jre images)
$(info . make <phase> # Compile the specified phase and everything it depends on)
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info . make *-only # Applies to most targets and disables compling the)
$(info . # dependencies for the target. This is faster but may)
$(info . # result in incorrect build results!)
$(info . make docs # Create all docs)
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs)
$(info . make profiles # Create complete j2re compact profile images)
$(info . make profiles # Create complete jre compact profile images)
$(info . make bootcycle-images # Build images twice, second time with newly built JDK)
$(info . make install # Install the generated images locally)
$(info . make reconfigure # Rerun configure with the same arguments as last time)
$(info . make clean # Remove all files generated by make, but not those)
$(info . # generated by configure)
$(info . make dist-clean # Remove all files, including configuration)
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
$(info Targets for cleaning)
$(info . make clean # Remove all files generated by make, but not those)
$(info . # generated by configure)
$(info . make dist-clean # Remove all files, including configuration)
$(info . make clean-<outputdir> # Remove the subdir in the output dir with the name)
$(info . make clean-<phase> # Remove all build results related to a certain build)
$(info . # phase (gensrc, java, libs, launchers))
$(info . make clean-<module> # Remove all build results related to a certain module)
$(info . make clean-<module>-<phase> # Remove all build results related to a certain)
$(info . # module and phase)
$(info )
$(info Targets for specific modules)
$(info . make <module> # Build <module> and everything it depends on. )
$(info . make <module>-only # Build <module> only, without dependencies. This)
$(info . # is faster but can result in incorrect build results!)
$(info . make <module>-java # Compile java classes for <module> and everything it)
$(info . # depends on)
$(info . make <module>-libs # Build native libraries for <module> and everything it)
$(info . # depends on)
$(info . make <module>-launchers# Build native executables for <module> and everything it)
$(info . # depends on)
$(info . make <module>-gensrc # Execute the gensrc step for <module> and everything it)
$(info . # depends on)
$(info . make <module>-<phase> # Compile the specified phase for the specified module)
$(info . # and everything it depends on)
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))

@ -305,20 +305,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_MSG_ERROR([Cannot continue])
fi
# Setup proper paths for what we found
BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
if test ! -f "$BOOT_RTJAR"; then
# On MacOSX it is called classes.jar
BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
if test -f "$BOOT_RTJAR"; then
# Remove the ..
BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
fi
fi
BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
BOOT_JDK="$BOOT_JDK"
AC_SUBST(BOOT_RTJAR)
AC_SUBST(BOOT_TOOLSJAR)
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.

@ -42,13 +42,12 @@ endif
# Override specific values to do a boot cycle build
# Use a different Boot JDK
BOOT_JDK := $(JDK_IMAGE_DIR)
# The bootcycle build has a different output directory
BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
# Use a different Boot JDK
OLD_BOOT_JDK:=$(BOOT_JDK)
BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac

@ -46,6 +46,7 @@ FILE="@FILE@"
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
LDD="@LDD@"
MKDIR="@MKDIR@"
NAWK="@NAWK@"

@ -784,24 +784,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
-L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"

@ -820,8 +820,6 @@ JAVAH
JAVAC
JAVA
BOOT_JDK
BOOT_TOOLSJAR
BOOT_RTJAR
JAVA_CHECK
JAVAC_CHECK
COOKED_BUILD_NUMBER
@ -4328,7 +4326,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1415179461
DATE_WHEN_GENERATED=1416999037
###############################################################################
#
@ -25533,20 +25531,6 @@ $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&
as_fn_error $? "Cannot continue" "$LINENO" 5
fi
# Setup proper paths for what we found
BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
if test ! -f "$BOOT_RTJAR"; then
# On MacOSX it is called classes.jar
BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
if test -f "$BOOT_RTJAR"; then
# Remove the ..
BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
fi
fi
BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
BOOT_JDK="$BOOT_JDK"
# Setup tools from the Boot JDK.
@ -42870,24 +42854,24 @@ $as_echo "$as_me: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&2;}
LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
LDFLAGS_JDKLIB_SUFFIX=""
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${SHARED_LIBRARY_FLAGS} \
-L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
-L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
# On some platforms (mac) the linker warns about non existing -L dirs.
# Add server first if available. Linking aginst client does not always produce the same results.
# Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
# Default to server for other variants.
if test "x$JVM_VARIANT_SERVER" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
else
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
fi
LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"

@ -236,31 +236,23 @@ BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
BUILD_OUTPUT:=@BUILD_OUTPUT@
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
HOTSPOT_DIST=@HOTSPOT_DIST@
NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
# them in sync.
# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
# it in sync.
BOOT_JDK:=@BOOT_JDK@
BOOT_RTJAR:=@BOOT_RTJAR@
BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
# When compiling Java source to be run by the boot jdk
# use these extra flags, eg -source 6 -target 6
@ -484,13 +476,14 @@ SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAG
JAVAC_FLAGS?=@JAVAC_FLAGS@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
# Use = assignment to be able to override in bootcycle-spec.gmk
INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
@ -695,19 +688,15 @@ OS_VERSION_MINOR:=@OS_VERSION_MINOR@
OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
JDK_IMAGE_SUBDIR:=j2sdk-image
JRE_IMAGE_SUBDIR:=j2re-image
JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
JDK_IMAGE_SUBDIR:=jdk
JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
# Macosx bundles directory definitions
JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)

@ -103,8 +103,8 @@ diff_text() {
-e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
$JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
$JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
$JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap
$JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@ -298,7 +298,7 @@ compare_general_files() {
WORK_DIR=$3
GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
@ -395,8 +395,14 @@ compare_zip_file() {
$RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
$MKDIR -p $THIS_UNZIPDIR
$MKDIR -p $OTHER_UNZIPDIR
(cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
if [ "$TYPE" = "jimage" ]
then
(cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
else
(cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
(cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
fi
# Find all archives inside and unzip them as well to compare the contents rather than
# the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@ -525,7 +531,7 @@ compare_all_jar_files() {
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
| $SORT | $FILTER)
-o -name "*.jimage" | $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@ -633,7 +639,7 @@ compare_bin_file() {
if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
# The files were bytewise identical.
if [ -n "$VERBOSE" ]; then
echo " : : : : : $BIN_FILE"
echo " : : : : : : $BIN_FILE"
fi
return 0
fi
@ -1136,17 +1142,8 @@ fi
if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -z "$OTHER" ]; then
OTHER="$THIS/../$LEGACY_BUILD_DIR"
if [ -d "$OTHER" ]; then
OTHER="$( cd "$OTHER" && pwd )"
else
echo "Default old build directory does not exist:"
echo "$OTHER"
exit 1
fi
echo "Comparing to default old build:"
echo "$OTHER"
echo
echo "Nothing to compare to, set with -o"
exit 1
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
@ -1160,90 +1157,36 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
fi
# Figure out the layout of the this build. Which kinds of images have been produced
if [ -d "$THIS/install/j2sdk-image" ]; then
THIS_J2SDK="$THIS/install/j2sdk-image"
THIS_J2RE="$THIS/install/j2re-image"
echo "Selecting install images in this build"
elif [ -d "$THIS/deploy/j2sdk-image" ]; then
THIS_J2SDK="$THIS/deploy/j2sdk-image"
THIS_J2RE="$THIS/deploy/j2re-image"
echo "Selecting deploy images in this build"
elif [ -d "$THIS/images/j2sdk-image" ]; then
THIS_J2SDK="$THIS/images/j2sdk-image"
THIS_J2RE="$THIS/images/j2re-image"
echo "Selecting jdk images in this build"
# Find the common images to compare, prioritizing later build stages
if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
THIS_J2SDK="$THIS/install/jdk"
THIS_J2RE="$THIS/install/jre"
OTHER_J2SDK="$OTHER/install/jdk"
OTHER_J2RE="$OTHER/install/jre"
echo "Selecting install images for compare"
elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
THIS_J2SDK="$THIS/deploy/jdk"
THIS_J2RE="$THIS/deploy/jre"
OTHER_J2SDK="$OTHER/deploy/jdk"
OTHER_J2RE="$OTHER/deploy/jre"
echo "Selecting deploy images for compare"
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
THIS_J2SDK="$THIS/images/jdk"
THIS_J2RE="$THIS/images/jre"
OTHER_J2SDK="$OTHER/images/jdk"
OTHER_J2RE="$OTHER/images/jre"
echo "Selecting jdk images for compare"
else
echo "No common images found."
exit 1
fi
if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
if [ -d "$THIS/install/j2sdk-image" ]; then
# If there is an install image, prefer that, it's also overlay
THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
echo "Selecting install overlay images in this build"
else
THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
echo "Selecting jdk overlay images in this build"
fi
fi
if [ -d "$THIS/images/j2sdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
echo "Selecting bundles in this build"
fi
# Figure out the layout of the other build (old or new, normal or overlay image)
if [ -d "$OTHER/j2sdk-image" ]; then
if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
OTHER_J2SDK="$OTHER/j2sdk-image"
OTHER_J2RE="$OTHER/j2re-image"
echo "Selecting old-style images in other build"
else
OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
echo "Selecting overlay images in other build"
fi
elif [ -d "$OTHER/install/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/install/j2sdk-image"
OTHER_J2RE="$OTHER/install/j2re-image"
echo "Selecting install images in other build"
elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
OTHER_J2RE="$OTHER/deploy/j2re-image"
echo "Selecting deploy images in other build"
elif [ -d "$OTHER/images/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/images/j2sdk-image"
OTHER_J2RE="$OTHER/images/j2re-image"
echo "Selecting jdk images in other build"
fi
if [ -d "$OTHER/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
echo "Selecting bundles in other build"
elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
echo "Selecting jdk bundles in other build"
fi
if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
if [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
exit 1
fi
fi
if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
exit 1
fi
if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo "WARNING! OTHER build has bundles built while this build does not."
echo "Skipping bundle compare!"
if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
echo "Also comparing macosx bundles"
fi
if [ -d "$OTHER/images" ]; then
@ -1266,22 +1209,13 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
fi
if [ -d "$THIS/docs" ]; then
if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
THIS_DOCS="$THIS/docs"
fi
if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
fi
if [ -z "$THIS_DOCS" ]; then
echo "Also comparing docs"
else
echo "WARNING! Docs haven't been built and won't be compared."
fi
if [ -z "$OTHER_DOCS" ]; then
echo "WARNING! Other build doesn't contain docs, skipping doc compare."
fi
fi
##########################################################################################
@ -1299,27 +1233,16 @@ if [ "$CMP_NAMES" = "true" ]; then
echo -n "J2RE "
compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
echo -n "J2SDK Overlay "
compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
echo -n "J2SDK Bundle "
compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@ -1340,18 +1263,6 @@ if [ "$CMP_PERMS" = "true" ]; then
echo -n "J2RE "
compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
echo -n "J2RE Bundle "
compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@ -1364,17 +1275,11 @@ if [ "$CMP_TYPES" = "true" ]; then
echo -n "J2RE "
compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
@ -1388,17 +1293,11 @@ if [ "$CMP_GENERAL" = "true" ]; then
echo -n "J2RE "
compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "J2SDK Overlay "
compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
echo -n "J2RE Overlay "
compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
fi
if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo -n "J2SDK Bundle "
compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
echo -n "J2RE Bundle "
compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
fi
if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
echo -n "Docs "
@ -1454,10 +1353,6 @@ if [ "$CMP_LIBS" = "true" ]; then
compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
fi
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "Bundle "
compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
@ -1467,10 +1362,6 @@ if [ "$CMP_EXECS" = "true" ]; then
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
fi
if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
echo -n "Overlay "
compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi

@ -84,7 +84,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -171,7 +173,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -314,7 +318,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -453,7 +459,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/amd64/jconsole
./bin/amd64/jdb
./bin/amd64/jhat
./bin/amd64/jimage
./bin/amd64/jinfo
./bin/amd64/jjs
./bin/amd64/jmap
./bin/amd64/jps
./bin/amd64/jrunscript
@ -611,7 +619,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript
@ -755,7 +765,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/sparcv9/jconsole
./bin/sparcv9/jdb
./bin/sparcv9/jhat
./bin/sparcv9/jimage
./bin/sparcv9/jinfo
./bin/sparcv9/jjs
./bin/sparcv9/jmap
./bin/sparcv9/jps
./bin/sparcv9/jrunscript
@ -836,7 +848,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
./bin/jconsole.exe
./bin/jdb.exe
./bin/jhat.exe
./bin/jimage.exe
./bin/jinfo.exe
./bin/jjs.exe
./bin/jmap.exe
./bin/jps.exe
./bin/jrunscript.exe
@ -930,7 +944,9 @@ ACCEPTED_BIN_DIFF="
./bin/jconsole
./bin/jdb
./bin/jhat
./bin/jimage
./bin/jinfo
./bin/jjs
./bin/jmap
./bin/jps
./bin/jrunscript

@ -1212,6 +1212,7 @@ jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp : jdk/src/share/classes/sun
jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@ -1301,7 +1302,6 @@ jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/n
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii

@ -442,3 +442,4 @@ af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32
b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40

@ -63,6 +63,10 @@ else
SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
endif
ifneq ($(SA_CLASSPATH),)
SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
endif
# TODO: if it's a modules image, check if SA module is installed.
MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
@ -114,7 +118,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js

@ -512,15 +512,13 @@ void os::init_system_properties_values() {
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the trailing null is provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -571,15 +569,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -2778,6 +2771,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
return ::pread(fd, buf, nBytes, offset);
}
void os::naked_short_sleep(jlong ms) {
struct timespec req;

@ -353,7 +353,6 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
#ifndef __APPLE__
@ -361,9 +360,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -425,10 +423,6 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#else // __APPLE__
@ -445,9 +439,8 @@ void os::init_system_properties_values() {
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // for dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // for dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -525,10 +518,6 @@ void os::init_system_properties_values() {
user_home_dir, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXTENSIONS_DIR
@ -538,7 +527,6 @@ void os::init_system_properties_values() {
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -2576,6 +2564,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
}
void os::naked_short_sleep(jlong ms) {
struct timespec req;

@ -337,15 +337,13 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -410,16 +408,11 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
////////////////////////////////////////////////////////////////////////////////
@ -3783,6 +3776,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return ::read(fd, buf, nBytes);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
return ::pread(fd, buf, nBytes, offset);
}
// Short sleep, direct OS call.
//
// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee

@ -609,17 +609,15 @@ void os::init_system_properties_values() {
// Base path of extensions installed on the system.
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX4((size_t)MAXPATHLEN, // For dll_dir & friends.
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
(size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@ -765,15 +763,10 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
// Endorsed standards default directory.
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
#undef ENDORSED_DIR
}
void os::breakpoint() {
@ -3164,6 +3157,15 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
return res;
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
size_t res;
JavaThread* thread = (JavaThread*)Thread::current();
assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
ThreadBlockInVM tbiv(thread);
RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
return res;
}
size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
size_t res;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,

@ -292,19 +292,6 @@ void os::init_system_properties_values() {
#undef BIN_DIR
#undef PACKAGE_DIR
// Default endorsed standards directory.
{
#define ENDORSED_DIR "\\lib\\endorsed"
size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
Arguments::set_endorsed_dirs(buf);
// (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
// duplicates the input.)
FREE_C_HEAP_ARRAY(char, buf, mtInternal);
#undef ENDORSED_DIR
}
#ifndef _WIN64
// set our UnhandledExceptionFilter and save any previous one
prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@ -4376,6 +4363,23 @@ jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::_lseeki64(fd, offset, whence);
}
size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
OVERLAPPED ov;
DWORD nread;
BOOL result;
ZeroMemory(&ov, sizeof(ov));
ov.Offset = (DWORD)offset;
ov.OffsetHigh = (DWORD)(offset >> 32);
HANDLE h = (HANDLE)::_get_osfhandle(fd);
result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
return result ? nread : 0;
}
// This method is a slightly reworked copy of JDK's sysNativePath
// from src/windows/hpi/src/path_md.c

@ -28,6 +28,7 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderExt.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
#if INCLUDE_CDS
#include "classfile/sharedPathsMiscInfo.hpp"
@ -67,7 +68,7 @@
#include "utilities/hashtable.hpp"
#include "utilities/hashtable.inline.hpp"
// Entry points in zip.dll for loading zip/jar file entries
// Entry points in zip.dll for loading zip/jar file entries and image file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@ -75,6 +76,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
@ -84,6 +86,7 @@ static ReadEntry_t ReadEntry = NULL;
static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
// Globals
@ -322,6 +325,8 @@ LazyClassPathEntry::~LazyClassPathEntry() {
}
bool LazyClassPathEntry::is_jar_file() {
size_t len = strlen(_path);
if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
return ((_st.st_mode & S_IFREG) == S_IFREG);
}
@ -385,6 +390,78 @@ u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_te
}
}
ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
bool opened = _image->open();
if (!opened) {
_image = NULL;
}
}
ClassPathImageEntry::~ClassPathImageEntry() {
if (_image) {
_image->close();
_image = NULL;
}
}
const char* ClassPathImageEntry::name() {
return _image ? _image->name() : "";
}
ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
u1* buffer;
u8 size;
_image->get_resource(name, buffer, size);
if (buffer) {
if (UsePerfData) {
ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
}
return new ClassFileStream(buffer, (int)size, (char*)name); // Resource allocated
}
return NULL;
}
#ifndef PRODUCT
void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
tty->cr();
const ImageStrings strings = _image->get_strings();
// Retrieve each path component string.
u4 count = _image->get_location_count();
for (u4 i = 0; i < count; i++) {
u1* location_data = _image->get_location_data(i);
if (location_data) {
ImageLocation location(location_data);
const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
char path[JVM_MAXPATHLEN];
strcpy(path, parent);
strcat(path, base);
strcat(path, extension);
ClassLoader::compile_the_world_in(path, loader, CHECK);
}
}
if (HAS_PENDING_EXCEPTION) {
if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
CLEAR_PENDING_EXCEPTION;
tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
tty->print_cr("Increase class metadata storage if a limit was set");
} else {
tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
}
}
}
bool ClassPathImageEntry::is_jrt() {
return string_ends_with(name(), "bootmodules.jimage");
}
#endif
static void print_meta_index(LazyClassPathEntry* entry,
GrowableArray<char*>& meta_packages) {
tty->print("[Meta index for %s=", entry->name());
@ -634,7 +711,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
// Regular file, should be a zip file
// Regular file, should be a zip or image file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@ -645,6 +722,11 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
// TODO - add proper criteria for selecting image file
ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
if (entry->is_open()) {
new_entry = entry;
} else {
char* error_msg = NULL;
jzfile* zip;
{
@ -655,9 +737,6 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
}
if (zip != NULL && error_msg == NULL) {
new_entry = new ClassPathZipEntry(zip, path);
if (TraceClassLoading || TraceClassPaths) {
tty->print_cr("[Opened %s]", path);
}
} else {
ResourceMark rm(thread);
char *msg;
@ -675,10 +754,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
return NULL;
}
}
}
if (TraceClassLoading || TraceClassPaths) {
tty->print_cr("[Opened %s]", path);
}
} else {
// Directory
new_entry = new ClassPathDirEntry(path);
if (TraceClassLoading || TraceClassPaths) {
if (TraceClassLoading) {
tty->print_cr("[Path %s]", path);
}
}
@ -801,6 +884,7 @@ void ClassLoader::load_zip_library() {
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
// ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@ -809,12 +893,20 @@ void ClassLoader::load_zip_library() {
vm_exit_during_initialization("Corrupted ZIP library", path);
}
if (ZipInflateFully == NULL) {
vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
}
// Lookup canonicalize entry in libjava.dll
void *javalib_handle = os::native_java_library();
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
// This lookup only works on 1.3. Do not check for non-null here
}
jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
}
int ClassLoader::crc32(int crc, const char* buf, int len) {
assert(Crc32 != NULL, "ZIP_CRC32 is not found");
return (*Crc32)(crc, (const jbyte*)buf, len);
@ -1367,8 +1459,7 @@ void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
tty->cr();
}
bool ClassPathDirEntry::is_rt_jar() {
bool ClassPathDirEntry::is_jrt() {
return false;
}
@ -1393,13 +1484,13 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
}
}
bool ClassPathZipEntry::is_rt_jar() {
bool ClassPathZipEntry::is_jrt() {
real_jzfile* zip = (real_jzfile*) _zip;
int len = (int)strlen(zip->name);
// Check whether zip name ends in "rt.jar"
// This will match other archives named rt.jar as well, but this is
// only used for debugging.
return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
return string_ends_with(zip->name, "rt.jar");
}
void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@ -1409,7 +1500,7 @@ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
}
}
bool LazyClassPathEntry::is_rt_jar() {
bool LazyClassPathEntry::is_jrt() {
Thread* THREAD = Thread::current();
ClassPathEntry* cpe = resolve_entry(THREAD);
return (cpe != NULL) ? cpe->is_jar_file() : false;
@ -1428,7 +1519,7 @@ void ClassLoader::compile_the_world() {
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
if (e->is_rt_jar() && e != _first_entry) break;
if (e->is_jrt() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
@ -1476,9 +1567,9 @@ static bool can_be_compiled(methodHandle m, int comp_level) {
}
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
int len = (int)strlen(name);
if (len > 6 && strcmp(".class", name + len - 6) == 0) {
if (string_ends_with(name, ".class")) {
// We have a .class file
int len = (int)strlen(name);
char buffer[2048];
strncpy(buffer, name, len - 6);
buffer[len-6] = 0;

@ -66,7 +66,7 @@ class ClassPathEntry: public CHeapObj<mtClass> {
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
// Debugging
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
NOT_PRODUCT(virtual bool is_jrt() = 0;)
};
@ -80,7 +80,7 @@ class ClassPathDirEntry: public ClassPathEntry {
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
@ -112,7 +112,7 @@ class ClassPathZipEntry: public ClassPathEntry {
void contents_do(void f(const char* name, void* context), void* context);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
@ -138,7 +138,25 @@ class LazyClassPathEntry: public ClassPathEntry {
virtual bool is_lazy();
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_rt_jar();)
NOT_PRODUCT(bool is_jrt();)
};
// For java image files
class ImageFile;
class ClassPathImageEntry: public ClassPathEntry {
private:
ImageFile *_image;
public:
bool is_jar_file() { return false; }
bool is_open() { return _image != NULL; }
const char* name();
ClassPathImageEntry(char* name);
~ClassPathImageEntry();
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
NOT_PRODUCT(bool is_jrt();)
};
class PackageHashtable;
@ -226,6 +244,7 @@ class ClassLoader: AllStatic {
// to avoid confusing the zip library
static bool get_canonical_path(const char* orig, char* out, int len);
public:
static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(const char *path,
bool check_for_duplicates,

@ -0,0 +1,286 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/imageFile.hpp"
#include "runtime/os.inline.hpp"
#include "utilities/bytes.hpp"
// Compute the Perfect Hashing hash code for the supplied string.
u4 ImageStrings::hash_code(const char* string, u4 seed) {
u1* bytes = (u1*)string;
// Compute hash code.
for (u1 byte = *bytes++; byte; byte = *bytes++) {
seed = (seed * HASH_MULTIPLIER) ^ byte;
}
// Ensure the result is unsigned.
return seed & 0x7FFFFFFF;
}
// Test to see if string begins with start. If so returns remaining portion
// of string. Otherwise, NULL.
const char* ImageStrings::starts_with(const char* string, const char* start) {
char ch1, ch2;
// Match up the strings the best we can.
while ((ch1 = *string) && (ch2 = *start)) {
if (ch1 != ch2) {
// Mismatch, return NULL.
return NULL;
}
string++, start++;
}
// Return remainder of string.
return string;
}
ImageLocation::ImageLocation(u1* data) {
// Deflate the attribute stream into an array of attributes.
memset(_attributes, 0, sizeof(_attributes));
u1 byte;
while ((byte = *data) != ATTRIBUTE_END) {
u1 kind = attribute_kind(byte);
u1 n = attribute_length(byte);
assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
_attributes[kind] = attribute_value(data + 1, n);
data += n + 1;
}
}
ImageFile::ImageFile(const char* name) {
// Copy the image file name.
_name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
strcpy(_name, name);
// Initialize for a closed file.
_fd = -1;
_memory_mapped = true;
_index_data = NULL;
}
ImageFile::~ImageFile() {
// Ensure file is closed.
close();
// Free up name.
FREE_C_HEAP_ARRAY(char, _name, mtClass);
}
bool ImageFile::open() {
// If file exists open for reading.
struct stat st;
if (os::stat(_name, &st) != 0 ||
(st.st_mode & S_IFREG) != S_IFREG ||
(_fd = os::open(_name, 0, O_RDONLY)) == -1) {
return false;
}
// Read image file header and verify.
u8 header_size = sizeof(ImageHeader);
if (os::read(_fd, &_header, header_size) != header_size ||
_header._magic != IMAGE_MAGIC ||
_header._major_version != MAJOR_VERSION ||
_header._minor_version != MINOR_VERSION) {
close();
return false;
}
// Memory map index.
_index_size = index_size();
_index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
// Failing that, read index into C memory.
if (_index_data == NULL) {
_memory_mapped = false;
_index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
if (os::seek_to_file_offset(_fd, 0) == -1) {
close();
return false;
}
if (os::read(_fd, _index_data, _index_size) != _index_size) {
close();
return false;
}
return true;
}
// Used to advance a pointer, unstructured.
#undef nextPtr
#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
// Pull tables out from the index.
_redirect_table = nextPtr(_index_data, u1, header_size, s4);
_offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
_location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
_string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
#undef nextPtr
// Successful open.
return true;
}
void ImageFile::close() {
// Dealllocate the index.
if (_index_data) {
if (_memory_mapped) {
os::unmap_memory((char*)_index_data, _index_size);
} else {
FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
}
_index_data = NULL;
}
// close file.
if (_fd != -1) {
os::close(_fd);
_fd = -1;
}
}
// Return the attribute stream for a named resourced.
u1* ImageFile::find_location_data(const char* path) const {
// Compute hash.
u4 hash = ImageStrings::hash_code(path) % _header._location_count;
s4 redirect = _redirect_table[hash];
if (!redirect) {
return NULL;
}
u4 index;
if (redirect < 0) {
// If no collision.
index = -redirect - 1;
} else {
// If collision, recompute hash code.
index = ImageStrings::hash_code(path, redirect) % _header._location_count;
}
assert(index < _header._location_count, "index exceeds location count");
u4 offset = _offsets_table[index];
assert(offset < _header._locations_size, "offset exceeds location attributes size");
if (offset == 0) {
return NULL;
}
return _location_bytes + offset;
}
// Verify that a found location matches the supplied path.
bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
// Retrieve each path component string.
ImageStrings strings(_string_bytes, _header._strings_size);
// Match a path with each subcomponent without concatenation (copy).
// Match up path parent.
const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
const char* next = ImageStrings::starts_with(path, parent);
// Continue only if a complete match.
if (!next) return false;
// Match up path base.
const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
next = ImageStrings::starts_with(next, base);
// Continue only if a complete match.
if (!next) return false;
// Match up path extension.
const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
next = ImageStrings::starts_with(next, extension);
// True only if complete match and no more characters.
return next && *next == '\0';
}
// Return the resource for the supplied location.
u1* ImageFile::get_resource(ImageLocation& location) const {
// Retrieve the byte offset and size of the resource.
u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
u8 read_size = compressed_size ? compressed_size : size;
// Allocate space for the resource.
u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
guarantee(is_read, "error reading from image or short read");
// If not compressed, just return the data.
if (!compressed_size) {
return data;
}
u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
char* msg = NULL;
jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
if (!res) warning("decompression failed due to %s\n", msg);
guarantee(res, "decompression failed");
return uncompressed;
}
void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
buffer = NULL;
size = 0;
u1* data = find_location_data(path);
if (data) {
ImageLocation location(data);
if (verify_location(location, path)) {
size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
buffer = get_resource(location);
}
}
}
GrowableArray<const char*>* ImageFile::packages(const char* name) {
char entry[JVM_MAXPATHLEN];
bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
guarantee(!overflow, "package name overflow");
u1* buffer;
u8 size;
get_resource(entry, buffer, size);
guarantee(buffer, "missing module packages reource");
ImageStrings strings(_string_bytes, _header._strings_size);
GrowableArray<const char*>* pkgs = new GrowableArray<const char*>();
int count = size / 4;
for (int i = 0; i < count; i++) {
u4 offset = Bytes::get_Java_u4(buffer + (i*4));
const char* p = strings.get(offset);
pkgs->append(p);
}
return pkgs;
}

@ -0,0 +1,343 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
#include "classfile/classLoader.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "utilities/globalDefinitions.hpp"
// Image files are an alternate file format for storing classes and resources. The
// goal is to supply file access which is faster and smaller that the jar format.
// It should be noted that unlike jars information stored in an image is in native
// endian format. This allows the image to be memory mapped into memory without
// endian translation. This also means that images are platform dependent.
//
// Image files are structured as three sections;
//
// +-----------+
// | Header |
// +-----------+
// | |
// | Directory |
// | |
// +-----------+
// | |
// | |
// | Resources |
// | |
// | |
// +-----------+
//
// The header contains information related to identification and description of
// contents.
//
// +-------------------------+
// | Magic (0xCAFEDADA) |
// +------------+------------+
// | Major Vers | Minor Vers |
// +------------+------------+
// | Location Count |
// +-------------------------+
// | Attributes Size |
// +-------------------------+
// | Strings Size |
// +-------------------------+
//
// Magic - means of identifying validity of the file. This avoids requiring a
// special file extension.
// Major vers, minor vers - differences in version numbers indicate structural
// changes in the image.
// Location count - number of locations/resources in the file. This count is also
// the length of lookup tables used in the directory.
// Attributes size - number of bytes in the region used to store location attribute
// streams.
// Strings size - the size of the region used to store strings used by the
// directory and meta data.
//
// The directory contains information related to resource lookup. The algorithm
// used for lookup is "A Practical Minimal Perfect Hashing Method"
// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
// in the form <package>/<base>.<extension> return the resource location
// information;
//
// redirectIndex = hash(path, DEFAULT_SEED) % count;
// redirect = redirectTable[redirectIndex];
// if (redirect == 0) return not found;
// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
// location = locationTable[locationIndex];
// if (!verify(location, path)) return not found;
// return location;
//
// Note: The hash function takes an initial seed value. A different seed value
// usually returns a different result for strings that would otherwise collide with
// other seeds. The verify function guarantees the found resource location is
// indeed the resource we are looking for.
//
// The following is the format of the directory;
//
// +-------------------+
// | Redirect Table |
// +-------------------+
// | Attribute Offsets |
// +-------------------+
// | Attribute Data |
// +-------------------+
// | Strings |
// +-------------------+
//
// Redirect Table - Array of 32-bit signed values representing actions that
// should take place for hashed strings that map to that
// value. Negative values indicate no hash collision and can be
// quickly converted to indices into attribute offsets. Positive
// values represent a new seed for hashing an index into attribute
// offsets. Zero indicates not found.
// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
// attribute data. Attribute offsets can be iterated to do a
// full survey of resources in the image.
// Attribute Data - Bytes representing compact attribute data for locations. (See
// comments in ImageLocation.)
// Strings - Collection of zero terminated UTF-8 strings used by the directory and
// image meta data. Each string is accessed by offset. Each string is
// unique. Offset zero is reserved for the empty string.
//
// Note that the memory mapped directory assumes 32 bit alignment of the image
// header, the redirect table and the attribute offsets.
//
// Manage image file string table.
class ImageStrings {
private:
// Data bytes for strings.
u1* _data;
// Number of bytes in the string table.
u4 _size;
public:
// Prime used to generate hash for Perfect Hashing.
static const u4 HASH_MULTIPLIER = 0x01000193;
ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
// Return the UTF-8 string beginning at offset.
inline const char* get(u4 offset) const {
assert(offset < _size, "offset exceeds string table size");
return (const char*)(_data + offset);
}
// Compute the Perfect Hashing hash code for the supplied string.
inline static u4 hash_code(const char* string) {
return hash_code(string, HASH_MULTIPLIER);
}
// Compute the Perfect Hashing hash code for the supplied string, starting at seed.
static u4 hash_code(const char* string, u4 seed);
// Test to see if string begins with start. If so returns remaining portion
// of string. Otherwise, NULL. Used to test sections of a path without
// copying.
static const char* starts_with(const char* string, const char* start);
};
// Manage image file location attribute streams. Within an image, a location's
// attributes are compressed into a stream of bytes. An attribute stream is
// composed of individual attribute sequences. Each attribute sequence begins with
// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
// attribute value. Attribute values present as most significant byte first.
//
// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
// (kind = 4, length = 3), 0x03, 0x35, 0x62.
//
// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
// byte of zero.)
//
// ImageLocation inflates the stream into individual values stored in the long
// array _attributes. This allows an attribute value can be quickly accessed by
// direct indexing. Unspecified values default to zero.
//
// Notes:
// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
// streams will contain zero byte values to represent lesser significant bits.
// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
// stream.
// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
// storing the resources. Thus, in an image this represents the number of bytes
// after the directory.
// - Currently, compressed resources are represented by having a non-zero
// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
// in memory. In the future, additional compression techniques will be used and
// represented differently.
// - Package strings include trailing slash and extensions include prefix period.
//
class ImageLocation {
public:
// Attribute kind enumeration.
static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
private:
// Values of inflated attributes.
u8 _attributes[ATTRIBUTE_COUNT];
// Return the attribute value number of bytes.
inline static u1 attribute_length(u1 data) {
return (data & 0x7) + 1;
}
// Return the attribute kind.
inline static u1 attribute_kind(u1 data) {
u1 kind = data >> 3;
assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
return kind;
}
// Return the attribute length.
inline static u8 attribute_value(u1* data, u1 n) {
assert(0 < n && n <= 8, "invalid attribute value length");
u8 value = 0;
// Most significant bytes first.
for (u1 i = 0; i < n; i++) {
value <<= 8;
value |= data[i];
}
return value;
}
public:
ImageLocation(u1* data);
// Retrieve an attribute value from the inflated array.
inline u8 get_attribute(u1 kind) const {
assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
return _attributes[kind];
}
// Retrieve an attribute string value from the inflated array.
inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
return strings.get((u4)get_attribute(kind));
}
};
// Manage the image file.
class ImageFile: public CHeapObj<mtClass> {
private:
// Image file marker.
static const u4 IMAGE_MAGIC = 0xCAFEDADA;
// Image file major version number.
static const u2 MAJOR_VERSION = 0;
// Image file minor version number.
static const u2 MINOR_VERSION = 1;
struct ImageHeader {
u4 _magic; // Image file marker
u2 _major_version; // Image file major version number
u2 _minor_version; // Image file minor version number
u4 _location_count; // Number of locations managed in index.
u4 _locations_size; // Number of bytes in attribute table.
u4 _strings_size; // Number of bytes in string table.
};
char* _name; // Name of image
int _fd; // File descriptor
bool _memory_mapped; // Is file memory mapped
ImageHeader _header; // Image header
u8 _index_size; // Total size of index
u1* _index_data; // Raw index data
s4* _redirect_table; // Perfect hash redirect table
u4* _offsets_table; // Location offset table
u1* _location_bytes; // Location attributes
u1* _string_bytes; // String table
// Compute number of bytes in image file index.
inline u8 index_size() {
return sizeof(ImageHeader) +
_header._location_count * sizeof(u4) * 2 +
_header._locations_size +
_header._strings_size;
}
public:
ImageFile(const char* name);
~ImageFile();
// Open image file for access.
bool open();
// Close image file.
void close();
// Retrieve name of image file.
inline const char* name() const {
return _name;
}
// Return a string table accessor.
inline const ImageStrings get_strings() const {
return ImageStrings(_string_bytes, _header._strings_size);
}
// Return number of locations in image file index.
inline u4 get_location_count() const {
return _header._location_count;
}
// Return location attribute stream for location i.
inline u1* get_location_data(u4 i) const {
u4 offset = _offsets_table[i];
return offset != 0 ? _location_bytes + offset : NULL;
}
// Return the attribute stream for a named resourced.
u1* find_location_data(const char* path) const;
// Verify that a found location matches the supplied path.
bool verify_location(ImageLocation& location, const char* path) const;
// Return the resource for the supplied location info.
u1* get_resource(ImageLocation& location) const;
// Return the resource associated with the path else NULL if not found.
void get_resource(const char* path, u1*& buffer, u8& size) const;
// Return an array of packages for a given module
GrowableArray<const char*>* packages(const char* name);
};
#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP

@ -110,7 +110,7 @@ bool SharedPathsMiscInfo::check() {
bool SharedPathsMiscInfo::check(jint type, const char* path) {
switch (type) {
case BOOT:
if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
}
break;

@ -217,9 +217,14 @@ void FileMapInfo::allocate_classpath_entry_table() {
EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
} else {
ent->_filesize = -1;
if (!os::dir_is_empty(name)) {
ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
struct stat st;
if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
if (!os::dir_is_empty(name)) {
ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
}
ent->_filesize = -1;
} else {
ent->_filesize = -2;
}
}
ent->_name = strptr;
@ -271,7 +276,7 @@ bool FileMapInfo::validate_classpath_entry_table() {
fail_continue("directory is not empty: %s", name);
ok = false;
}
} else {
} else if (ent->is_jar()) {
if (ent->_timestamp != st.st_mtime ||
ent->_filesize != st.st_size) {
ok = false;

@ -44,8 +44,11 @@ class Metaspace;
class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
public:
const char *_name;
time_t _timestamp; // jar timestamp, 0 if is directory
long _filesize; // jar file size, -1 if is directory
time_t _timestamp; // jar timestamp, 0 if is directory or other
long _filesize; // jar file size, -1 if is directory, -2 if other
bool is_jar() {
return _timestamp != 0;
}
bool is_dir() {
return _filesize == -1;
}

@ -115,8 +115,6 @@ exit_hook_t Arguments::_exit_hook = NULL;
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
SystemProperty *Arguments::_java_ext_dirs = NULL;
SystemProperty *Arguments::_java_endorsed_dirs = NULL;
SystemProperty *Arguments::_sun_boot_library_path = NULL;
SystemProperty *Arguments::_java_library_path = NULL;
SystemProperty *Arguments::_java_home = NULL;
@ -125,6 +123,7 @@ SystemProperty *Arguments::_sun_boot_class_path = NULL;
char* Arguments::_meta_index_path = NULL;
char* Arguments::_meta_index_dir = NULL;
char* Arguments::_ext_dirs = NULL;
// Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
@ -184,8 +183,6 @@ void Arguments::init_system_properties() {
// Following are JVMTI agent writable properties.
// Properties values are set to NULL and they are
// os specific they are initialized in os::init_system_properties_values().
_java_ext_dirs = new SystemProperty("java.ext.dirs", NULL, true);
_java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL, true);
_sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL, true);
_java_library_path = new SystemProperty("java.library.path", NULL, true);
_java_home = new SystemProperty("java.home", NULL, true);
@ -194,8 +191,6 @@ void Arguments::init_system_properties() {
_java_class_path = new SystemProperty("java.class.path", "", true);
// Add to System Property list.
PropertyList_add(&_system_properties, _java_ext_dirs);
PropertyList_add(&_system_properties, _java_endorsed_dirs);
PropertyList_add(&_system_properties, _sun_boot_library_path);
PropertyList_add(&_system_properties, _java_library_path);
PropertyList_add(&_system_properties, _java_home);
@ -344,13 +339,9 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
// components, in order:
//
// prefix // from -Xbootclasspath/p:...
// endorsed // the expansion of -Djava.endorsed.dirs=...
// base // from os::get_system_properties() or -Xbootclasspath=
// suffix // from -Xbootclasspath/a:...
//
// java.endorsed.dirs is a list of directories; any jar or zip files in the
// directories are added to the sysclasspath just before the base.
//
// This could be AllStatic, but it isn't needed after argument processing is
// complete.
class SysClassPath: public StackObj {
@ -364,16 +355,9 @@ public:
inline void add_suffix(const char* suffix);
inline void reset_path(const char* base);
// Expand the jar/zip files in each directory listed by the java.endorsed.dirs
// property. Must be called after all command-line arguments have been
// processed (in particular, -Djava.endorsed.dirs=...) and before calling
// combined_path().
void expand_endorsed();
inline const char* get_base() const { return _items[_scp_base]; }
inline const char* get_prefix() const { return _items[_scp_prefix]; }
inline const char* get_suffix() const { return _items[_scp_suffix]; }
inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
// Combine all the components into a single c-heap-allocated string; caller
// must free the string if/when no longer needed.
@ -390,20 +374,17 @@ private:
// base are allocated in the C heap and freed by this class.
enum {
_scp_prefix, // from -Xbootclasspath/p:...
_scp_endorsed, // the expansion of -Djava.endorsed.dirs=...
_scp_base, // the default sysclasspath
_scp_suffix, // from -Xbootclasspath/a:...
_scp_nitems // the number of items, must be last.
};
const char* _items[_scp_nitems];
DEBUG_ONLY(bool _expansion_done;)
};
SysClassPath::SysClassPath(const char* base) {
memset(_items, 0, sizeof(_items));
_items[_scp_base] = base;
DEBUG_ONLY(_expansion_done = false;)
}
SysClassPath::~SysClassPath() {
@ -411,7 +392,6 @@ SysClassPath::~SysClassPath() {
for (int i = 0; i < _scp_nitems; ++i) {
if (i != _scp_base) reset_item_at(i);
}
DEBUG_ONLY(_expansion_done = false;)
}
inline void SysClassPath::set_base(const char* base) {
@ -447,41 +427,11 @@ inline void SysClassPath::reset_path(const char* base) {
//------------------------------------------------------------------------------
void SysClassPath::expand_endorsed() {
assert(_items[_scp_endorsed] == NULL, "can only be called once.");
const char* path = Arguments::get_property("java.endorsed.dirs");
if (path == NULL) {
path = Arguments::get_endorsed_dir();
assert(path != NULL, "no default for java.endorsed.dirs");
}
char* expanded_path = NULL;
const char separator = *os::path_separator();
const char* const end = path + strlen(path);
while (path < end) {
const char* tmp_end = strchr(path, separator);
if (tmp_end == NULL) {
expanded_path = add_jars_to_path(expanded_path, path);
path = end;
} else {
char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
memcpy(dirpath, path, tmp_end - path);
dirpath[tmp_end - path] = '\0';
expanded_path = add_jars_to_path(expanded_path, dirpath);
FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
path = tmp_end + 1;
}
}
_items[_scp_endorsed] = expanded_path;
DEBUG_ONLY(_expansion_done = true;)
}
// Combine the bootclasspath elements, some of which may be null, into a single
// c-heap-allocated string.
char* SysClassPath::combined_path() {
assert(_items[_scp_base] != NULL, "empty default sysclasspath");
assert(_expansion_done, "must call expand_endorsed() first.");
size_t lengths[_scp_nitems];
size_t total_len = 0;
@ -3084,6 +3034,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
#endif
// -D
} else if (match_option(option, "-D", &tail)) {
if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
// abort if -Djava.endorsed.dirs is set
jio_fprintf(defaultStream::output_stream(),
"-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
"in modular form will be supported via the concept of upgradeable modules.\n");
return JNI_EINVAL;
}
if (match_option(option, "-Djava.ext.dirs=", &tail)) {
// abort if -Djava.ext.dirs is set
jio_fprintf(defaultStream::output_stream(),
"-Djava.ext.dirs is not supported. Use -classpath instead.\n");
return JNI_EINVAL;
}
if (!add_property(tail)) {
return JNI_ENOMEM;
}
@ -3529,11 +3493,89 @@ void Arguments::fix_appclasspath() {
}
}
jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
// This must be done after all -D arguments have been processed.
scp_p->expand_endorsed();
static bool has_jar_files(const char* directory) {
DIR* dir = os::opendir(directory);
if (dir == NULL) return false;
if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
struct dirent *entry;
char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
bool hasJarFile = false;
while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
const char* name = entry->d_name;
const char* ext = name + strlen(name) - 4;
hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
}
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
os::closedir(dir);
return hasJarFile ;
}
static int check_non_empty_dirs(const char* path) {
const char separator = *os::path_separator();
const char* const end = path + strlen(path);
int nonEmptyDirs = 0;
while (path < end) {
const char* tmp_end = strchr(path, separator);
if (tmp_end == NULL) {
if (has_jar_files(path)) {
nonEmptyDirs++;
jio_fprintf(defaultStream::output_stream(),
"Non-empty directory: %s\n", path);
}
path = end;
} else {
char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
memcpy(dirpath, path, tmp_end - path);
dirpath[tmp_end - path] = '\0';
if (has_jar_files(dirpath)) {
nonEmptyDirs++;
jio_fprintf(defaultStream::output_stream(),
"Non-empty directory: %s\n", dirpath);
}
FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
path = tmp_end + 1;
}
}
return nonEmptyDirs;
}
jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
// check if the default lib/endorsed directory exists; if so, error
char path[JVM_MAXPATHLEN];
const char* fileSep = os::file_separator();
sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
if (CheckEndorsedAndExtDirs) {
int nonEmptyDirs = 0;
// check endorsed directory
nonEmptyDirs += check_non_empty_dirs(path);
// check the extension directories
nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
if (nonEmptyDirs > 0) {
return JNI_ERR;
}
}
DIR* dir = os::opendir(path);
if (dir != NULL) {
jio_fprintf(defaultStream::output_stream(),
"<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
"in modular form will be supported via the concept of upgradeable modules.\n");
os::closedir(dir);
return JNI_ERR;
}
sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
dir = os::opendir(path);
if (dir != NULL) {
jio_fprintf(defaultStream::output_stream(),
"<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; "
"Use -classpath instead.\n.");
os::closedir(dir);
return JNI_ERR;
}
if (scp_assembly_required) {
// Assemble the bootclasspath elements into the final path.
Arguments::set_sysclasspath(scp_p->combined_path());
}

@ -254,8 +254,6 @@ class Arguments : AllStatic {
static SystemProperty* _system_properties;
// Quick accessor to System properties in the list:
static SystemProperty *_java_ext_dirs;
static SystemProperty *_java_endorsed_dirs;
static SystemProperty *_sun_boot_library_path;
static SystemProperty *_java_library_path;
static SystemProperty *_java_home;
@ -266,6 +264,10 @@ class Arguments : AllStatic {
static char* _meta_index_path;
static char* _meta_index_dir;
// temporary: to emit warning if the default ext dirs are not empty.
// remove this variable when the warning is no longer needed.
static char* _ext_dirs;
// java.vendor.url.bug, bug reporting URL for fatal errors.
static const char* _java_vendor_url_bug;
@ -586,8 +588,7 @@ class Arguments : AllStatic {
static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
static void set_java_home(char *value) { _java_home->set_value(value); }
static void set_library_path(char *value) { _java_library_path->set_value(value); }
static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@ -597,14 +598,14 @@ class Arguments : AllStatic {
static char* get_java_home() { return _java_home->value(); }
static char* get_dll_dir() { return _sun_boot_library_path->value(); }
static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
static char* get_meta_index_path() { return _meta_index_path; }
static char* get_meta_index_dir() { return _meta_index_dir; }
static char* get_ext_dirs() { return _java_ext_dirs->value(); }
static char* get_ext_dirs() { return _ext_dirs; }
static char* get_appclasspath() { return _java_class_path->value(); }
static void fix_appclasspath();
// Operation modi
static Mode mode() { return _mode; }
static bool is_interpreter_only() { return mode() == _int; }

@ -1233,6 +1233,9 @@ class CommandLineFlags {
product(bool, CheckJNICalls, false, \
"Verify all arguments to JNI calls") \
\
product(bool, CheckEndorsedAndExtDirs, false, \
"Verify the endorsed and extension directories are not used") \
\
product(bool, UseFastJNIAccessors, true, \
"Use optimized versions of Get<Primitive>Field") \
\

@ -1230,11 +1230,21 @@ bool os::set_boot_path(char fileSep, char pathSep) {
Arguments::set_meta_index_path(meta_index, meta_index_dir);
char* sysclasspath = NULL;
struct stat st;
// modular image if bootmodules.jimage exists
char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
if (jimage == NULL) return false;
bool has_jimage = (os::stat(jimage, &st) == 0);
if (has_jimage) {
Arguments::set_sysclasspath(jimage);
return true;
}
FREE_C_HEAP_ARRAY(char, jimage, mtInternal);
// images build if rt.jar exists
char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
if (rt_jar == NULL) return false;
struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);

@ -500,6 +500,7 @@ class os: AllStatic {
//File i/o operations
static size_t read(int fd, void *buf, unsigned int nBytes);
static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
static size_t write(int fd, const void *buf, unsigned int nBytes);

@ -225,8 +225,6 @@ static const char* property_counters_ss[] = {
"java.vm.info",
"java.library.path",
"java.class.path",
"java.endorsed.dirs",
"java.ext.dirs",
"java.version",
"java.home",
NULL

@ -235,6 +235,11 @@ endif
################################################################################
java.scripting_COPY := .js
java.scripting_CLEAN := .properties
################################################################################
java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
@ -318,6 +323,9 @@ jdk.charsets_COPY := .dat
################################################################################
jdk.compiler_COPY := javax.tools.JavaCompilerTool
jdk.compiler_CLEAN_FILES := $(wildcard \
$(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
sun/tools/serialver/resources))
################################################################################
@ -366,12 +374,6 @@ jdk.jconsole_CLEAN_FILES := $(wildcard \
################################################################################
jdk.compiler_CLEAN_FILES := $(wildcard \
$(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
sun/tools/serialver/resources))
################################################################################
jdk.jdi_EXCLUDES += \
com/sun/tools/example/debug/bdi \
com/sun/tools/example/debug/event \
@ -426,10 +428,8 @@ jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
#
# To use this variable, use $(call ALL_SRC_DIRS,module) with no space.
GENERATED_SRC_DIRS += \
$(JDK_OUTPUTDIR)/gensrc/$1 \
$(LANGTOOLS_OUTPUTDIR)/gensrc/$1 \
$(CORBA_OUTPUTDIR)/gensrc/$1 \
$(JDK_OUTPUTDIR)/gensrc_no_srczip/$1 \
$(SUPPORT_OUTPUTDIR)/gensrc/$1 \
$(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$1 \
#
OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes
@ -488,7 +488,7 @@ define SetupModuleCompilation
SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
BIN := $(JDK_OUTPUTDIR)/modules/$1, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers/$1, \
HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
$1: $$($1) $$($1_COPY_EXTRA)

496
make/Images.gmk Normal file

@ -0,0 +1,496 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
TOOL_TARGETS :=
JDK_TARGETS :=
JRE_TARGETS :=
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Images-pre.gmk))
############################################################################
MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
jdk.security.auth jdk.security.jgss jdk.runtime
# providers
PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
# tools
TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
jdk.xml.bind jdk.xml.ws
ifeq ($(OPENJDK_TARGET_OS), windows)
PROVIDER_MODULES += jdk.crypto.mscapi
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
PROVIDER_MODULES += jdk.crypto.ucrypto
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
MAIN_MODULES += jdk.deploy.osx
endif
JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)
# compact3 builds have additional modules
JDK_COMPACT3_MODULES := java.compact3 java.smartcardio jdk.httpserver jdk.naming.dns \
jdk.naming.rmi jdk.sctp jdk.security.auth
# Replacing double-comma with a single comma is to workaround the issue
# with some version of make on windows that doesn't substitute spaces
# with one comma properly as with make 4.0
define SubstComma
$(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
endef
JRE_MODULES_LIST := $(call SubstComma, $(JRE_MODULES))
JDK_MODULES_LIST := $(call SubstComma, $(JDK_MODULES))
################################################################################
JRE_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jre-sorted-modules
JDK_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jdk-sorted-modules
JRE_COMPACT1_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact1-sorted-modules
JRE_COMPACT2_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact2-sorted-modules
JRE_COMPACT3_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact3-sorted-modules
MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
MODULES_CONF := $(SUPPORT_OUTPUTDIR)/modules_conf
JIMAGE_TOOL := $(JAVA_SMALL) \
-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
-cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.module.ImageBuilder \
--cmds $(MODULES_CMDS) \
--libs $(MODULES_LIBS) \
--configs $(MODULES_CONF) \
--classes $(JDK_OUTPUTDIR)/modules \
--endian $(OPENJDK_TARGET_CPU_ENDIAN) \
#
MODULES_XML += $(SRC_ROOT)/modules.xml
DEPENDENCIES := $(call CacheFind, \
$(SUPPORT_OUTPUTDIR)/modules_cmds \
$(SUPPORT_OUTPUTDIR)/modules_libs) \
$(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
$(MODULES_XML)
#
# Use this file inside the image as target for make rule
JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
$(ECHO) Creating jdk jimage
$(RM) -r $(JDK_IMAGE_DIR) $(JDK_SORTED_MODULES)
$(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
$(MODULES_XML) > $(JDK_SORTED_MODULES)
$(TOUCH) $@
$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
$(ECHO) Creating jre jimage
$(RM) -r $(JRE_IMAGE_DIR) $(JRE_SORTED_MODULES)
$(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
$(MODULES_XML) > $(JRE_SORTED_MODULES)
$(TOUCH) $@
JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
$(ECHO) Creating jre compact1 jimage
$(RM) -r $(JRE_COMPACT1_IMAGE_DIR) $(JRE_COMPACT1_SORTED_MODULES)
$(JIMAGE_TOOL) \
--mods $(call SubstComma, java.compact1 $(COMPACT_EXTRA_MODULES)) \
--output $(JRE_COMPACT1_IMAGE_DIR) \
$(MODULES_XML) > $(JRE_COMPACT1_SORTED_MODULES)
$(TOUCH) $@
$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
$(ECHO) Creating jre compact2 jimage
$(RM) -r $(JRE_COMPACT2_IMAGE_DIR) $(JRE_COMPACT2_SORTED_MODULES)
$(JIMAGE_TOOL) \
--mods $(call SubstComma, java.compact2 $(COMPACT_EXTRA_MODULES)) \
--output $(JRE_COMPACT2_IMAGE_DIR) \
$(MODULES_XML) > $(JRE_COMPACT2_SORTED_MODULES)
$(TOUCH) $@
$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
$(ECHO) Creating jre compact3 jimage
$(RM) -r $(JRE_COMPACT3_IMAGE_DIR) $(JRE_COMPACT3_SORTED_MODULES)
$(JIMAGE_TOOL) \
--mods $(call SubstComma, $(JDK_COMPACT3_MODULES) $(COMPACT_EXTRA_MODULES)) \
--output $(JRE_COMPACT3_IMAGE_DIR) \
$(MODULES_XML) > $(JRE_COMPACT3_SORTED_MODULES)
$(TOUCH) $@
TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
TOOL_JRE_COMPACT1_TARGETS := $(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
TOOL_JRE_COMPACT2_TARGETS := $(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
TOOL_JRE_COMPACT3_TARGETS := $(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
################################################################################
# /man dir
#
# All variables in this section are assigned with simple =, without :, to enable
# more selective overriding from the custom version of this file.
#
# Avoid evaluating this whole section on windows for speed and stability
ifneq ($(OPENJDK_TARGET_OS), windows)
JRE_MAN_PAGES += \
java.1 \
jjs.1 \
keytool.1 \
orbd.1 \
pack200.1 \
policytool.1 \
rmid.1 \
rmiregistry.1 \
servertool.1 \
tnameserv.1 \
unpack200.1
ifndef OPENJDK
ifneq ($(OPENJDK_TARGET_OS), solaris)
JRE_MAN_PAGES += javaws.1
endif
endif
JDK_MAN_PAGES += \
$(JRE_MAN_PAGES) \
appletviewer.1 \
idlj.1 \
jar.1 \
jarsigner.1 \
javac.1 \
javadoc.1 \
javah.1 \
javap.1 \
jconsole.1 \
jcmd.1 \
jdb.1 \
jdeps.1 \
jhat.1 \
jinfo.1 \
jmap.1 \
jps.1 \
jrunscript.1 \
jsadebugd.1 \
jstack.1 \
jstat.1 \
jstatd.1 \
native2ascii.1 \
rmic.1 \
schemagen.1 \
serialver.1 \
wsgen.1 \
wsimport.1 \
xjc.1
# This variable is potentially overridden in the closed makefile.
MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
ifeq ($(OPENJDK_TARGET_OS), linux)
MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
MAN1_SUBDIR = man
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
MAN1_SUBDIR = sun/man/man1
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
MAN1_SUBDIR = man
endif
$(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(install-file)
$(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(install-file)
define install-ja-manpage
$(MKDIR) -p $(@D)
$(CAT) $< \
| $(NATIVE2ASCII) -encoding eucJP \
| $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
| $(NATIVE2ASCII) -reverse -encoding $1 \
> $@
endef
$(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call install-ja-manpage, UTF-8)
$(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call install-ja-manpage, UTF-8)
$(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call install-ja-manpage, PCK)
$(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(call install-ja-manpage, PCK)
ifeq ($(OPENJDK_TARGET_OS), solaris)
$(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(install-file)
$(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(install-file)
endif
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
$(JRE_IMAGE_DIR)/man/ja:
$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
$(JDK_IMAGE_DIR)/man/ja:
$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
$(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
$(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
$(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
$(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
$(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
$(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
endif
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
$(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
$(JRE_IMAGE_DIR)/man/ja
JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
$(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
$(JDK_IMAGE_DIR)/man/ja
endif
JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
endif # Windows
################################################################################
# /include dir
$(eval $(call SetupCopyFiles,COPY_INCLUDES, \
SRC := $(JDK_OUTPUTDIR)/include, \
DEST := $(JDK_IMAGE_DIR)/include, \
FILES := $(call CacheFind,$(JDK_OUTPUTDIR)/include)))
JDK_TARGETS += $(COPY_INCLUDES)
################################################################################
# doc files
JRE_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
JDK_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
JRE_DOC_LOCATION ?= $(JDK_TOPDIR)
JDK_DOC_LOCATION ?= $(JDK_TOPDIR)
JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
# Processing license files from source area to image area
# These are modified to have the platform specific EOL chars.
define process-doc-file
$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(RM) $@
LC_ALL=C $(SED) 's/$$//g' $< > $@
$(CHMOD) 444 $@
endef
$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
$(process-doc-file)
$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
$(process-doc-file)
JRE_TARGETS += $(JRE_DOC_TARGETS)
JDK_TARGETS += $(JDK_DOC_TARGETS)
################################################################################
# Release file
JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
JRE_COMPACT1_INFO_FILE := $(JRE_COMPACT1_IMAGE_DIR)/release
JRE_COMPACT2_INFO_FILE := $(JRE_COMPACT2_IMAGE_DIR)/release
JRE_COMPACT3_INFO_FILE := $(JRE_COMPACT3_IMAGE_DIR)/release
# Common way to emit a line into the release or info file
define info-file-item # name value
$(PRINTF) '%s="%s"\n' $1 $2 >> $@
endef
# Param 1 - The file containing the MODULES list
define create-info-file
$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(RM) $@
$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
$(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
$(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
$(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
$(if $(JDK_ARCH_ABI_PROP_NAME), \
$(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
$(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
$(call info-file-item, "MODULES", "`$(CAT) $1`")
endef
ALL_SOURCE_TIPS = $(shell \
if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
$(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
fi)
$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
$(call create-info-file, $(JRE_SORTED_MODULES))
$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
$(call create-info-file, $(JDK_SORTED_MODULES))
$(JRE_COMPACT1_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
$(call create-info-file, $(JRE_COMPACT1_SORTED_MODULES))
$(call info-file-item, "JAVA_PROFILE", "compact1")
$(JRE_COMPACT2_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
$(call create-info-file, $(JRE_COMPACT2_SORTED_MODULES))
$(call info-file-item, "JAVA_PROFILE", "compact2")
$(JRE_COMPACT3_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
$(call create-info-file, $(JRE_COMPACT3_SORTED_MODULES))
$(call info-file-item, "JAVA_PROFILE", "compact3")
JRE_TARGETS += $(JRE_INFO_FILE)
JDK_TARGETS += $(JDK_INFO_FILE)
JRE_COMPACT1_TARGETS += $(JRE_COMPACT1_INFO_FILE)
JRE_COMPACT2_TARGETS += $(JRE_COMPACT2_INFO_FILE)
JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
################################################################################
# src.zip
$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(install-file)
JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
################################################################################
# /demo dir
# The db demo contains an empty dir that needs to be copied. The other
# directories will always trigger the rule for recompile since
# _the.list_of_packages files are touched.
ifneq ($(findstring images, $(MAKECMDGOALS)), )
$(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demo/image/%
if [ ! -d "$@" ]; then \
$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
$(MKDIR) -p $(@D); \
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
fi
# Find all files including directories
JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demo/image), \
$(patsubst $(SUPPORT_OUTPUTDIR)/demo/image/%, $(JDK_IMAGE_DIR)/demo/%, \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demo/image \
! \( -name "_the*" -o -name "javac_state" \) )))
JDK_TARGETS += $(JDK_DEMO_TARGETS)
endif
################################################################################
# /sample dir
$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
SRC := $(SUPPORT_OUTPUTDIR)/sample, \
DEST := $(JDK_IMAGE_DIR)/sample, \
FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \
$(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample))))
JDK_TARGETS += $(COPY_SAMPLES)
################################################################################
# jrt-fs.jar
$(eval $(call SetupCopyFiles,COPY_JRTFS_JAR, \
SRC := $(SUPPORT_OUTPUTDIR), \
DEST := $(JDK_IMAGE_DIR), \
FILES := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar))
JDK_TARGETS += $(COPY_JRTFS_JAR)
################################################################################
# Include custom post hook here to make it possible to augment the target lists
# before actual target prerequisites are declared.
$(eval $(call IncludeCustomExtension, , Images-post.gmk))
################################################################################
$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)
$(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
$(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
$(JRE_COMPACT3_TARGETS): $(TOOL_JRE_COMPACT3_TARGETS)
profiles: $(TOOL_JRE_COMPACT1_TARGETS) \
$(TOOL_JRE_COMPACT2_TARGETS) \
$(TOOL_JRE_COMPACT3_TARGETS) \
$(JRE_COMPACT1_TARGETS) \
$(JRE_COMPACT2_TARGETS) \
$(JRE_COMPACT3_TARGETS)
.PHONY: default all jimages profiles

@ -44,8 +44,8 @@ include NON_CORE_PKGS.gmk
# Definitions for directories
#
DOCSDIR := $(OUTPUT_ROOT)/docs
TEMPDIR := $(OUTPUT_ROOT)/docstemp
DOCSDIR := $(IMAGES_OUTPUTDIR)/docs
DOCSTMPDIR = $(SUPPORT_OUTPUTDIR)/docs
HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
@ -142,9 +142,8 @@ ALL_SOURCE_DIRS := $(wildcard \
$(CORBA_TOPDIR)/src/*/share/classes \
$(JAXP_TOPDIR)/src/*/share/classes \
$(JAXWS_TOPDIR)/src/*/share/classes \
$(JDK_OUTPUTDIR)/gensrc/j* \
$(JDK_OUTPUTDIR)/gendocsrc_rmic \
$(CORBA_OUTPUTDIR)/gensrc/j* \
$(SUPPORT_OUTPUTDIR)/gensrc/j* \
$(SUPPORT_OUTPUTDIR)/rmic/j* \
$(JDK_TOPDIR)/src/*/share/doc/stub \
) \
#
@ -201,11 +200,6 @@ define JavadocSummary # optionsfile packagesfile
@($(ECHO) "# Packages (`$(BASENAME) $2`):";$(SED) -e 's@^@# @' $2) $(LOG_DEBUG)
endef
#
# Temporary directory for javadoc creation
#
DOCSTMPDIR = $(TEMPDIR)/doctmp
#
# Different api directories created from root directory
#
@ -271,7 +265,6 @@ define COMMON_JAVADOCFLAGS
$(call OptionOnly,-quiet) ; \
$(call OptionOnly,-use) ; \
$(call OptionOnly,-keywords) ; \
$(call OptionPair,-Xprofilespath,$(JDK_TOPDIR)/make/profile-rtjar-includes.txt) ; \
$(call OptionOnly,$(ADDITIONAL_JAVADOCFLAGS))
endef
@ -668,7 +661,7 @@ ALL_OTHER_TARGETS += jdwpdocs
JDWP_DOCDIR = $(PLATFORM_DOCSDIR)/jpda/jdwp
jdwpdocs: $(JDWP_DOCDIR)/jdwp-protocol.html
$(JDWP_DOCDIR)/jdwp-protocol.html : $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
$(JDWP_DOCDIR)/jdwp-protocol.html : $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@

37
make/JrtfsJar.gmk Normal file

@ -0,0 +1,37 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
$(eval $(call SetupArchive,JRTFS_JAR, , \
SRCS := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
JAR := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar, \
MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
all: $(JRTFS_JAR)

137
make/MacBundles.gmk Normal file

@ -0,0 +1,137 @@
#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include $(SPEC)
include MakeBase.gmk
default: bundles
# Only macosx has bundles defined.
ifeq ($(OPENJDK_TARGET_OS), macosx)
bundles: jre-bundle jdk-bundle
# JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
# All these OPENJDK checks are needed since there is no coherency between
# these values in open and closed. Should probably be fixed.
ifndef OPENJDK
BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
else
BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
endif
BUNDLE_ID_JRE := $(BUNDLE_ID).jre
BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
BUNDLE_NAME_JRE := $(BUNDLE_NAME)
BUNDLE_NAME_JDK := $(BUNDLE_NAME)
ifndef OPENJDK
BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
else
BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
endif
BUNDLE_INFO_JRE := $(BUNDLE_INFO)
BUNDLE_INFO_JDK := $(BUNDLE_INFO)
BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
BUNDLE_VERSION := $(JDK_VERSION)
ifeq ($(COMPANY_NAME), N/A)
BUNDLE_VENDOR := UNDEFINED
else
BUNDLE_VENDOR := $(COMPANY_NAME)
endif
JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
# Copy empty directories (jre/lib/applet).
$(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
$(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
$(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
-e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
-e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
-e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
-e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
-e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
< $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
$(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
$(MKDIR) -p $(@D)
$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
-e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
-e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
-e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
-e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
-e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
< $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
$(JDK_BUNDLE_DIR)/Info.plist
$(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
$(JRE_BUNDLE_DIR)/Info.plist
$(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
else # Not macosx
bundles:
$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
endif # macosx
.PHONY: jdk-bundle jre-bundle bundles

@ -39,9 +39,6 @@ include $(SRC_ROOT)/make/MakeHelpers.gmk
include $(SRC_ROOT)/make/common/MakeBase.gmk
include $(SRC_ROOT)/make/common/Modules.gmk
# Load common profile names definitions
include $(JDK_TOPDIR)/make/ProfileNames.gmk
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
# valid top level targets. It's used to declare them all as PHONY and to
# generate the -only targets.
@ -64,19 +61,23 @@ ALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
################################################################################
# Interim/build tools targets, compiling tools used during the build
buildtools-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
interim-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-corba:
+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
build-tools-jdk:
buildtools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
ALL_TARGETS += interim-langtools interim-corba build-tools-jdk
ALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
interim-rmic buildtools-jdk
################################################################################
# Special targets for certain modules
@ -87,56 +88,42 @@ import-hotspot:
unpack-sec:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
policy-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)
ALL_TARGETS += import-hotspot unpack-sec policy-jars
ALL_TARGETS += import-hotspot unpack-sec
################################################################################
# Gensrc targets, generating source before java compilation can be done
JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
CORBA_GENSRC_MODULES := java.corba
GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
$(CORBA_GENSRC_MODULES)
JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))
$(eval $(call DeclareRecipesForPhase, GENSRC, \
TARGET_SUFFIX := gensrc, \
FILE_PREFIX := Gensrc, \
MAKE_SUBDIR := gensrc, \
CHECK_MODULES := $(ALL_MODULES), \
MULTIPLE_MAKEFILES := true))
jdk.compiler.tools-gensrc:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)
java.corba-gensrc:
+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)
# Declare recipes for all jdk <module>-gensrc targets
$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, gensrc, gensrc, Gensrc)))
JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
ALL_TARGETS += $(GENSRC_TARGETS)
################################################################################
# Generate data targets
GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))
# Declare recipes for all <module>-gendata targets
$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, gendata, gendata, Gendata)))
$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))
$(eval $(call DeclareRecipesForPhase, GENDATA, \
TARGET_SUFFIX := gendata, \
FILE_PREFIX := Gendata, \
MAKE_SUBDIR := gendata, \
CHECK_MODULES := $(ALL_MODULES), \
USE_WRAPPER := true))
ALL_TARGETS += $(GENDATA_TARGETS)
################################################################################
# Copy files targets
COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))
# Declare recipes for all <module>-copy targets
$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, copy, copy, Copy)))
$(eval $(call DeclareRecipesForPhase, COPY, \
TARGET_SUFFIX := copy, \
FILE_PREFIX := Copy, \
MAKE_SUBDIR := copy, \
CHECK_MODULES := $(ALL_MODULES), \
USE_WRAPPER := true))
ALL_TARGETS += $(COPY_TARGETS)
@ -163,36 +150,33 @@ ALL_TARGETS += $(JAVA_TARGETS)
################################################################################
# Targets for running rmic.
RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))
# Declare recipes for all <module>-rmic targets
$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, rmic, rmic, Rmic)))
$(eval $(call DeclareRecipesForPhase, RMIC, \
TARGET_SUFFIX := rmic, \
FILE_PREFIX := Rmic, \
MAKE_SUBDIR := rmic, \
CHECK_MODULES := $(ALL_MODULES)))
ALL_TARGETS += $(RMIC_TARGETS)
################################################################################
# Targets for compiling native libraries
ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))
$(eval $(call DeclareRecipesForPhase, LIBS, \
TARGET_SUFFIX := libs, \
FILE_PREFIX := Lib, \
MAKE_SUBDIR := lib, \
CHECK_MODULES := $(ALL_MODULES), \
USE_WRAPPER := true))
# Declare recipes for all <module>-libs targets
$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, libs, lib, Lib)))
ALL_TARGETS += $(LIB_TARGETS)
ALL_TARGETS += $(LIBS_TARGETS)
################################################################################
# Targets for compiling native executables
ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))
# Declare recipes for all <module>-launchers targets
$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, launchers, launcher, Launcher)))
$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
TARGET_SUFFIX := launchers, \
FILE_PREFIX := Launcher, \
MAKE_SUBDIR := launcher, \
CHECK_MODULES := $(ALL_MODULES), \
USE_WRAPPER := true))
ALL_TARGETS += $(LAUNCHER_TARGETS)
@ -222,53 +206,40 @@ ALL_TARGETS += demos samples
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
source-tips: $(OUTPUT_ROOT)/source_tips
$(OUTPUT_ROOT)/source_tips: FRC
source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
$(SUPPORT_OUTPUTDIR)/source_tips: FRC
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(call GetSourceTips)
security-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)
nashorn-jar:
+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)
# Creates the jar files (rt.jar resources.jar etc)
main-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
# Creates the images (j2sdk-image j2re-image etc)
images:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
ifeq ($(OPENJDK_TARGET_OS), macosx)
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
endif
# Create Compact Profile jars
PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
$(PROFILE_JARS_TARGETS):
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)
# Create Compact Profile images
PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
$(PROFILE_IMAGES_TARGETS):
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
-f Images.gmk profile-image)
profiles-oscheck:
ifneq ($(OPENJDK_TARGET_OS), linux)
@echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
endif
BOOTCYCLE_TARGET := images
bootcycle-images:
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
$(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
bootcycle-images
zip-security:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
zip-source:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
strip-binaries:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
jrtfs-jar:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
jimages:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
profiles:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
mac-bundles:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
jrtfs-jar jimages profiles mac-bundles
################################################################################
# Docs targets
@ -331,17 +302,19 @@ ALL_TARGETS += install
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
.NOTPARALLEL:
else
$(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
build-tools-jdk: interim-langtools
buildtools-jdk: interim-langtools
$(CORBA_GENSRC_TARGETS): interim-langtools
$(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk
$(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
interim-corba: $(CORBA_GENSRC_TARGETS)
$(GENDATA_TARGETS): interim-langtools build-tools-jdk
$(GENDATA_TARGETS): interim-langtools buildtools-jdk
interim-rmic: interim-langtools
@ -349,7 +322,7 @@ else
import-hotspot: hotspot
$(LIB_TARGETS): import-hotspot
$(LIBS_TARGETS): import-hotspot
$(LAUNCHER_TARGETS): java.base-libs
@ -371,55 +344,53 @@ else
# Declare dependencies from <module>-lib to <module>-java
# Skip jdk.jdwp.agent as it contains no java code.
$(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))
$(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
# Declare dependencies from all other <module>-lib to java.base-lib
$(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
$(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
$(eval $t: java.base-libs))
# Declare the special case dependency for jdk.deploy.osx where libosx
# links against libosxapp.
jdk.deploy.osx-libs: java.desktop-libs
# This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
# header file used by jdk.jdwp libs.
jdk.jdwp.agent-libs: jdk.jdi-gensrc
# This dependency needs to be explicitly declared as jdk.jdi-gensrc generates a
# header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
# virtual target.
jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
# Until the module system is in place, jdk.jdi-gensrc needs to combine service
# loader configuration with jdk.hotspot.agent so is dependent on importing
# hotspot.
jdk.jdi-gensrc-jdk: import-hotspot
# The swing beans need to have java base properly generated to avoid errors
# in javadoc.
java.desktop-gensrc: java.base-gensrc
java.desktop-gensrc-jdk: java.base-gensrc
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
jdk.dev-gendata: java rmic
security-jars: java
zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
$(filter jdk.crypto%, $(JAVA_TARGETS))
nashorn-jar: jdk.scripting.nashorn-java
zip-source: gensrc rmic
main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot gendata
strip-binaries: libs launchers gendata copy
# On windows, the jars target needs to wait for jgss libs to be built.
# Should ideally split out the sec-bin zip file generation to avoid
# this dependency.
ifeq ($(OPENJDK_TARGET_OS), windows)
main-jars: java.security.jgss-libs
endif
jrtfs-jar: buildtools-jdk
images: jars demos samples exploded-image verify-modules source-tips
jimages: exploded-image zip-source strip-binaries source-tips demos samples \
jrtfs-jar
bootcycle-images: images
profiles: exploded-image strip-binaries source-tips
# Need to depend on jars as otherwise there will a race between all the
# invocations of CreateJars.gmk.
$(PROFILE_JARS_TARGETS): jars profiles-oscheck
mac-bundles: jimages
$(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips
bootcycle-images: jimages
# Declare dependencies from <profile>-images to <profile>-jars
$(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))
docs-javadoc: $(GENSRC_TARGETS) rmic
docs-javadoc: gensrc rmic
docs-jvmtidoc: hotspot
@ -432,6 +403,9 @@ endif
################################################################################
# Virtual targets without recipes
buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
buildtools-jdk
gensrc: $(GENSRC_TARGETS)
gendata: $(GENDATA_TARGETS)
@ -442,12 +416,13 @@ java: $(JAVA_TARGETS)
rmic: $(RMIC_TARGETS)
libs: $(LIB_TARGETS)
libs: $(LIBS_TARGETS)
launchers: $(LAUNCHER_TARGETS)
# Explicitly add dependencies for these special targets
java.base: import-hotspot policy-jars
# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
# is actually handled by jdk.jdi-gensrc
jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
# Declare dependencies from <module> to all the individual targets specific
# to that module <module>-*.
@ -455,34 +430,33 @@ $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
$(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
$(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
exploded-image: $(ALL_MODULE_TARGETS)
# The old 'jdk' target most closely matches the new exploded-image. Keep an
# alias for ease of use.
jdk: exploded-image
jars: main-jars nashorn-jar security-jars policy-jars
images: jimages demos samples zip-security
# Make each profile name a target that depends on it's images target.
$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
profiles: $(ALL_PROFILES)
ifeq ($(OPENJDK_TARGET_OS), macosx)
images: mac-bundles
endif
docs: docs-javadoc docs-jvmtidoc
ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
$(ALL_MODULE_TARGETS) exploded-image jdk jars \
$(ALL_PROFILES) profiles docs
ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
docs
################################################################################
all: images docs
all: images
default: exploded-image
ALL_TARGETS += default all
@ -496,17 +470,38 @@ ALL_TARGETS += default all
# Clean targets are automatically run serially by the Makefile calling this
# file.
CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
bootcycle-build docs docstemp test make-support
CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
images make-support
CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
CLEAN_PHASES := gensrc java native include
CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
# Construct targets of the form clean-$module-$phase
CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
$(addprefix $m-, $(CLEAN_PHASES))))
# Remove everything, except the output from configure.
clean: $(CLEAN_TARGETS)
($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
clean: $(CLEAN_DIR_TARGETS)
($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
$(ECHO) Cleaned all build artifacts.
$(CLEAN_TARGETS):
$(call CleanComponent,$(patsubst clean-%, %, $@))
$(CLEAN_DIR_TARGETS):
$(call CleanDir,$(patsubst clean-%, %, $@))
$(CLEAN_PHASE_TARGETS):
$(call Clean-$(patsubst clean-%,%, $@))
$(CLEAN_MODULE_TARGETS):
$(call CleanModule,$(patsubst clean-%, %, $@))
$(CLEAN_MODULE_PHASE_TARGETS):
$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
$(word 2, $(subst -,$(SPACE),$@)))
# When removing the support dir, we must also remove jdk. Building classes has
# the side effect of generating native headers. The headers end up in support
# while classes and touch files end up in jdk.
clean-support: clean-jdk
clean-docs: clean-docstemp
@ -525,7 +520,8 @@ dist-clean: clean
)
$(ECHO) Cleaned everything, you will have to re-run configure.
ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)
ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_PHASE_TARGETS) \
$(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
################################################################################
@ -557,7 +553,7 @@ ALL_TARGETS += reconfigure
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))
ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
################################################################################

@ -46,7 +46,7 @@ list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(forea
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
# Store the build times in this directory.
BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
# Global targets are possible to run either with or without a SPEC. The prototypical
# global target is "help".
@ -296,38 +296,139 @@ endef
### Convenience functions from Main.gmk
# Cleans the component given as $1
define CleanComponent
# Cleans the dir given as $1
define CleanDir
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
@$(PRINTF) " done\n"
endef
define Clean-gensrc
@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
@$(PRINTF) " done\n"
endef
define Clean-java
@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
@$(PRINTF) " done\n"
@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
@$(PRINTF) " done\n"
endef
define Clean-native
@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
@$(PRINTF) " done\n"
endef
define Clean-include
@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
@$(PRINTF) " done\n"
endef
define CleanModule
$(call Clean-gensrc, $1)
$(call Clean-java, $1)
$(call Clean-native, $1)
$(call Clean-include, $1)
endef
################################################################################
MAKE_DIR_LIST := $(JDK_TOPDIR)/make
MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
MAKE_MAKEDIR_LIST := make
# Find all modules that has a makefile for a certain build phase
# Param 1: Make subdir to look in
# Param 2: File prefix to look for
FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
$(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
$(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
# Declare a recipe for calling such a makefile
# Param 1: Module name
# Param 2: Suffix for rule
# Param 3: Make subdir
# Param 4: Makefile prefix
# Helper macro for DeclareRecipesForPhase
# Declare a recipe for calling the module and phase specific makefile.
# If there are multiple makefiles to call, create a rule for each topdir
# that contains a makefile with the target $module-$suffix-$repodir,
# (i.e: java.base-gensrc-jdk)
# Normally there is only one makefile, and the target will just be
# $module-$suffix
# Param 1: Name of list to add targets to
# Param 2: Module name
# Param 3: Topdir
define DeclareRecipeForModuleMakefile
$$(strip $1)-$$(strip $2):
+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
$(MAKE_DIR_LIST))))) \
ifeq ($$($1_MULTIPLE_MAKEFILES), true)
$2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
$1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
$2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
else
$2-$$($1_TARGET_SUFFIX):
endif
$(ECHO) $(LOG_INFO) "Building $$@"
ifeq ($$($1_USE_WRAPPER), true)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
-f ModuleWrapper.gmk \
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
$$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
else
+($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
$3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
&& $(MAKE) $(MAKE_ARGS) \
-f $$(strip $4)-$$(strip $1).gmk \
$$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
$$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))) \
MODULE=$$(strip $1))
-f $$($1_FILE_PREFIX)-$2.gmk \
$$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
$$(addsuffix /$3, $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
MODULE=$2)
endif
endef
# Helper macro for DeclareRecipesForPhase
# Param 1: Name of list to add targets to
# Param 2: Module name
define DeclareRecipesForPhaseAndModule
$1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
$$(patsubst $$d/%, $$d, $$(filter $$d/%, \
$$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
$$(foreach s, $(MAKE_MAKEDIR_LIST), \
$$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
# Only declare recipes if there are makefiles to call
ifneq ($$($1_$2_TOPDIRS), )
$$(foreach d, $$($1_$2_TOPDIRS), \
$$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
$1 += $2-$$($1_TARGET_SUFFIX)
$1_MODULES += $2
endif
endef
# Declare recipes for a specific module and build phase if there are makefiles
# present for the specific combination.
# Param 1: Name of list to add targets to
# Named params:
# TARGET_SUFFIX : Suffix of target to create for recipe
# MAKE_SUBDIR : Subdir for this build phase
# FILE_PREFIX : File prefix for this build phase
# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
# CHECK_MODULES : List of modules to try
# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
# phase in multiple repos
# Exported variables:
# $1_MODULES : All modules that had rules generated
# $1_TARGETS : All targets generated
define DeclareRecipesForPhase
$(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
$(if $(8),$(error Internal makefile error: Too many arguments to \
DeclareRecipesForPhase, please update MakeHelper.gmk))
$$(foreach m, $$($(strip $1)_CHECK_MODULES), \
$$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
$(strip $1)_TARGETS := $$($(strip $1))
endef
################################################################################

88
make/ModuleWrapper.gmk Normal file

@ -0,0 +1,88 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
# and wraps calls to makefiles for specific modules and build phases. Having
# this wrapper reduces the need for boilerplate code. It also provides
# opportunity for automatic copying of files to an interim exploded runnable
# image.
default: all
include $(SPEC)
include MakeBase.gmk
# All makefiles should add the targets to be built to this variable.
TARGETS :=
# Include the file being wrapped.
include $(MAKEFILE_PREFIX)-$(MODULE).gmk
# Setup copy rules from the modules directories to the jdk image directory.
ifeq ($(OPENJDK_TARGET_OS), windows)
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
$(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter $(TO_BIN_FILTER), \
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
$(TARGETS)))))
$(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out $(TO_BIN_FILTER), \
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
$(TARGETS)))))
else
$(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
$(TARGETS))))
endif
$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/include, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
$(TARGETS))))
$(eval $(call SetupCopyFiles,COPY_CMDS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
$(eval $(call SetupCopyFiles,COPY_CONF, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/conf, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
$(TARGETS))))
all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
$(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)

99
make/StripBinaries.gmk Normal file

@ -0,0 +1,99 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
################################################################################
# Copy native libraries and executables to a secondary location to strip them
# and filter out files that shouldn't go into the image.
MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
ifneq ($(POST_STRIP_CMD), )
define StripRecipe
$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
$(MKDIR) -p $(@D)
$(CP) $< $@.tmp
$(CHMOD) u+w $@.tmp
$(POST_STRIP_CMD) $@.tmp
$(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
$(CHMOD) go-w $@.tmp
$(MV) $@.tmp $@
endef
else
define StripRecipe
$(call install-file)
endef
endif
# Don't include debug info for executables.
ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
# Make sure symbolic links are copied and not stripped
COPY_LIBS_SRC := \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
\( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
STRIP_LIBS_SRC := \
$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
-name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
# On Windows, don't include debug info for libs either.
ifeq ($(OPENJDK_TARGET_OS), windows)
COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
endif
$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
DEST := $(MODULES_CMDS_STRIPPED), \
FILES := $(STRIP_CMDS_SRC), \
MACRO := StripRecipe))
$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
DEST := $(MODULES_CMDS_STRIPPED), \
FILES := $(COPY_CMDS_SRC)))
$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
DEST := $(MODULES_LIBS_STRIPPED), \
FILES := $(STRIP_LIBS_SRC), \
MACRO := StripRecipe))
$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
DEST := $(MODULES_LIBS_STRIPPED), \
FILES := $(COPY_LIBS_SRC)))
TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
$(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
all: $(TARGETS)

104
make/ZipSecurity.gmk Normal file

@ -0,0 +1,104 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
##########################################################################################
#
# sec-bin.zip is used by builds where the corresponding sources are not available
#
$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
SRC := $(JDK_OUTPUTDIR), \
INCLUDES := \
modules/java.base/javax/crypto \
modules/java.base/javax/crypto/spec \
modules/java.base/sun/security/internal/interfaces \
modules/java.base/sun/security/internal/spec \
modules/java.base/com/sun/crypto/provider \
modules/jdk.crypto.ec/sun/security/ec \
modules/jdk.crypto.mscapi/sun/security/mscapi \
modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
modules/java.base/javax/net \
modules/java.base/javax/security/cert \
modules/java.base/com/sun/net/ssl \
modules/java.base/com/sun/security/cert \
modules/java.base/sun/net/www/protocol/https \
modules/java.base/sun/security/pkcs12 \
modules/java.base/sun/security/ssl \
modules/java.security.jgss/sun/security/krb5 \
modules/java.security.jgss/sun/security/krb5/internal \
modules/java.security.jgss/sun/security/krb5/internal/ccache \
modules/java.security.jgss/sun/security/krb5/internal/crypto \
modules/java.security.jgss/sun/security/krb5/internal/ktab \
modules/java.security.jgss/sun/security/krb5/internal/rcache \
modules/java.security.jgss/sun/security/krb5/internal/util, \
INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
TARGETS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
##########################################################################################
#
# Windows specific binary security packages.
#
ifeq ($(OPENJDK_TARGET_OS), windows)
# sec-windows-bin.zip is used by builds where the corresponding sources are not available
$(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
SRC := $(JDK_OUTPUTDIR), \
INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
TARGETS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
# JGSS files contain the native Kerberos library
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
else
JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
endif
$(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
SRC := $(SUPPORT_OUTPUTDIR), \
INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \
modules_libs/java.security.jgss/w2k_lsa_auth.diz \
modules_libs/java.security.jgss/w2k_lsa_auth.map \
modules_libs/java.security.jgss/w2k_lsa_auth.pdb, \
ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
endif
##########################################################################################
all: $(TARGETS)
.PHONY: default all

88
make/ZipSource.gmk Normal file

@ -0,0 +1,88 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , ZipSource.gmk))
################################################################################
# Use ?= to enable override in custom makefile
SRC_ZIP_INCLUDES ?= \
com \
java \
javax \
jdk \
org \
sun \
#
SRC_ZIP_EXCLUDES ?=
SRC_ZIP_SRCS += $(wildcard \
$(JDK_TOPDIR)/src/*/share/classes \
$(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
$(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
$(LANGTOOLS_TOPDIR)/src/*/share/classes \
$(CORBA_TOPDIR)/src/*/share/classes \
$(JAXP_TOPDIR)/src/*/share/classes \
$(JAXWS_TOPDIR)/src/*/share/classes \
$(SUPPORT_OUTPUTDIR)/gensrc/j* \
$(SUPPORT_OUTPUTDIR)/rmic/j* \
) \
#
# Need to copy launcher src files into desired directory structure
# before zipping the sources.
$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
SRC := $(JDK_TOPDIR)/src/java.base, \
DEST := $(SUPPORT_OUTPUTDIR)/src/launcher, \
FLATTEN := true, \
FILES := $(wildcard \
$(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
$(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
# This dir needs to exist before macro is evaluated to avoid warning from find.
$(eval $(call MakeDir, $(SUPPORT_OUTPUTDIR)/src))
$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
SRC := $(SRC_ZIP_SRCS) $(SUPPORT_OUTPUTDIR)/src, \
INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
EXCLUDES := $(SRC_ZIP_EXCLUDES), \
EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
SUFFIXES := .java .c .h, \
ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
EXTRA_DEPS := $(COPY_LAUNCHER_SRC)))
################################################################################
all: $(BUILD_SRC_ZIP)
.PHONY: default all

@ -325,10 +325,16 @@ define SetupZipArchive
$1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
endif
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
endif
ifneq ($$($1_EXCLUDE_FILES),)
# Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
# zipped at the moment.
$1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
$1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
endif
# Use a slightly shorter name for logging, but with enough path to identify this zip.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
@ -343,7 +349,10 @@ define SetupZipArchive
$$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
$(MKDIR) -p $$(@D)
$(ECHO) Updating $$($1_NAME)
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
$$($1_ZIP_EXCLUDES) -x \*_the.\* \
$$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
|| test "$$$$?" = "12" )$$(NEWLINE)) true
$(TOUCH) $$@
# Add zip to target list

@ -64,6 +64,7 @@ $(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
SETUP := BOOT_JAVAC, \
SRC := $(JDK_TOPDIR)/make/src/classes, \
INCLUDES := build/tools/module, \
EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
DISABLE_SJAVAC := true))

@ -450,13 +450,11 @@ define SetupNativeCompilation
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
# This dependency dance ensures that windows debug info files get rebuilt
# properly if deleted.
$$($1_TARGET): $$($1_DEBUGINFO_FILES)
$$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
else ifeq ($(OPENJDK_TARGET_OS), solaris)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
# Setup the command line creating debuginfo files, to be run after linking.
# It cannot be run separately since it updates the original target file
#
# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
# Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
# empty section headers until a fixed $(OBJCOPY) is available.
@ -466,29 +464,34 @@ define SetupNativeCompilation
#
# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
$$($1_DEBUGINFO_FILES): $$($1_TARGET) \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
$(RM) $$@
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
$(TOUCH) $$@
$1_CREATE_DEBUGINFO_CMDS := \
$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
$(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
$(CD) $$($1_OUTPUT_DIR) && \
$(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
$1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
else ifeq ($(OPENJDK_TARGET_OS), linux)
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
$$($1_DEBUGINFO_FILES): $$($1_TARGET)
$(RM) $$@
$(OBJCOPY) --only-keep-debug $$< $$@
$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
$(TOUCH) $$@
# Setup the command line creating debuginfo files, to be run after linking.
# It cannot be run separately since it updates the original target file
$1_CREATE_DEBUGINFO_CMDS := \
$(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
$(CD) $$($1_OUTPUT_DIR) && \
$(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
endif # No MacOS X support
# This dependency dance ensures that debug info files get rebuilt
# properly if deleted.
$$($1_TARGET): $$($1_DEBUGINFO_FILES)
$$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
ifeq ($(ZIP_DEBUGINFO_FILES), true)
$1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
$1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
# The dependency on TARGET is needed on windows for debuginfo files
# The dependency on TARGET is needed for debuginfo files
# to be rebuilt properly.
$$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
$(CD) $$($1_OBJECT_DIR) \
@ -504,29 +507,31 @@ define SetupNativeCompilation
ifneq (,$$($1_LIBRARY))
# Generating a dynamic library.
$1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
$1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
ifeq ($(OPENJDK_TARGET_OS), windows)
$1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
$1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
endif
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
$$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
$$(call LINKING_MSG,$$($1_BASENAME))
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
$$($1_EXTRA_LDFLAGS_SUFFIX)
# Touch target to make sure it has a later time stamp than the debug
# symbol files to avoid unnecessary relinking on rebuild.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(TOUCH) $$@
endif
$$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
$$($1_DEBUGINFO_EXTRA_DEPS)
$$(call LINKING_MSG,$$($1_BASENAME))
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
$$($1_EXTRA_LDFLAGS_SUFFIX)
$$($1_CREATE_DEBUGINFO_CMDS)
# Touch target to make sure it has a later time stamp than the debug
# symbol files to avoid unnecessary relinking on rebuild.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(TOUCH) $$@
endif
endif
ifneq (,$$($1_STATIC_LIBRARY))
# Generating a static library, ie object file archive.
$$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
$$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call ARCHIVING_MSG,$$($1_LIBRARY))
$(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
$$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
@ -536,26 +541,28 @@ define SetupNativeCompilation
# A executable binary has been specified, setup the target for it.
$1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
$$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
$$(call LINKING_EXE_MSG,$$($1_BASENAME))
$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
$$($1_EXTRA_LDFLAGS_SUFFIX)
ifneq (,$$($1_GEN_MANIFEST))
$(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
endif
# This only works if the openjdk_codesign identity is present on the system. Let
# silently fail otherwise.
ifneq (,$(CODESIGN))
ifneq (,$$($1_CODESIGN))
$(CODESIGN) -s openjdk_codesign $$@
endif
endif
# Touch target to make sure it has a later time stamp than the debug
# symbol files to avoid unnecessary relinking on rebuild.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(TOUCH) $$@
endif
$$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \
$$($1_DEBUGINFO_EXTRA_DEPS)
$$(call LINKING_EXE_MSG,$$($1_BASENAME))
$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
$$($1_EXTRA_LDFLAGS_SUFFIX)
ifneq (,$$($1_GEN_MANIFEST))
$(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
endif
# This only works if the openjdk_codesign identity is present on the system. Let
# silently fail otherwise.
ifneq (,$(CODESIGN))
ifneq (,$$($1_CODESIGN))
$(CODESIGN) -s openjdk_codesign $$@
endif
endif
$$($1_CREATE_DEBUGINFO_CMDS)
# Touch target to make sure it has a later time stamp than the debug
# symbol files to avoid unnecessary relinking on rebuild.
ifeq ($(OPENJDK_TARGET_OS), windows)
$(TOUCH) $$@
endif
endif
endef

@ -48,10 +48,13 @@ $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
# The generate old bytecode javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the previous JDK version.
# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since
# it's running on the boot jdk, the default bootclasspath is correct.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true \
$(DISABLE_WARNINGS) -Xlint:-options, \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@ -61,8 +64,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@ -72,8 +74,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))

@ -181,8 +181,8 @@ my.make.rule.test.targets.svc= \
${my.test.target.set:TESTNAME=jdk_instrument}, \
${my.test.target.set:TESTNAME=jdk_jmx}, \
${my.test.target.set:TESTNAME=jdk_jdi}, \
${my.test.target.set:TESTNAME=jdk_jfr}, \
${my.test.target.set:TESTNAME=svc_tools}
${my.test.target.set:TESTNAME=svc_tools}, \
${my.make.rule.test.targets.svc.extra}
# All vm test targets (testset=all)
my.test.targets.all= \

@ -210,6 +210,10 @@
<name>com.sun.security.ntlm</name>
<to>java.security.sasl</to>
</export>
<export>
<name>jdk.internal.jimage</name>
<to>jdk.dev</to>
</export>
<export>
<name>jdk.internal.org.objectweb.asm</name>
<to>jdk.jfr</to>