# HG changeset patch # User erikj # Date 1474894595 -7200 # Node ID 2a3c61e80af0508551f7cda68ed2106828cd2cd9 # Parent 87edc8451f8ac986675addd22617090d3cc3845f 8163102: Fix headless only configuration option Reviewed-by: tbell diff -r 87edc8451f8a -r 2a3c61e80af0 jdk/make/launcher/Launcher-java.desktop.gmk --- a/jdk/make/launcher/Launcher-java.desktop.gmk Fri Sep 23 13:24:33 2016 -0700 +++ b/jdk/make/launcher/Launcher-java.desktop.gmk Mon Sep 26 14:56:35 2016 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2016, 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 @@ -28,7 +28,7 @@ # Hook to include the corresponding custom file, if present. $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk)) -ifndef BUILD_HEADLESS_ONLY +ifeq ($(ENABLE_HEADLESS_ONLY), false) $(eval $(call SetupBuildLauncher, appletviewer, \ MAIN_CLASS := sun.applet.Main, \ JAVA_ARGS := --add-modules ALL-DEFAULT, \ diff -r 87edc8451f8a -r 2a3c61e80af0 jdk/make/launcher/Launcher-jdk.policytool.gmk --- a/jdk/make/launcher/Launcher-jdk.policytool.gmk Fri Sep 23 13:24:33 2016 -0700 +++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk Mon Sep 26 14:56:35 2016 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2016, 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 @@ -25,7 +25,7 @@ include LauncherCommon.gmk -ifndef BUILD_HEADLESS_ONLY +ifeq ($(ENABLE_HEADLESS_ONLY), false) $(eval $(call SetupBuildLauncher, policytool, \ MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \ LIBS_unix := $(X_LIBS), \ diff -r 87edc8451f8a -r 2a3c61e80af0 jdk/make/lib/Awt2dLibraries.gmk --- a/jdk/make/lib/Awt2dLibraries.gmk Fri Sep 23 13:24:33 2016 -0700 +++ b/jdk/make/lib/Awt2dLibraries.gmk Mon Sep 26 14:56:35 2016 +0200 @@ -280,7 +280,7 @@ ################################################################################ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) - ifndef BUILD_HEADLESS_ONLY + ifeq ($(ENABLE_HEADLESS_ONLY), false) LIBAWT_XAWT_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \ @@ -511,77 +511,75 @@ ################################################################################ -ifeq ($(BUILD_HEADLESS), true) - # Mac and Windows only use the native AWT lib, do not build libawt_headless - ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),) +# Mac and Windows only use the native AWT lib, do not build libawt_headless +ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),) - LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ - # + LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + # - LIBAWT_HEADLESS_EXCLUDES := medialib - LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \ - $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ - $(LIBJAVA_HEADER_FLAGS) \ - # + LIBAWT_HEADLESS_EXCLUDES := medialib + LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \ + $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ + $(LIBJAVA_HEADER_FLAGS) \ + # - LIBAWT_HEADLESS_REORDER := - ifeq ($(OPENJDK_TARGET_OS), solaris) - ifneq ($(OPENJDK_TARGET_CPU), x86_64) - LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU) - endif + LIBAWT_HEADLESS_REORDER := + ifeq ($(OPENJDK_TARGET_OS), solaris) + ifneq ($(OPENJDK_TARGET_CPU), x86_64) + LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU) endif + endif - $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \ - LIBRARY := awt_headless, \ - OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(LIBAWT_HEADLESS_DIRS), \ - EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \ - OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ - -DHEADLESS=true \ - -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \ - $(CUPS_CFLAGS) \ - $(X_CFLAGS) \ - $(LIBAWT_HEADLESS_CFLAGS), \ - DISABLED_WARNINGS_xlc := 1506-356, \ - DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \ - MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \ - LDFLAGS := $(LDFLAGS_JDKLIB) \ - $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ - LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ - LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ - REORDER := $(LIBAWT_HEADLESS_REORDER), \ - LIBS_unix := -lawt -ljvm -ljava, \ - LIBS_linux := $(LIBM) $(LIBDL), \ - LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \ - )) + $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \ + LIBRARY := awt_headless, \ + OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ + SRC := $(LIBAWT_HEADLESS_DIRS), \ + EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \ + OPTIMIZATION := LOW, \ + CFLAGS := $(CFLAGS_JDKLIB) \ + -DHEADLESS=true \ + -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \ + $(CUPS_CFLAGS) \ + $(X_CFLAGS) \ + $(LIBAWT_HEADLESS_CFLAGS), \ + DISABLED_WARNINGS_xlc := 1506-356, \ + DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \ + MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \ + LDFLAGS := $(LDFLAGS_JDKLIB) \ + $(call SET_SHARED_LIBRARY_ORIGIN), \ + LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \ + LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ + LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ + REORDER := $(LIBAWT_HEADLESS_REORDER), \ + LIBS_unix := -lawt -ljvm -ljava, \ + LIBS_linux := $(LIBM) $(LIBDL), \ + LIBS_solaris := $(LIBM) $(LIBDL) $(LIBCXX) -lc, \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \ + )) - # AIX warning explanation: - # 1506-356 : (W) Compilation unit is empty. - # This happens during the headless build + # AIX warning explanation: + # 1506-356 : (W) Compilation unit is empty. + # This happens during the headless build - $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT) + $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT) - TARGETS += $(BUILD_LIBAWT_HEADLESS) + TARGETS += $(BUILD_LIBAWT_HEADLESS) - endif endif ################################################################################ @@ -780,7 +778,7 @@ ifneq ($(OPENJDK_TARGET_OS), solaris) JAWT_LIBS += -lawt endif - ifndef BUILD_HEADLESS_ONLY + ifeq ($(ENABLE_HEADLESS_ONLY), false) JAWT_LIBS += -lawt_xawt else JAWT_LIBS += -lawt_headless @@ -809,7 +807,7 @@ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \ )) - ifndef BUILD_HEADLESS_ONLY + ifeq ($(ENABLE_HEADLESS_ONLY), false) $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT) else $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) @@ -825,7 +823,7 @@ ################################################################################ -ifndef BUILD_HEADLESS_ONLY +ifeq ($(ENABLE_HEADLESS_ONLY), false) LIBSPLASHSCREEN_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg \ diff -r 87edc8451f8a -r 2a3c61e80af0 jdk/src/java.desktop/unix/native/libjawt/jawt.c --- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c Fri Sep 23 13:24:33 2016 -0700 +++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c Mon Sep 26 14:56:35 2016 +0200 @@ -39,6 +39,10 @@ */ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) { +#if defined(HEADLESS) + /* there are no AWT libs available at all */ + return JNI_FALSE; +#else if (awt == NULL) { return JNI_FALSE; } @@ -64,4 +68,5 @@ } return JNI_TRUE; +#endif }