Commit a07ece9a authored by Thiago Santos's avatar Thiago Santos
Browse files

packager: ios: add ios packaging support

ios packages are shipped as a Framework directory into a .dmg file.

The framework contains a static lib that is the result of merging all
static libs required for the intended package
parent d10159f0
......@@ -68,7 +68,7 @@ class BundlePackagerBase(PackagerBase):
install_dir, target=None)
return output_file
def create_bundle(self):
def create_bundle(self, target_dir=None):
Creates the bundle structure
......@@ -88,7 +88,7 @@ class FrameworkBundlePackager(BundlePackagerBase):
def __init__(self, package, name, desc, uuid):
BundlePackagerBase.__init__(self, package, name, desc, uuid)
def create_bundle(self):
def create_bundle(self, target_dir=None):
Creates the bundle structure
......@@ -100,7 +100,10 @@ class FrameworkBundlePackager(BundlePackagerBase):
Versions/Current -> Version/$VERSION/$ARCH
Framework -> Versions/Current/Famework
tmp = tempfile.mkdtemp()
if target_dir:
tmp = target_dir
tmp = tempfile.mkdtemp()
if self.config.target_arch == Architecture.UNIVERSAL:
arch_dir = ''
......@@ -22,6 +22,7 @@ import shutil
from cerbero.config import Architecture
from cerbero.ide.pkgconfig import PkgConfig
from cerbero.ide.xcode.fwlib import StaticFrameworkLibrary
from cerbero.errors import EmptyPackageError
from cerbero.packages import PackagerBase, PackageType
from cerbero.packages.package import Package, MetaPackage, SDKPackage, App,\
......@@ -398,6 +399,78 @@ class ApplicationPackage(PackagerBase):
return dmg_file
class IOSFrameworkPackage(PackagerBase):
def __init__(self, config, package, store):
PackagerBase.__init__(self, config, package, store)
self.packages =
def pack(self, output_dir, devel=False, force=False, keep_temp=False):
PackagerBase.pack(self, output_dir, devel, force, keep_temp)
framework_name = self.package.ios_framework_library[0]
self.include_dirs = PkgConfig.list_all_include_dirs()
self.tmp = tempfile.mkdtemp()
out_dir = self.fw_path = os.path.join(self.tmp, "%s.framework" % framework_name) ('mkdir -p %s' % self.fw_path, self.tmp)
root_dir = os.path.join(self.fw_path, "Versions", "Current")
static_libs = []
for p in self.packages:
m.action(_("Creating package %s ") % p)
packager = OSXPackage(self.config, p,
files = packager.files_list(PackageType.DEVEL, force)
except EmptyPackageError, e:
files = []
for f in files:
#TODO merge together into common file copy routine
in_path = os.path.join(self.config.prefix, f)
if not os.path.exists(in_path):
m.warning("File %s is missing and won't be added to the "
"package" % in_path)
if os.path.splitext(f)[-1] == '.a':
static_libs.append(in_path) #libs are merged together later
out_path = os.path.join(root_dir, f)
odir = os.path.split(out_path)[0]
if not os.path.exists(odir):
shutil.copy(in_path, out_path)
install_name = os.path.join(root_dir, 'lib', framework_name)
self._create_merged_lib(install_name, static_libs)
#create <framework>/Versions/Current/<framework> file'cp %s %s' % (install_name, root_dir))
return [None, self._create_dmg()]
def _create_merged_lib (self, install_name, libs_list):
fwlib = StaticFrameworkLibrary()
fwlib.create(install_name, install_name, libs_list, self.config.target_arch, False)
def _create_dmg(self):
dmg_file = os.path.join(self.output_dir, '%s-%s-ios-%s.dmg' % (, self.package.version, self.config.target_arch))
# Create Disk Image
cmd = 'hdiutil create %s -volname %s -ov -srcfolder %s' % \
(dmg_file,, self.tmp)
return dmg_file
def _create_framework_bundle_package(self):
m.action(_("Creating framework package"))
packager = FrameworkBundlePackager(self.package, 'ios-framework',
'Framework Bundle',
path = packager.create_bundle(self.fw_path)
return path
class Packager(object):
......@@ -415,4 +488,5 @@ def register():
from cerbero.packages.packager import register_packager
from cerbero.config import Distro
register_packager(Distro.OS_X, Packager)
register_packager(Distro.IOS, IOSFrameworkPackage)
......@@ -25,5 +25,6 @@ class Package(package.Package):
'gst-plugins-good-static:plugins_core_devel', 'gst-plugins-bad-static:plugins_core_devel']
platform_files = {
Platform.DARWIN: ['gstreamer-osx-framework'],
Platform.IOS: ['gstreamer-ios-framework'],
Platform.ANDROID: ['gst-android'],
......@@ -61,6 +61,7 @@ class SDKPackage(package.SDKPackage):
osx_framework_library = ('GStreamer', 'lib/GStreamer')
ios_framework_library = ('GStreamer', 'lib/GStreamer')
def prepare(self):
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.ide.xcode.fwlib import StaticFrameworkLibrary
class Recipe(recipe.Recipe):
name = 'gstreamer-ios-framework'
version = '0.1'
licenses = [License.LGPL]
stype = SourceType.CUSTOM
btype = BuildType.CUSTOM
deps = ['gstreamer-static', 'gst-plugins-base-static',
'gst-plugins-good-static', 'gst-plugins-ugly-static',
'gst-plugins-bad-static', 'gst-ffmpeg-static']
files_library = ['lib/GStreamer']
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment