From 32fef976301f19dba9bdf371777cd5374d327eff Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Thu, 13 Nov 2014 13:06:05 +0100 Subject: Fix iOS build and add iOS build documentation. Test-Information: Tested on OS X 10.9.5 with XCode 6.1. Change-Id: Ib223977192fce274e5585ef0768fd755b1fa734d diff --git a/BuildTools/iOS/swiften.xcodeproj/project.pbxproj b/BuildTools/iOS/swiften.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1fcaa30 --- /dev/null +++ b/BuildTools/iOS/swiften.xcodeproj/project.pbxproj @@ -0,0 +1,230 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXFileReference section */ + F6CD8AEF1A1293000039D508 /* libswift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libswift.a; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F6CD8AEC1A1293000039D508 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + F6CD8AE41A1292C00039D508 = { + isa = PBXGroup; + children = ( + F6CD8AF11A1293000039D508 /* swiften */, + F6CD8AF01A1293000039D508 /* Products */, + ); + sourceTree = ""; + }; + F6CD8AF01A1293000039D508 /* Products */ = { + isa = PBXGroup; + children = ( + F6CD8AEF1A1293000039D508 /* libswift.a */, + ); + name = Products; + sourceTree = ""; + }; + F6CD8AF11A1293000039D508 /* swiften */ = { + isa = PBXGroup; + children = ( + ); + path = swiften; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F6CD8AEE1A1293000039D508 /* swiften */ = { + isa = PBXNativeTarget; + buildConfigurationList = F6CD8B011A1293000039D508 /* Build configuration list for PBXNativeTarget "swiften" */; + buildPhases = ( + F6CD8B071A1293A10039D508 /* Build Swift */, + F6CD8AEC1A1293000039D508 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = swiften; + productName = swiften; + productReference = F6CD8AEF1A1293000039D508 /* libswift.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F6CD8AE51A1292C00039D508 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + TargetAttributes = { + F6CD8AEE1A1293000039D508 = { + CreatedOnToolsVersion = 6.1; + }; + }; + }; + buildConfigurationList = F6CD8AE81A1292C00039D508 /* Build configuration list for PBXProject "swiften" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = F6CD8AE41A1292C00039D508; + productRefGroup = F6CD8AF01A1293000039D508 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F6CD8AEE1A1293000039D508 /* swiften */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + F6CD8B071A1293A10039D508 /* Build Swift */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Build Swift"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd $PWD/../../\n./scons enable_variants=1 build_examples=0 target=xcode Swift/Controllers Swiften"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + F6CD8AE91A1292C00039D508 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Debug; + }; + F6CD8AEA1A1292C00039D508 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Release; + }; + F6CD8B021A1293000039D508 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F6CD8B031A1293000039D508 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F6CD8AE81A1292C00039D508 /* Build configuration list for PBXProject "swiften" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6CD8AE91A1292C00039D508 /* Debug */, + F6CD8AEA1A1292C00039D508 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F6CD8B011A1293000039D508 /* Build configuration list for PBXNativeTarget "swiften" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F6CD8B021A1293000039D508 /* Debug */, + F6CD8B031A1293000039D508 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F6CD8AE51A1292C00039D508 /* Project object */; +} diff --git a/Documentation/BuildingOnIOS.txt b/Documentation/BuildingOnIOS.txt new file mode 100644 index 0000000..dfc2194 --- /dev/null +++ b/Documentation/BuildingOnIOS.txt @@ -0,0 +1,44 @@ +Prerequisites +------------ +- XCode +- Python +- Other requirements that are obtained during this guide + - OpenSSL + +Supported Components +-------------------- +- Swiften + Note: File-transfer support has not been tested on Android. Link-local features are not supported under Android. +- Swift/Controllers + +Preparation of Build Environment +-------------------------------- +1. Fetch 3rd-party dependencies + +1.1 OpenSSL + cd 3rdParty/OpenSSL + curl -O http://www.openssl.org/source/openssl-1.0.0a.tar.gz + tar -xf openssl-1.0.0a.tar.gz + mv openssl-1.0.0a openssl + +Building +-------- +1. Switch to iOS directory + cd BuildTools/IOS + +2. Look up installed SDKs + xcodebuild -showsdks + + Note: Here the iOS SDKs and iOS Simulator SDKs are of interest. + +3. Build Swiften (adjust the sdk parameter to one of the installed SDKs) + xcodebuild build -arch i386 -sdk iphonesimulator8.1 + + Note: When not specifying the architecture (-arch flag) XCode will try an universal build which is not supported. + Only specify one architecture at a time and if you require a universal lib you can create one using the lipo tool. + +4. The final libSwiften.a is located at $SWIFT/build/current/Swiften/libSwiften.a. + +Testing +------- +Integration and unit tests are not supported on iOS. diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp index 54fb7bd..991a7dd 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.cpp +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.cpp @@ -69,7 +69,7 @@ OpenSSLContext::OpenSSLContext() : state_(Start), context_(0), handle_(0), readB } #elif !defined(SWIFTEN_PLATFORM_MACOSX) SSL_CTX_load_verify_locations(context_, NULL, "/etc/ssl/certs"); -#elif defined(SWIFTEN_PLATFORM_MACOSX) +#elif defined(SWIFTEN_PLATFORM_MACOSX) && !defined(SWIFTEN_PLATFORM_IPHONE) // On Mac OS X 10.5 (OpenSSL < 0.9.8), OpenSSL does not automatically look in the system store. // On Mac OS X 10.6 (OpenSSL >= 0.9.8), OpenSSL *does* look in the system store to determine trust. // However, if there is a certificate error, it will always emit the "Invalid CA" error if we didn't add -- cgit v0.10.2-6-g49f6