From 7148556979793c56e69dabf7e31813930a0e979a Mon Sep 17 00:00:00 2001 From: Matt Klich Date: Thu, 26 May 2011 11:57:30 -0600 Subject: [PATCH 1/3] OSX Lion build changes --- classpath/java-io.cpp | 6 +++++- classpath/java-lang.cpp | 6 +++++- classpath/java-net.cpp | 6 +++++- classpath/java-nio.cpp | 6 +++++- classpath/java-util-zip.cpp | 6 +++++- classpath/java-util.cpp | 6 +++++- makefile | 18 +++++++++--------- src/main.cpp | 6 +++++- 8 files changed, 44 insertions(+), 16 deletions(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index abc7684634..6aec10dfc7 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -15,7 +15,11 @@ #include #include -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index 5c023242cd..c74f348f44 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -13,7 +13,11 @@ #include "time.h" #include "string.h" #include "stdio.h" -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" #include "errno.h" #include "fcntl.h" diff --git a/classpath/java-net.cpp b/classpath/java-net.cpp index 20d853adc2..e3a462ea76 100644 --- a/classpath/java-net.cpp +++ b/classpath/java-net.cpp @@ -8,7 +8,11 @@ There is NO WARRANTY for this software. See license.txt for details. */ -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-nio.cpp b/classpath/java-nio.cpp index 9a7656db91..723204b6e7 100644 --- a/classpath/java-nio.cpp +++ b/classpath/java-nio.cpp @@ -13,7 +13,11 @@ #include #include -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-util-zip.cpp b/classpath/java-util-zip.cpp index a7d969839a..3c95d945f2 100644 --- a/classpath/java-util-zip.cpp +++ b/classpath/java-util-zip.cpp @@ -12,7 +12,11 @@ #include "string.h" #include "zlib-custom.h" -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" extern "C" JNIEXPORT jlong JNICALL diff --git a/classpath/java-util.cpp b/classpath/java-util.cpp index b880ff2d95..7ea201858f 100644 --- a/classpath/java-util.cpp +++ b/classpath/java-util.cpp @@ -9,7 +9,11 @@ details. */ #include "time.h" -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "jni-util.h" namespace { diff --git a/makefile b/makefile index 35db15f9f9..9262b4d158 100644 --- a/makefile +++ b/makefile @@ -234,7 +234,7 @@ ifeq ($(platform),darwin) ar = i686-apple-darwin8-ar ranlib = i686-apple-darwin8-ranlib strip = i686-apple-darwin8-strip - sysroot = /opt/mac/SDKs/MacOSX10.4u.sdk + sysroot = /opt/mac/SDKs/MacOSX${OSX_SDK_SYSROOT}.sdk cflags = -I$(sysroot)/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/ \ $(common-cflags) -fPIC -fvisibility=hidden -I$(src) else @@ -257,20 +257,20 @@ ifeq ($(platform),darwin) ifneq (,$(filter i386 x86_64 arm,$(build-arch))) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch ppc -mmacosx-version-min=10.4 - cflags += -arch ppc -mmacosx-version-min=10.4 - asmflags += -arch ppc -mmacosx-version-min=10.4 - lflags += -arch ppc -mmacosx-version-min=10.4 + openjdk-extra-cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + asmflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + lflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} endif ifeq ($(arch),i386) ifeq ($(build-arch),powerpc) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch i386 -mmacosx-version-min=10.4 - cflags += -arch i386 -mmacosx-version-min=10.4 - asmflags += -arch i386 -mmacosx-version-min=10.4 - lflags += -arch i386 -mmacosx-version-min=10.4 + openjdk-extra-cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + asmflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + lflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} endif ifeq ($(arch),x86_64) diff --git a/src/main.cpp b/src/main.cpp index d04fbe3f34..005f7e49cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,11 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#include "jni.h" +#ifdef __APPLE__ +# include +#else +# include "jni.h" +#endif #include "system.h" #include "finder.h" From c7c0a45a613f8bec5ce4d80114079ee8902452ba Mon Sep 17 00:00:00 2001 From: Matt Klich Date: Wed, 1 Jun 2011 13:56:03 -0600 Subject: [PATCH 2/3] Revert "OSX Lion build changes" This commit introduced conditional includes which is not the preferred method. Will do it in the makefile instead. This reverts commit 7148556979793c56e69dabf7e31813930a0e979a. --- classpath/java-io.cpp | 6 +----- classpath/java-lang.cpp | 6 +----- classpath/java-net.cpp | 6 +----- classpath/java-nio.cpp | 6 +----- classpath/java-util-zip.cpp | 6 +----- classpath/java-util.cpp | 6 +----- makefile | 18 +++++++++--------- src/main.cpp | 6 +----- 8 files changed, 16 insertions(+), 44 deletions(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 6aec10dfc7..abc7684634 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -15,11 +15,7 @@ #include #include -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index c74f348f44..5c023242cd 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -13,11 +13,7 @@ #include "time.h" #include "string.h" #include "stdio.h" -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" #include "errno.h" #include "fcntl.h" diff --git a/classpath/java-net.cpp b/classpath/java-net.cpp index e3a462ea76..20d853adc2 100644 --- a/classpath/java-net.cpp +++ b/classpath/java-net.cpp @@ -8,11 +8,7 @@ There is NO WARRANTY for this software. See license.txt for details. */ -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-nio.cpp b/classpath/java-nio.cpp index 723204b6e7..9a7656db91 100644 --- a/classpath/java-nio.cpp +++ b/classpath/java-nio.cpp @@ -13,11 +13,7 @@ #include #include -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" #ifdef PLATFORM_WINDOWS diff --git a/classpath/java-util-zip.cpp b/classpath/java-util-zip.cpp index 3c95d945f2..a7d969839a 100644 --- a/classpath/java-util-zip.cpp +++ b/classpath/java-util-zip.cpp @@ -12,11 +12,7 @@ #include "string.h" #include "zlib-custom.h" -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" extern "C" JNIEXPORT jlong JNICALL diff --git a/classpath/java-util.cpp b/classpath/java-util.cpp index 7ea201858f..b880ff2d95 100644 --- a/classpath/java-util.cpp +++ b/classpath/java-util.cpp @@ -9,11 +9,7 @@ details. */ #include "time.h" -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "jni-util.h" namespace { diff --git a/makefile b/makefile index 9262b4d158..35db15f9f9 100644 --- a/makefile +++ b/makefile @@ -234,7 +234,7 @@ ifeq ($(platform),darwin) ar = i686-apple-darwin8-ar ranlib = i686-apple-darwin8-ranlib strip = i686-apple-darwin8-strip - sysroot = /opt/mac/SDKs/MacOSX${OSX_SDK_SYSROOT}.sdk + sysroot = /opt/mac/SDKs/MacOSX10.4u.sdk cflags = -I$(sysroot)/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/ \ $(common-cflags) -fPIC -fvisibility=hidden -I$(src) else @@ -257,20 +257,20 @@ ifeq ($(platform),darwin) ifneq (,$(filter i386 x86_64 arm,$(build-arch))) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} - cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} - asmflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} - lflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + openjdk-extra-cflags += -arch ppc -mmacosx-version-min=10.4 + cflags += -arch ppc -mmacosx-version-min=10.4 + asmflags += -arch ppc -mmacosx-version-min=10.4 + lflags += -arch ppc -mmacosx-version-min=10.4 endif ifeq ($(arch),i386) ifeq ($(build-arch),powerpc) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} - cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} - asmflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} - lflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + openjdk-extra-cflags += -arch i386 -mmacosx-version-min=10.4 + cflags += -arch i386 -mmacosx-version-min=10.4 + asmflags += -arch i386 -mmacosx-version-min=10.4 + lflags += -arch i386 -mmacosx-version-min=10.4 endif ifeq ($(arch),x86_64) diff --git a/src/main.cpp b/src/main.cpp index 005f7e49cc..d04fbe3f34 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,11 +11,7 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#ifdef __APPLE__ -# include -#else -# include "jni.h" -#endif +#include "jni.h" #include "system.h" #include "finder.h" From 698138f649de84f80aef635403934bfcda5177f3 Mon Sep 17 00:00:00 2001 From: Matt Klich Date: Thu, 2 Jun 2011 15:15:08 -0600 Subject: [PATCH 3/3] OSX Lion build changes Added JavaVM to include path. Also allow dynamically building with different SDK versions through the OSX_SDK_VERSION and OSX_SDK_SYSROOT environment variables (these default to the previosly hardcoded value of 10.4 and 10.4u respectively). --- makefile | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/makefile b/makefile index 35db15f9f9..a0057198cd 100644 --- a/makefile +++ b/makefile @@ -228,17 +228,24 @@ ifeq ($(arch),arm) endif ifeq ($(platform),darwin) + ifeq (${OSX_SDK_SYSROOT},) + OSX_SDK_SYSROOT = 10.4u + endif + ifeq (${OSX_SDK_VERSION},) + OSX_SDK_VERSION = 10.4 + endif ifneq ($(build-platform),darwin) cxx = i686-apple-darwin8-g++ $(mflag) cc = i686-apple-darwin8-gcc $(mflag) ar = i686-apple-darwin8-ar ranlib = i686-apple-darwin8-ranlib strip = i686-apple-darwin8-strip - sysroot = /opt/mac/SDKs/MacOSX10.4u.sdk + sysroot = /opt/mac/SDKs/MacOSX${OSX_SDK_SYSROOT}.sdk cflags = -I$(sysroot)/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/ \ $(common-cflags) -fPIC -fvisibility=hidden -I$(src) else build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src) + cflags += -I/System/Library/Frameworks/JavaVM.framework/Headers/ build-lflags += -framework CoreFoundation endif @@ -257,20 +264,20 @@ ifeq ($(platform),darwin) ifneq (,$(filter i386 x86_64 arm,$(build-arch))) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch ppc -mmacosx-version-min=10.4 - cflags += -arch ppc -mmacosx-version-min=10.4 - asmflags += -arch ppc -mmacosx-version-min=10.4 - lflags += -arch ppc -mmacosx-version-min=10.4 + openjdk-extra-cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + asmflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} + lflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION} endif ifeq ($(arch),i386) ifeq ($(build-arch),powerpc) converter-cflags += -DOPPOSITE_ENDIAN endif - openjdk-extra-cflags += -arch i386 -mmacosx-version-min=10.4 - cflags += -arch i386 -mmacosx-version-min=10.4 - asmflags += -arch i386 -mmacosx-version-min=10.4 - lflags += -arch i386 -mmacosx-version-min=10.4 + openjdk-extra-cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + asmflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} + lflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION} endif ifeq ($(arch),x86_64)