toolchain: supports for recipe that have multiple libraries to install

This commit is contained in:
Mathieu Virbel 2015-02-20 16:12:20 +01:00
parent 8f1ede0449
commit 82f0a0f6cc

View file

@ -605,12 +605,21 @@ class Recipe(object):
self.build(arch) self.build(arch)
name = self.name name = self.name
if self.library:
print("Create lipo library for {}".format(name))
if not name.startswith("lib"): if not name.startswith("lib"):
name = "lib{}".format(name) name = "lib{}".format(name)
static_fn = join(self.ctx.dist_dir, "lib", "{}.a".format(name)) static_fn = join(self.ctx.dist_dir, "lib", "{}.a".format(name))
ensure_dir(dirname(static_fn)) ensure_dir(dirname(static_fn))
print("Lipo {} to {}".format(self.name, static_fn)) print("Lipo {} to {}".format(self.name, static_fn))
self.make_lipo(static_fn) self.make_lipo(static_fn)
elif self.libraries:
print("Create multiple lipo for {}".format(name))
for library in self.libraries:
static_fn = join(self.ctx.dist_dir, "lib", basename(library))
ensure_dir(dirname(static_fn))
print(" - Lipo-ize {}".format(library))
self.make_lipo(static_fn, library)
print("Install include files for {}".format(self.name)) print("Install include files for {}".format(self.name))
self.install_include() self.install_include()
print("Install {}".format(self.name)) print("Install {}".format(self.name))
@ -632,15 +641,17 @@ class Recipe(object):
getattr(self, postbuild)() getattr(self, postbuild)()
@cache_execution @cache_execution
def make_lipo(self, filename): def make_lipo(self, filename, library=None):
if not self.library: if library is None:
library = self.library
if not library:
return return
args = [] args = []
for arch in self.filtered_archs: for arch in self.filtered_archs:
library = self.library.format(arch=arch) library_fn = library.format(arch=arch)
args += [ args += [
"-arch", arch.arch, "-arch", arch.arch,
join(self.get_build_dir(arch.arch), library)] join(self.get_build_dir(arch.arch), library_fn)]
shprint(sh.lipo, "-create", "-output", filename, *args) shprint(sh.lipo, "-create", "-output", filename, *args)
@cache_execution @cache_execution