Skip to content

Commit

Permalink
8329086: Clean up java.desktop native compilation
Browse files Browse the repository at this point in the history
Reviewed-by: erikj
  • Loading branch information
magicus committed Mar 27, 2024
1 parent d0a2650 commit d292aab
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 401 deletions.
4 changes: 4 additions & 0 deletions make/autoconf/lib-bundled.m4
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBJPEG],
[ AC_MSG_ERROR([--with-libjpeg=system specified, but no libjpeg found])])
USE_EXTERNAL_LIBJPEG=true
LIBJPEG_LIBS="-ljpeg"
else
AC_MSG_ERROR([Invalid use of --with-libjpeg: ${with_libjpeg}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBJPEG)
AC_SUBST(LIBJPEG_LIBS)
])

################################################################################
Expand Down Expand Up @@ -102,11 +104,13 @@ AC_DEFUN_ONCE([LIB_SETUP_GIFLIB],
[ AC_MSG_ERROR([--with-giflib=system specified, but no giflib found!])])
USE_EXTERNAL_LIBGIF=true
GIFLIB_LIBS=-lgif
else
AC_MSG_ERROR([Invalid value of --with-giflib: ${with_giflib}, use 'system' or 'bundled'])
fi
AC_SUBST(USE_EXTERNAL_LIBGIF)
AC_SUBST(GIFLIB_LIBS)
])

################################################################################
Expand Down
2 changes: 2 additions & 0 deletions make/autoconf/spec.gmk.template
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,9 @@ TAR_SUPPORTS_TRANSFORM := @TAR_SUPPORTS_TRANSFORM@

# Build setup
USE_EXTERNAL_LIBJPEG := @USE_EXTERNAL_LIBJPEG@
LIBJPEG_LIBS := @LIBJPEG_LIBS@
USE_EXTERNAL_LIBGIF := @USE_EXTERNAL_LIBGIF@
GIFLIB_LIBS := @GIFLIB_LIBS@
USE_EXTERNAL_LIBZ := @USE_EXTERNAL_LIBZ@
LIBZ_CFLAGS := @LIBZ_CFLAGS@
LIBZ_LIBS := @LIBZ_LIBS@
Expand Down
56 changes: 31 additions & 25 deletions make/modules/java.desktop/Lib.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ $(call FillFindCache, $(wildcard $(TOPDIR)/src/java.desktop/*/native))

include lib/Awt2dLibraries.gmk

################################################################################
# Create the libjsound library

ifeq ($(call isTargetOs, aix), false)
##############################################################################
# Build libjsound
##############################################################################

LIBJSOUND_CFLAGS := \
$(ALSA_CFLAGS) \
Expand All @@ -64,49 +64,57 @@ ifeq ($(call isTargetOs, aix), false)
CXXFLAGS := $(LIBJSOUND_CFLAGS), \
DISABLED_WARNINGS_gcc := undef, \
DISABLED_WARNINGS_clang := undef, \
LIBS_unix := -ljava -ljvm, \
JDK_LIBS_unix := -ljava -ljvm, \
JDK_LIBS_windows := $(WIN_JAVA_LIB), \
LIBS_linux := $(ALSA_LIBS), \
LIBS_macosx := -framework CoreAudio -framework CoreFoundation \
-framework CoreServices -framework AudioUnit \
-framework CoreMIDI -framework AudioToolbox, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib dsound.lib winmm.lib user32.lib ole32.lib, \
LIBS_macosx := \
-framework AudioToolbox \
-framework AudioUnit \
-framework CoreAudio \
-framework CoreFoundation \
-framework CoreMIDI \
-framework CoreServices, \
LIBS_windows := advapi32.lib dsound.lib ole32.lib user32.lib winmm.lib, \
))

$(BUILD_LIBJSOUND): $(call FindLib, java.base, java)

TARGETS += $(BUILD_LIBJSOUND)

endif

################################################################################
# Create the macosx specific osxapp and osx libraries

ifeq ($(call isTargetOs, macosx), true)
##############################################################################
# Build libosxapp
##############################################################################

$(eval $(call SetupJdkLibrary, BUILD_LIBOSXAPP, \
NAME := osxapp, \
OPTIMIZATION := LOW, \
DISABLED_WARNINGS_clang_NSApplicationAWT.m := deprecated-declarations format-nonliteral, \
DISABLED_WARNINGS_clang_QueuingApplicationDelegate.m := objc-method-access, \
LIBS := \
-ljava \
DISABLED_WARNINGS_clang_NSApplicationAWT.m := deprecated-declarations \
format-nonliteral, \
DISABLED_WARNINGS_clang_QueuingApplicationDelegate.m := \
objc-method-access, \
JDK_LIBS_macosx := -ljava, \
LIBS_macosx := \
-framework Accelerate \
-framework ApplicationServices \
-framework AudioToolbox \
-framework Carbon \
-framework Cocoa \
-framework Security \
-framework ExceptionHandling \
-framework IOSurface \
-framework JavaRuntimeSupport \
-framework OpenGL \
-framework IOSurface \
-framework QuartzCore, \
-framework QuartzCore \
-framework Security, \
))

$(BUILD_LIBOSXAPP): $(call FindLib, java.base, java)

TARGETS += $(BUILD_LIBOSXAPP)

##############################################################################
# Build libosx
##############################################################################

$(eval $(call SetupJdkLibrary, BUILD_LIBOSX, \
Expand All @@ -115,19 +123,17 @@ ifeq ($(call isTargetOs, macosx), true)
EXTRA_HEADER_DIRS := libosxapp, \
DISABLED_WARNINGS_clang_CFileManager.m := deprecated-declarations, \
LDFLAGS := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop, \
LIBS := \
-losxapp \
-framework Cocoa \
JDK_LIBS_macosx := $(JDKLIB_LIBS) -losxapp, \
LIBS_macosx := \
-framework ApplicationServices \
-framework Cocoa \
-framework JavaRuntimeSupport \
-framework SystemConfiguration \
$(JDKLIB_LIBS), \
-framework SystemConfiguration, \
))

TARGETS += $(BUILD_LIBOSX)

$(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)

$(BUILD_LIBOSX): $(call FindLib, java.base, java)

endif
Loading

1 comment on commit d292aab

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.