diff --git a/.gitignore b/.gitignore index 3dcfb77a97..67d048301b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ project.xcworkspace examples/tutorial.d examples/tutorial.o examples/tutorial + +# sh build.sh ios-framework +/Tightdb.framework +tightdb-ios.zip \ No newline at end of file diff --git a/README.md b/README.md index afdc0599d0..92789b0fe7 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,12 @@ can be tested via the Xcode project in: test-iphone/ +To ease the development using Xcode, you can generate a framework using +the command: + sh build.sh ios-framework + +The framework is stored in the `tightdb-ios.zip` file. Configuration ------------- diff --git a/build.sh b/build.sh index bc5a405373..43d7a8948a 100644 --- a/build.sh +++ b/build.sh @@ -402,6 +402,24 @@ EOF exit 0 ;; + "ios-framework") + if [ "$OS" != "Darwin" ]; then + echo "Framework for iOS can only be generated under Mac OS X" + exit 0 + fi + FRAMEWORK=Tightdb.framework + rm -rf "$FRAMEWORK" Tightdb-ios.zip || exit 1 + mkdir -p "$FRAMEWORK/Headers" || exit 1 + cp iphone-lib/libtightdb-objc-ios.a "$FRAMEWORK/Tightdb" || exit 1 + cp iphone-lib/include/tightdb/objc/*.h "$FRAMEWORK/Headers" || exit 1 + (cd "$FRAMEWORK/Headers" && mv tightdb.h Tightdb.h) || exit 1 + find "$FRAMEWORK/Headers" -name '*.h' -exec sed -i '' -e 's/import /import "\1"/g' {} \; || exit 1 + find "$FRAMEWORK/Headers" -name '*.h' -exec sed -i '' -e 's/include /include "\1"/g' {} \; || exit 1 + zip -r -q tightdb-ios.zip $FRAMEWORK || exit 1 + echo "Framwork for iOS can be found in tightdb-ios.zip" + exit 0 + ;; + "test") require_config || exit 1 $MAKE test-norun || exit 1 @@ -557,6 +575,7 @@ EOF echo "Unspecified or bad mode '$MODE'" 1>&2 echo "Available modes are: config clean build build-iphone test test-debug test-gdb show-install install uninstall test-installed" 1>&2 echo "As well as: install-prod install-devel uninstall-prod uninstall-devel dist-copy" 1>&2 + echo "As wall as: ios-framework" exit 1 ;;