from toolchain import Recipe, shprint import sh class LibffiRecipe(Recipe): version = "3.2.1" url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz" library = "build/Release-{arch.sdk}/libffi.a" include_per_arch = True include_dir = "build_{arch.sdk}-{arch.arch}/include" 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") self.apply_patch("fix-win32-unreferenced-symbol.patch") self.set_marker("patched") def build_arch(self, arch): shprint(sh.xcodebuild, "ONLY_ACTIVE_ARCH=NO", "ARCHS={}".format(arch.arch), "-sdk", arch.sdk, "-project", "libffi.xcodeproj", "-target", "libffi-iOS", "-configuration", "Release") recipe = LibffiRecipe()