2020-05-03 16:23:08 +02:00
|
|
|
from kivy_ios.toolchain import Recipe, shprint
|
2015-02-02 05:22:01 +01:00
|
|
|
import sh
|
2018-10-27 18:51:07 +02:00
|
|
|
from os.path import exists
|
2015-02-02 05:22:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
class LibffiRecipe(Recipe):
|
2015-02-03 00:19:53 +01:00
|
|
|
version = "3.2.1"
|
2020-06-12 17:56:02 +02:00
|
|
|
url = "https://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-06 01:53:21 +01:00
|
|
|
include_per_arch = True
|
|
|
|
include_dir = "build_{arch.sdk}-{arch.arch}/include"
|
2018-11-09 17:54:56 +01:00
|
|
|
include_name = "ffi"
|
2019-01-12 22:19:21 +01:00
|
|
|
archs = ["x86_64", "arm64"]
|
2015-02-02 05:22:01 +01:00
|
|
|
|
|
|
|
def prebuild_arch(self, arch):
|
|
|
|
if self.has_marker("patched"):
|
|
|
|
return
|
2018-10-27 18:51:07 +02:00
|
|
|
# XCode 10 minimum is 8.0 now.
|
2015-02-03 00:19:53 +01:00
|
|
|
shprint(sh.sed,
|
|
|
|
"-i.bak",
|
2018-10-27 18:51:07 +02:00
|
|
|
"s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=8.0/g",
|
2015-02-03 00:19:53 +01:00
|
|
|
"generate-darwin-source-and-headers.py")
|
2015-02-11 12:54:24 +01:00
|
|
|
self.apply_patch("fix-win32-unreferenced-symbol.patch")
|
2020-05-06 10:56:47 +02:00
|
|
|
self.apply_patch("generate-darwin-source-and-headers-python3-items.patch")
|
2015-02-02 05:22:01 +01:00
|
|
|
self.set_marker("patched")
|
|
|
|
|
|
|
|
def build_arch(self, arch):
|
2018-10-27 18:51:07 +02:00
|
|
|
if exists("generate-darwin-source-and-headers.py"):
|
|
|
|
shprint(
|
|
|
|
sh.mv,
|
|
|
|
"generate-darwin-source-and-headers.py",
|
|
|
|
"_generate-darwin-source-and-headers.py")
|
|
|
|
shprint(sh.touch, "generate-darwin-source-and-headers.py")
|
2020-05-06 10:56:47 +02:00
|
|
|
python3 = sh.Command("python3")
|
|
|
|
shprint(python3, "_generate-darwin-source-and-headers.py", "--only-ios")
|
2017-05-02 08:10:11 +02:00
|
|
|
shprint(sh.xcodebuild, self.ctx.concurrent_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",
|
2015-02-03 00:19:53 +01:00
|
|
|
"-target", "libffi-iOS",
|
|
|
|
"-configuration", "Release")
|
|
|
|
|
2015-02-02 05:22:01 +01:00
|
|
|
|
|
|
|
recipe = LibffiRecipe()
|