kivy-ios/recipes/libffi/__init__.py

49 lines
1.5 KiB
Python
Raw Normal View History

2015-02-02 05:22:01 +01:00
from toolchain import Recipe, shprint
from os.path import join, exists
2015-02-02 05:22:01 +01:00
import sh
import shutil
2015-02-02 05:22:01 +01:00
class LibffiRecipe(Recipe):
version = "3.2.1"
2015-02-02 05:22:01 +01:00
url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
2015-02-04 15:50:16 +01:00
library = "build/Release-{arch.sdk}/libffi.a"
2015-02-02 05:22:01 +01:00
def prebuild_arch(self, arch):
if self.has_marker("patched"):
return
# necessary as it doesn't compile with XCode 6.0. If we use 5.1.1, the
# compiler for i386 is not working.
shprint(sh.sed,
"-i.bak",
"s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=6.0/g",
"generate-darwin-source-and-headers.py")
2015-02-02 05:22:01 +01:00
self.set_marker("patched")
def build_arch(self, arch):
shprint(sh.xcodebuild,
2015-02-04 15:50:16 +01:00
"ONLY_ACTIVE_ARCH=NO",
"ARCHS={}".format(arch.arch),
"-sdk", arch.sdk,
2015-02-02 05:22:01 +01:00
"-project", "libffi.xcodeproj",
"-target", "libffi-iOS",
"-configuration", "Release")
2015-02-03 18:42:17 +01:00
def install(self):
for sdkarch, arch in (
("iphoneos-arm64", "arm64"),
("iphoneos-armv7", "armv7"),
("iphonesimulator-i386", "i386"),
("iphonesimulator-x86_64", "x86_64")):
2015-02-03 18:42:17 +01:00
dest_dir = join(self.ctx.dist_dir, "include", arch)
if exists(dest_dir):
continue
shutil.copytree(join(
2015-02-04 15:50:16 +01:00
self.get_build_dir(arch),
"build_{}/include".format(sdkarch)),
2015-02-03 18:42:17 +01:00
dest_dir)
2015-02-02 05:22:01 +01:00
recipe = LibffiRecipe()