FiguresSwiften已经内置了对 iOS 设备或模拟器构建的支持。我能够构建它,但还没有测试它。
我将假设您是 z XCode 4.4(或足够现代的东西)并以在 iPhone > 3GS 上运行的 iOS 5.1 为目标。另外,我假设您想要构建 swiften-1.0。(如果为早期的 iPhone 构建,请改armv7回armv6下方)
为了构建它,涉及几个步骤。
修复路径和 SDK 版本
swift-1.0/BuildTools/SCons/SConstruct在文件编辑器中打开,然后:
将第 232 行从
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"
到
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Applications/Xcode.app/Contents" + "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"
在第 234 行,更改armv6为armv7
- 在第 239 行,将“4.0”更改为“5.1”
将第 240 行从
env["XCODE_SDKROOT"] = "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
到
env["XCODE_SDKROOT"] = "/Applications/Xcode.app/Contents" + "/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
复制crt_externs.h到swift-1.0/
(来自 Matt Galloway 的iPhone 编译提升)
复制crt_externs.h到swift'目录;在 中时swift-1.0/,执行:
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/usr/include/crt_externs.h .
下载并构建openssl
swiften需要openssl,但iOS没有内置的,所以你必须手动下载和编译。在终端中执行以下命令:
cd <swift-directory>/3rdParty/OpenSSL
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
这将下载 openssl 的源代码;为了构建它,我使用了来自 GitHub 的脚本。仍在<swift-directory>/swift-1.0/3rdParty/OpenSSL,执行,
wget --no-check-certificate https://raw.github.com/st3fan/ios-openssl/master/build.sh
编辑build.sh- 将第 10 行从 更改1.0.1b为1.0.1c。
现在,chmod +x build.sh最后./build.sh。这将需要几分钟的时间来构建openssl。
建造swiften
你快到了 - 将目录更改为的根目录swift,然后执行
./scons Swiften allow_warnings=yes target=iphone-device openssl="<swift-directory>/3rdParty/OpenSSL"
这将构建一个库,用于链接为设备构建的应用程序;如果您想在模拟器中运行它,请更改target=iphone-device为target-iphone-simulator上面的行。库文件libSwiften.a可以在<swift-directory>/Swiften.