kivy-ios/recipes/hostlibffi/__init__.py
Richard Larkin 64bd692632
Flake8 CI fixes (#451)
* Pep8 fixes

* tox Pep8 compliance

* Excluded external tools folder from flake 8 tests

* Added Flake 8 exclusions

* Pep8 fixes

* Pep8 fixes

* Corrected type

* Pep8 fixes

* Pep 8 compliance

* Pep8 fixes

* Pep8  fixes

* Pep8 fixes

* Pep8 fixes

* Pep 8 fixes

* Pep 8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8

* Pep8

* Pep 8

* Pep 8

* Pep8 fixes

* Pep8

* Pep8

* Pep8

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Revert chagnes

* Revert changes to kivy/__init.py

* Revert changes

* REvert changes

* Revert changes

* Revert changes to toolchain

* Add files exclusions to tox.ini

* Added exclusions for alias recipes

* Remove dead code

* Added py extension to recipes

* Removed recipe build skip

* Improves recipe matching

Previous expression was matching all the following three lines of a `git diff --name-only` output.
```
recipes/hostlibffi/__init__.py
recipes/hostpython.py
recipes/hostpython2/__init__.py
```
This was resulting to a bug when later splitting with `recipe = file_path.split('/')[1]` the `recipes/hostpython.py` string would return including the `\n` new line char, see:
 ```
>>> 'recipes/hostpython.py\n'.split('/')[1]
'hostpython.py\n'
>>> 'recipes/hostlibffi/__init__.py\n'.split('/')[1]
'hostlibffi'
>>> 
```

Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com>
2020-04-25 18:28:16 +02:00

68 lines
2.4 KiB
Python

from toolchain import Recipe, shprint
import sh
from os.path import exists
import logging
logger = logging.getLogger(__name__)
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"
archs = ["x86_64"]
def build_all(self):
filtered_archs = self.filtered_archs
logger.info("Build {} for {} (filtered)".format(
self.name,
", ".join([x.arch for x in filtered_archs])))
for arch in self.filtered_archs:
self.build(arch)
# since we don't run cache_execution, call this here for `status`
self.update_state("{}.build_all".format(self.name), True)
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.apply_patch("public_include.patch")
self.apply_patch("staticlib.patch")
self.apply_patch("staticlib2.patch")
self.apply_patch("libffi-xcode10.patch")
self.set_marker("patched")
def build_arch(self, arch):
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")
python27 = sh.Command("python2.7")
shprint(python27, "_generate-darwin-source-and-headers.py", "--only-osx")
shprint(sh.xcodebuild,
self.ctx.concurrent_xcodebuild,
"ONLY_ACTIVE_ARCH=NO",
"ARCHS={}".format(arch.arch),
"DSTROOT={}/hostlibffi".format(self.ctx.dist_dir),
"-sdk", "macosx",
"clean", "build", "installhdrs", "install",
"-project", "libffi.xcodeproj",
"-scheme", "libffi-Mac",
"-configuration", "Release")
def postbuild_arch(self, arch):
pass
recipe = LibffiRecipe()