jeudi 23 octobre 2008

stlport on iPhone

Here is how i've compiled stlport 5.1.6 for iPhone:
- Copied lib/Makefiles/gmake/darwin in lib/Makefiles/gmake/iphone
- Modify lib/Makefiles/gmake/gcc.mak to add iphone compilation support with those lines:
ifeq ($(OSNAME), iphone)
PATH:=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/:${PATH}
CXX=arm-apple-darwin9-gcc-4.0.1
CC=arm-apple-darwin9-gcc-4.0.1
OPT=-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk -Wl,-syslibroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk
CXX_VERSION := $(shell ${CXX} -dumpversion)
# TODO: ensure PANTHER's gcc compatibility...
CXX_VERSION_MAJOR := $(shell ${CXX} -dumpversion | awk 'BEGIN { FS = "."; } { print $1; }')
CXX_VERSION_MINOR := $(shell ${CXX} -dumpversion | awk 'BEGIN { FS = "."; } { print $2; }')
CXX_VERSION_PATCH := $(shell ${CXX} -dumpversion | awk 'BEGIN { FS = "."; } { print $3; }')
# This is to differentiate Apple-builded compiler from original
# compiler (it's has different behaviour)
ifneq ("$(shell ${CXX} -v 2>&1 | grep Apple)", "")
GCC_APPLE_CC := 1
endif

Then :
ifeq ($(OSNAME),iphone)
CCFLAGS = $(OPT)
CFLAGS = $(OPT)
ifndef STLP_BUILD_NO_THREAD
DEFS += -D_REENTRANT
endif
CXXFLAGS = -fexceptions $(OPT)
endif

And :
# Required for correct order of static objects dtors calls:
ifneq ($(OSNAME),cygming)
ifneq ($(OSNAME),windows)
ifneq ($(OSNAME),darwin)
ifneq ($(OSNAME),iphone)
ifneq ($(CXX_VERSION_MAJOR),2)
CXXFLAGS += -fuse-cxa-atexit
endif
endif
endif
endif
endif

- In build/lib run ./configure --target='iphone'; make -f gcc.mak install-release-static
- The lib should be in ./iphone-lib

That's should work without errors.

Aucun commentaire: