From 773417ab2b04180a397adcf1e7d14e1175ab4183 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Sat, 7 Dec 2013 16:38:00 -0700 Subject: [PATCH] fix openjdk-src build failures on osx 10.9 --- makefile | 40 +++++++++++++++++++++++++++++----------- src/openjdk/stubs.cpp | 4 ++-- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/makefile b/makefile index abd5aa2c7a..803a56a797 100755 --- a/makefile +++ b/makefile @@ -98,6 +98,8 @@ endif library-path = $(library-path-variable)=$(build) + + ifneq ($(openjdk),) openjdk-arch = $(arch) ifeq ($(arch),x86_64) @@ -596,6 +598,21 @@ ifeq ($(platform),darwin) $(common-cflags) -fPIC -fvisibility=hidden -I$(src) endif + ifneq ($(ios),true) + platform-dir = $(developer-dir)/Platforms/MacOSX.platform + sdk-dir = $(platform-dir)/Developer/SDKs + + mac-version := $(shell \ + if 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; \ + else echo; fi) + + sysroot = $(sdk-dir)/MacOSX$(mac-version).sdk + endif + + version-script-flag = lflags = $(common-lflags) -ldl -framework CoreFoundation @@ -1955,7 +1972,7 @@ ifeq ($(ios),true) endif $(cc) -fPIC $(openjdk-extra-cflags) $(openjdk-cflags) \ $(optimization-cflags) -w -c $(build)/openjdk/$(notdir $(<)) \ - $(call output,$(@)) + $(call output,$(@)) -Wno-return-type $(openjdk-local-objects): $(build)/openjdk/%-openjdk.o: $(src)/openjdk/%.c \ $(openjdk-headers-dep) @@ -1984,37 +2001,38 @@ ifeq ($(platform),windows) > $(build)/openjdk/NetworkInterface.h echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h endif + ifeq ($(platform),darwin) mkdir -p $(build)/openjdk/netinet for file in \ - /usr/include/netinet/ip.h \ - /usr/include/netinet/in_systm.h \ - /usr/include/netinet/ip_icmp.h \ - /usr/include/netinet/in_var.h \ - /usr/include/netinet/icmp6.h \ - /usr/include/netinet/ip_var.h; do \ + $(sysroot)/usr/include/netinet/ip.h \ + $(sysroot)/usr/include/netinet/in_systm.h \ + $(sysroot)/usr/include/netinet/ip_icmp.h \ + $(sysroot)/usr/include/netinet/in_var.h \ + $(sysroot)/usr/include/netinet/icmp6.h \ + $(sysroot)/usr/include/netinet/ip_var.h; do \ if [ ! -f "$(build)/openjdk/netinet/$$(basename $${file})" ]; then \ ln "$${file}" "$(build)/openjdk/netinet/$$(basename $${file})"; \ fi; \ done mkdir -p $(build)/openjdk/netinet6 for file in \ - /usr/include/netinet6/in6_var.h; do \ + $(sysroot)/usr/include/netinet6/in6_var.h; do \ if [ ! -f "$(build)/openjdk/netinet6/$$(basename $${file})" ]; then \ ln "$${file}" "$(build)/openjdk/netinet6/$$(basename $${file})"; \ fi; \ done mkdir -p $(build)/openjdk/net for file in \ - /usr/include/net/if_arp.h; do \ + $(sysroot)/usr/include/net/if_arp.h; do \ if [ ! -f "$(build)/openjdk/net/$$(basename $${file})" ]; then \ ln "$${file}" "$(build)/openjdk/net/$$(basename $${file})"; \ fi; \ done mkdir -p $(build)/openjdk/sys for file in \ - /usr/include/sys/kern_event.h \ - /usr/include/sys/sys_domain.h; do \ + $(sysroot)/usr/include/sys/kern_event.h \ + $(sysroot)/usr/include/sys/sys_domain.h; do \ if [ ! -f "$(build)/openjdk/sys/$$(basename $${file})" ]; then \ ln "$${file}" "$(build)/openjdk/sys/$$(basename $${file})"; \ fi; \ diff --git a/src/openjdk/stubs.cpp b/src/openjdk/stubs.cpp index 62b3f94649..af6a1d15e2 100644 --- a/src/openjdk/stubs.cpp +++ b/src/openjdk/stubs.cpp @@ -2,13 +2,13 @@ using namespace vm; -extern "C" JNIEXPORT jint JNICALL +extern "C" AVIAN_EXPORT jint JNICALL net_JNI_OnLoad(JavaVM*, void*) { return 0; } -extern "C" JNIEXPORT jint JNICALL +extern "C" AVIAN_EXPORT jint JNICALL management_JNI_OnLoad(JavaVM*, void*) { return 0;