Skip to content

Commit

Permalink
8295231: Move all linking of native libraries to make
Browse files Browse the repository at this point in the history
Reviewed-by: ihse, erikj
  • Loading branch information
TheShermanTanker authored and magicus committed Oct 17, 2022
1 parent f300ec8 commit 8d751de
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion make/modules/java.base/Lib.gmk
Expand Up @@ -84,7 +84,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
LIBS_aix := $(LIBDL), \
LIBS_macosx := \
-framework CoreFoundation -framework CoreServices, \
LIBS_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
LIBS_windows := jvm.lib Mswsock.lib ws2_32.lib $(WIN_JAVA_LIB) \
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
advapi32.lib, \
))
Expand Down
3 changes: 2 additions & 1 deletion make/modules/java.security.jgss/Lib.gmk
Expand Up @@ -47,7 +47,8 @@ ifeq ($(call isTargetOs, windows), true)
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(TOPDIR)/src/java.security.jgss/share/native/libj2gss, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := Secur32.lib, \
))

TARGETS += $(BUILD_LIBSSPI_BRIDGE)
Expand Down
12 changes: 7 additions & 5 deletions make/modules/jdk.jpackage/Lib.gmk
Expand Up @@ -74,7 +74,8 @@ $(eval $(call SetupJdkExecutable, BUILD_JPACKAGE_APPLAUNCHEREXE, \
CFLAGS_windows := $(JPACKAGE_CFLAGS_windows), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
LIBS_macosx := $(LIBCXX) -framework Cocoa, \
LIBS_windows := $(LIBCXX), \
LIBS_windows := $(LIBCXX) user32.lib ole32.lib msi.lib shlwapi.lib \
Shell32.lib, \
LIBS_linux := -ldl, \
MANIFEST := $(JAVA_MANIFEST), \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS) \
Expand Down Expand Up @@ -124,7 +125,8 @@ ifeq ($(call isTargetOs, windows), true)
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JPACKAGE_CXXFLAGS_windows), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(LIBCXX), \
LIBS := $(LIBCXX) advapi32.lib ole32.lib msi.lib user32.lib \
shlwapi.lib Shell32.lib, \
))

JPACKAGE_TARGETS += $(BUILD_LIB_JPACKAGE)
Expand All @@ -144,8 +146,8 @@ ifeq ($(call isTargetOs, windows), true)
CXXFLAGS := $(call JpackageWithStaticCrt, $(CXXFLAGS_JDKLIB)) \
$(addprefix -I, $(JPACKAGE_WIXHELPER_SRC)) $(JPACKAGE_CXXFLAGS_windows), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
LIBS := $(LIBCXX), \
LIBS_windows := User32.lib, \
LIBS := $(LIBCXX) ole32.lib msi.lib User32.lib shlwapi.lib \
Shell32.lib, \
))

JPACKAGE_TARGETS += $(BUILD_LIB_WIXHELPER)
Expand All @@ -163,7 +165,7 @@ ifeq ($(call isTargetOs, windows), true)
CXXFLAGS := $(call JpackageWithStaticCrt, $(CXXFLAGS_JDKEXE)) \
$(addprefix -I, $(JPACKAGE_MSIWRAPPER_SRC)) $(JPACKAGE_CXXFLAGS_windows), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
LIBS := $(LIBCXX), \
LIBS := $(LIBCXX) ole32.lib msi.lib user32.lib shlwapi.lib Shell32.lib, \
))

JPACKAGE_TARGETS += $(BUILD_JPACKAGE_MSIWRAPPER)
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c
Expand Up @@ -34,8 +34,7 @@
#include "java_lang_Integer.h"
#include "sun_nio_ch_FileDispatcherImpl.h"

#include <Mswsock.h>
#pragma comment(lib, "Mswsock.lib")
#include <Mswsock.h> // Requires Mswsock.lib

/**************************************************************
* FileDispatcherImpl.c
Expand Down
2 changes: 0 additions & 2 deletions src/java.security.jgss/windows/native/libsspi_bridge/sspi.cpp
Expand Up @@ -47,8 +47,6 @@
#define SECURITY_WIN32
#include <sspi.h>

#pragma comment(lib, "secur32.lib")

// Otherwise an exception will be thrown
#define new new (std::nothrow)

Expand Down
3 changes: 1 addition & 2 deletions src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp
Expand Up @@ -42,8 +42,7 @@
#include "WinErrorHandling.h"


// AllowSetForegroundWindow
#pragma comment(lib, "user32")
// AllowSetForegroundWindow - Requires linking with user32


namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/jdk.jpackage/windows/native/common/Guid.cpp
Expand Up @@ -30,7 +30,7 @@
#include "ErrorHandling.h"


#pragma comment(lib, "ole32")
// Code in this file requires linking with ole32


Guid::Guid(const std::string& str) {
Expand Down
2 changes: 1 addition & 1 deletion src/jdk.jpackage/windows/native/common/MsiCA.cpp
Expand Up @@ -31,7 +31,7 @@
#include "Toolbox.h"


#pragma comment(lib, "msi.lib")
// Code in this file requires linking with msi.lib


namespace msi {
Expand Down
2 changes: 1 addition & 1 deletion src/jdk.jpackage/windows/native/common/MsiDb.cpp
Expand Up @@ -29,7 +29,7 @@
#include "Log.h"


#pragma comment(lib, "msi.lib")
// Code in this file requires linking with msi.lib


namespace msi {
Expand Down
2 changes: 1 addition & 1 deletion src/jdk.jpackage/windows/native/common/MsiUtils.cpp
Expand Up @@ -32,7 +32,7 @@
#include "WinErrorHandling.h"


#pragma comment(lib, "msi.lib")
// Code in this file requires linking with msi.lib


namespace msi {
Expand Down
3 changes: 1 addition & 2 deletions src/jdk.jpackage/windows/native/common/WinApp.cpp
Expand Up @@ -31,8 +31,7 @@
#include "ErrorHandling.h"


// MessageBox
#pragma comment(lib, "user32")
// MessageBox - Requires linking with user32


namespace {
Expand Down
3 changes: 1 addition & 2 deletions src/jdk.jpackage/windows/native/common/WinFileUtils.cpp
Expand Up @@ -35,8 +35,7 @@
#include "Log.h"


// Needed by FileUtils::isDirectoryNotEmpty
#pragma comment(lib, "shlwapi")
// Needed by FileUtils::isDirectoryNotEmpty - shlwapi


namespace FileUtils {
Expand Down
2 changes: 1 addition & 1 deletion src/jdk.jpackage/windows/native/common/WinSysInfo.cpp
Expand Up @@ -30,7 +30,7 @@
#include "FileUtils.h"
#include "WinErrorHandling.h"

#pragma comment(lib, "Shell32")
// Requires linking with Shell32

namespace SysInfo {

Expand Down
Expand Up @@ -27,7 +27,7 @@
#include "FileUtils.h"
#include "ErrorHandling.h"

#pragma comment(lib, "advapi32")
// Requires linking with advapi32

namespace {

Expand Down

0 comments on commit 8d751de

Please sign in to comment.