关于库的简短描述:Link of library
我想为iPhone sdk编译swift库(即http://swift.im/git/swift/tag/?id=swift-2.0beta1)。我查看了它的文档、文件夹和编译方法,但他们只提到了Windows和Unix的编译步骤(即此页面包含编译文件http://swift.im/download/#apt的链接)。但是我不知道如何为iPhone sdk编译它。他们提到的步骤没有得到。那么,有谁能解释一下我吗?在检查了其中一个文件后,我知道应该可以为iPhone编译。
还有一个问题,他们提到它是在GNU通用公共许可证v3下的,所以我可以使用它的商业应用,特别是苹果批准它?
任何帮助都将不胜感激。谢谢
发布于 2012-09-14 20:27:02
iOS Swiften已经内置了对构建Figure设备或模拟器的支持。我能够构建它,但还没有测试它。
我假设您使用的是z XCode 4.4 (或者足够现代的版本),目标是在iPhone > 3GS上运行的iOS 5.1。另外,我将假设您想要构建swiften-1.0。(如果构建的是较早版本的iPhone,请将armv7改回下面的armv6 )
为了构建它,需要执行几个步骤。
修复路径和SDK版本
在文件编辑器中打开swift-1.0/BuildTools/SCons/SConstruct,然后:
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"
armv6更改为armv7
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/
(摘自马特·加洛维的Compiling Boost for the 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没有内置的and,因此您必须下载并手动编译它。在终端中执行以下命令:
cd <swift-directory>/3rdParty/OpenSSL
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz这将下载openssl的源代码;为了构建它,我使用了一个script from 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。可以在<swift-directory>/Swiften中找到库文件libSwiften.a。
https://stackoverflow.com/questions/12280729
复制相似问题