fix Android classpath build for iOS

This mainly involved reworking the makefile to avoid conflating
Darwin/ARM builds with iOS, since we may also want to build for the
iOS Simulator, which is i386.

Note that I was only able to test this on the Simulator, since I don't
have a real iOS device to test with.  Sorry if I broke something; if
so, please fix it :)
This commit is contained in:
Joel Dice 2013-07-31 15:20:32 -07:00
parent 56a0aea160
commit c06dd28ea0
2 changed files with 49 additions and 30 deletions

View File

@ -170,6 +170,7 @@ ifneq ($(android),)
-D_FILE_OFFSET_BITS=64 \ -D_FILE_OFFSET_BITS=64 \
-DOS_SHARED_LIB_FORMAT_STR="\"$(so-prefix)%s$(so-suffix)\"" \ -DOS_SHARED_LIB_FORMAT_STR="\"$(so-prefix)%s$(so-suffix)\"" \
-DJNI_JARJAR_PREFIX= \ -DJNI_JARJAR_PREFIX= \
-D__DARWIN_UNIX03=1 \
-g3 \ -g3 \
-Werror -Werror
@ -445,19 +446,7 @@ ifeq ($(arch),arm)
endif endif
ifneq ($(arch),$(build-arch)) ifneq ($(arch),$(build-arch))
ifeq ($(platform),darwin) ifneq ($(platform),darwin)
ios-bin = $(developer-dir)/Platforms/iPhoneOS.platform/Developer/usr/bin
ifeq ($(use-clang),true)
cxx = clang -std=c++11
cc = clang
else
cxx = $(ios-bin)/g++
cc = $(ios-bin)/gcc
endif
ar = $(ios-bin)/ar
ranlib = $(ios-bin)/ranlib
strip = $(ios-bin)/strip
else
cxx = arm-linux-gnueabi-g++ cxx = arm-linux-gnueabi-g++
cc = arm-linux-gnueabi-gcc cc = arm-linux-gnueabi-gcc
ar = arm-linux-gnueabi-ar ar = arm-linux-gnueabi-ar
@ -616,24 +605,53 @@ ifeq ($(platform),darwin)
shared = -dynamiclib shared = -dynamiclib
rpath = rpath =
sdk-dir = $(developer-dir)/Platforms/iPhoneOS.platform/Developer/SDKs ifeq ($(ios),true)
ifeq ($(arch),i386)
ifeq ($(arch),arm) target = iPhoneSimulator
ios-version := \ sdk = iphonesimulator$(ios-version)
$(shell if test -d $(sdk-dir)/iPhoneOS6.1.sdk; then echo 6.1; \ arch = i386
elif test -d $(sdk-dir)/iPhoneOS6.0.sdk; then echo 6.0; \ arch-flag = -arch i386
elif test -d $(sdk-dir)/iPhoneOS5.1.sdk; then echo 5.1; \ release = Release-iphonesimulator
elif test -d $(sdk-dir)/iPhoneOS5.0.sdk; then echo 5.0; \ else
elif test -d $(sdk-dir)/iPhoneOS4.3.sdk; then echo 4.3; \ target = iPhoneOS
elif test -d $(sdk-dir)/iPhoneOS4.2.sdk; then echo 4.2; \ sdk = iphoneos$(ios-version)
else echo; fi) arch = arm
arch-flag = -arch armv7
ifeq ($(ios-version),) release = Release-iphoneos
x := $(error "couldn't find SDK for iOS version")
endif endif
flags = -arch armv7 -isysroot \ platform-dir = $(developer-dir)/Platforms/$(target).platform
$(sdk-dir)/iPhoneOS$(ios-version).sdk/ sdk-dir = $(platform-dir)/Developer/SDKs
ios-version := $(shell \
if test -d $(sdk-dir)/$(target)6.1.sdk; then echo 6.1; \
elif test -d $(sdk-dir)/$(target)6.0.sdk; then echo 6.0; \
elif test -d $(sdk-dir)/$(target)5.1.sdk; then echo 5.1; \
elif test -d $(sdk-dir)/$(target)5.0.sdk; then echo 5.0; \
elif test -d $(sdk-dir)/$(target)4.3.sdk; then echo 4.3; \
elif test -d $(sdk-dir)/$(target)4.2.sdk; then echo 4.2; \
else echo; fi)
ifeq ($(ios-version),)
x := $(error "couldn't find SDK")
endif
ios-bin = $(platform-dir)/Developer/usr/bin
ifeq ($(use-clang),true)
cxx = clang -std=c++11
cc = clang
else
cxx = $(ios-bin)/g++
cc = $(ios-bin)/gcc
endif
ar = $(ios-bin)/ar
ranlib = $(ios-bin)/ranlib
strip = $(ios-bin)/strip
flags = -isysroot $(sdk-dir)/$(target)$(ios-version).sdk \
$(arch-flag)
classpath-extra-cflags += $(flags) classpath-extra-cflags += $(flags)
cflags += $(flags) cflags += $(flags)
asmflags += $(flags) asmflags += $(flags)
@ -1811,6 +1829,7 @@ $(audit-codegen-executable): $(audit-codegen-executable-objects)
$(bootimage-generator): $(bootimage-generator-objects) $(vm-objects) $(bootimage-generator): $(bootimage-generator-objects) $(vm-objects)
echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform) echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform)
$(MAKE) mode=$(mode) \ $(MAKE) mode=$(mode) \
ios=false \
build=$(host-build-root) \ build=$(host-build-root) \
arch=$(build-arch) \ arch=$(build-arch) \
aot-only=false \ aot-only=false \

View File

@ -452,7 +452,7 @@ class MyClasspath : public Classpath {
// LD_LIBRARY_PATH is not set as of this writing: // LD_LIBRARY_PATH is not set as of this writing:
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
_wputenv(L"LD_LIBRARY_PATH=(dummy)"); _wputenv(L"LD_LIBRARY_PATH=(dummy)");
#else #elif (! defined AVIAN_IOS)
setenv("LD_LIBRARY_PATH", "", false); setenv("LD_LIBRARY_PATH", "", false);
#endif #endif