Merge pull request #472 from dicej/windows-openjdk

fix openjdk/openjdk-src builds for latest JDKs 7 and 8
This commit is contained in:
Joshua Warner 2016-01-13 20:23:36 +00:00
commit be84e421ee
5 changed files with 118 additions and 10 deletions

View File

@ -166,6 +166,10 @@ library-path = $(library-path-variable)=$(build)
ifneq ($(openjdk),)
openjdk-version := $(shell $(openjdk)/bin/java -version 2>&1 \
| head -n 1 \
| sed 's/.*version "1.\([^.]*\).*/\1/')
openjdk-arch = $(arch)
ifeq ($(arch),x86_64)
openjdk-arch = amd64
@ -732,7 +736,9 @@ ifeq ($(kernel),darwin)
sdk-dir = $(platform-dir)/Developer/SDKs
mac-version := $(shell \
if test -d $(sdk-dir)/MacOSX10.9.sdk; then echo 10.9; \
if test -d $(sdk-dir)/MacOSX10.11.sdk; then echo 10.11; \
elif test -d $(sdk-dir)/MacOSX10.10.sdk; then echo 10.10; \
elif test -d $(sdk-dir)/MacOSX10.9.sdk; then echo 10.9; \
elif test -d $(sdk-dir)/MacOSX10.8.sdk; then echo 10.8; \
elif test -d $(sdk-dir)/MacOSX10.7.sdk; then echo 10.7; \
elif test -d $(sdk-dir)/MacOSX10.6.sdk; then echo 10.6; \
@ -832,12 +838,12 @@ ifeq ($(kernel),darwin)
cflags += $(flags)
asmflags += $(flags)
lflags += $(flags)
ios-version-min=$(ios-version)
ifdef ios_deployment_target
ios-version-min=ios_deployment_target
endif
ifeq ($(sim),true)
ifeq ($(arch),x86_64)
classpath-extra-cflags += \
@ -875,7 +881,7 @@ ifeq ($(kernel),darwin)
asmflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
lflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
endif
ifeq ($(arch),x86_64)
classpath-extra-cflags += -arch x86_64
cflags += -arch x86_64
@ -904,7 +910,9 @@ ifeq ($(platform),windows)
exe-suffix = .exe
rpath =
lflags = -L$(lib) $(common-lflags) -lws2_32 -liphlpapi -mconsole
lflags = -L$(lib) $(common-lflags) -lws2_32 -lversion -luuid -liphlpapi \
-lmswsock -mconsole
cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500 -U__STRICT_ANSI__
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
@ -2265,6 +2273,14 @@ ifeq ($(platform),ios)
< "$(openjdk-src)/solaris/native/java/lang/childproc.h" \
> $(build)/openjdk/childproc.h; \
fi
endif
ifneq (7,$(openjdk-version))
if [ -f openjdk-patches/$(notdir $(<)).8.patch ]; then \
( cd $(build) && patch -p0 ) < openjdk-patches/$(notdir $(<)).8.patch; \
fi
if [ -f openjdk-patches/$(notdir $(<)).8.$(platform).patch ]; then \
( cd $(build) && patch -p0 ) < openjdk-patches/$(notdir $(<)).8.$(platform).patch; \
fi
endif
if [ -f openjdk-patches/$(notdir $(<)).patch ]; then \
( cd $(build) && patch -p0 ) < openjdk-patches/$(notdir $(<)).patch; \

View File

@ -0,0 +1,17 @@
--- openjdk/Inet6AddressImpl.c
+++ openjdk/Inet6AddressImpl.c
@@ -360,6 +360,13 @@
#ifdef AF_INET6
+#ifdef __MINGW32__
+typedef struct icmpv6_echo_reply_lh {
+ IPV6_ADDRESS_EX Address;
+ ULONG Status;
+ unsigned int RoundTripTime;
+} ICMPV6_ECHO_REPLY, *PICMPV6_ECHO_REPLY;
+#endif
/**
* ping implementation.

View File

@ -0,0 +1,24 @@
--- openjdk/java_props_md.c
+++ openjdk/java_props_md.c
@@ -212,17 +212,17 @@
* SHELL32 DLL is delay load DLL and we can use the trick with
* __try/__except block.
*/
- __try {
+ /* __try { */
/*
* For Windows Vista and later (or patched MS OS) we need to use
* [SHGetKnownFolderPath] call to avoid MAX_PATH length limitation.
* Shell32.dll (version 6.0.6000 or later)
*/
hr = SHGetKnownFolderPath(&FOLDERID_Profile, KF_FLAG_DONT_VERIFY, NULL, &u_path);
- } __except(EXCEPTION_EXECUTE_HANDLER) {
+ /* } __except(EXCEPTION_EXECUTE_HANDLER) { */
/* Exception: no [SHGetKnownFolderPath] entry */
- hr = E_FAIL;
- }
+ /* hr = E_FAIL; */
+ /* } */
if (FAILED(hr)) {
WCHAR path[MAX_PATH+1];

View File

@ -49,7 +49,6 @@ openjdk-sources = \
$(openjdk-src)/share/native/java/util/zip/zip_util.c \
$(openjdk-src)/share/native/sun/management/VMManagementImpl.c \
$(openjdk-src)/share/native/sun/misc/GC.c \
$(openjdk-src)/share/native/sun/misc/URLClassPath.c \
$(openjdk-src)/share/native/sun/misc/MessageUtils.c \
$(openjdk-src)/share/native/sun/misc/NativeSignalHandler.c \
$(openjdk-src)/share/native/sun/misc/Signal.c \
@ -143,6 +142,11 @@ openjdk-headers-classes = \
sun.reflect.Reflection \
sun.security.provider.NativeSeedGenerator
ifneq (7,$(openjdk-version))
openjdk-sources += \
$(openjdk-src)/share/native/sun/misc/URLClassPath.c
endif
# todo: set properties according to architecture targeted and OpenJDK
# version used:
openjdk-cflags = \
@ -181,15 +185,14 @@ ifeq ($(platform),windows)
$(openjdk-src)/windows/native/java/io/FileDescriptor_md.c \
$(openjdk-src)/windows/native/java/io/FileInputStream_md.c \
$(openjdk-src)/windows/native/java/io/FileOutputStream_md.c \
$(openjdk-src)/windows/native/java/io/FileSystem_md.c \
$(openjdk-src)/windows/native/java/io/io_util_md.c \
$(openjdk-src)/windows/native/java/io/RandomAccessFile_md.c \
$(openjdk-src)/windows/native/java/io/Win32FileSystem_md.c \
$(openjdk-src)/windows/native/java/io/WinNTFileSystem_md.c \
$(openjdk-src)/windows/native/java/lang/java_props_md.c \
$(openjdk-src)/windows/native/java/lang/ProcessEnvironment_md.c \
$(openjdk-src)/windows/native/java/lang/ProcessImpl_md.c \
$(openjdk-src)/windows/native/java/net/net_util_md.c \
$(openjdk-src)/windows/native/java/net/ExtendedOptionsImpl.c \
$(openjdk-src)/windows/native/java/net/DualStackPlainSocketImpl.c \
$(openjdk-src)/windows/native/java/net/InetAddressImplFactory.c \
$(openjdk-src)/windows/native/java/net/Inet4AddressImpl.c \
@ -218,6 +221,12 @@ ifeq ($(platform),windows)
$(openjdk-src)/windows/native/sun/nio/fs/WindowsNativeDispatcher.c \
$(openjdk-src)/windows/native/sun/security/provider/WinCAPISeedGenerator.c
ifeq (7,$(openjdk-version))
openjdk-sources += \
$(openjdk-src)/windows/native/java/io/FileSystem_md.c \
$(openjdk-src)/windows/native/java/io/Win32FileSystem_md.c
endif
openjdk-headers-classes += \
java.net.DualStackPlainSocketImpl \
java.net.SocketImpl \
@ -236,14 +245,20 @@ ifeq ($(platform),windows)
"-I$(openjdk-src)/windows/native/java/util" \
"-I$(openjdk-src)/windows/native/sun/nio/ch" \
"-I$(openjdk-src)/windows/javavm/include" \
"-I$(root)/win32/include" \
-DLOCALE_SNAME=0x0000005c \
-DLOCALE_SISO3166CTRYNAME2=0x00000068 \
-DLOCALE_SISO639LANGNAME2=0x00000067 \
-D_JNI_IMPLEMENTATION_ \
-D_JAVASOFT_WIN32_TYPEDEF_MD_H_ \
-D_WIN32_WINNT=0x0600 \
-Ds6_words=_s6_words \
-Ds6_bytes=_s6_bytes
ifeq ($(arch),x86_64)
openjdk-cflags += "-I$(root)/win64/include"
else
openjdk-cflags += "-I$(root)/win32/include"
endif
else
openjdk-sources += \
$(shell find $(openjdk-src)/solaris/native/common -name '*.c') \
@ -261,6 +276,7 @@ else
$(openjdk-src)/solaris/native/java/lang/ProcessEnvironment_md.c \
$(openjdk-src)/solaris/native/java/lang/UNIXProcess_md.c \
$(openjdk-src)/solaris/native/java/net/net_util_md.c \
$(openjdk-src)/solaris/native/java/net/ExtendedOptionsImpl.c \
$(openjdk-src)/solaris/native/java/net/InetAddressImplFactory.c \
$(openjdk-src)/solaris/native/java/net/Inet4AddressImpl.c \
$(openjdk-src)/solaris/native/java/net/Inet6AddressImpl.c \
@ -296,6 +312,11 @@ else
sun.nio.ch.InheritedChannel \
sun.nio.fs.UnixNativeDispatcher \
ifneq (7,$(openjdk-version))
openjdk-headers-classes += \
jdk.net.SocketFlow
endif
openjdk-cflags += \
"-I$(openjdk-src)/solaris/javavm/export" \
"-I$(openjdk-src)/solaris/native/common" \

View File

@ -662,7 +662,10 @@ class MyClasspath : public Classpath {
#ifdef AVIAN_OPENJDK_SRC
interceptFileOperations(t, true);
#else // not AVIAN_OPENJDK_SRC
expect(t, loadLibrary(t, libraryPath, "verify", true, true));
# ifdef PLATFORM_WINDOWS
expect(t, loadLibrary(t, libraryPath, "msvcr100", true, true));
# endif
expect(t, loadLibrary(t, libraryPath, "verify", true, true));
expect(t, loadLibrary(t, libraryPath, "java", true, true));
#endif // not AVIAN_OPENJDK_SRC
@ -3122,6 +3125,11 @@ namespace {
namespace local {
extern "C" AVIAN_EXPORT jobjectArray JNICALL EXPORT(JVM_GetMethodParameters)(Thread*, jobject)
{
abort();
}
extern "C" AVIAN_EXPORT jint JNICALL EXPORT(JVM_GetInterfaceVersion)()
{
return local::InterfaceVersion;
@ -5972,6 +5980,28 @@ extern "C" void* JDK_FindJvmEntry(const char* name)
return voidPointer(GetProcAddress(jvmHandle, name));
}
extern "C" HMODULE JDK_LoadSystemLibrary(const char* name) {
HMODULE handle;
char path[MAX_PATH];
if (GetSystemDirectory(path, sizeof(path)) != 0) {
strcat(path, "\\");
strcat(path, name);
handle = LoadLibrary(path);
} else {
handle = nullptr;
}
if (handle == nullptr) {
if (GetWindowsDirectory(path, sizeof(path)) != 0) {
strcat(path, "\\");
strcat(path, name);
handle = LoadLibrary(path);
}
}
return handle;
}
#ifdef AVIAN_OPENJDK_SRC
extern "C" char* findJavaTZ_md(const char*, const char*);