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

ide: xcode: frameworks: crate dynamic and static framework lib creator classes

Split the apple's framework creation class into 2 subclasses for creating
dynamic and static frameworks.

The dynamic one is used of OSX packaging, the static should be used for
parent 6f0278e8
......@@ -18,6 +18,8 @@
# Boston, MA 02111-1307, USA.
import os
import tempfile
import shutil
from cerbero.config import Architecture
from cerbero.ide.pkgconfig import PkgConfig
......@@ -47,7 +49,7 @@ class FrameworkLibrary(object):
libspaths = []
for lib in libs:
for libdir in libdirs:
libpath = os.path.join(libdir, 'lib%s.dylib' % lib)
libpath = os.path.join(libdir, self._get_lib_file_name (lib))
if not os.path.exists(libpath):
......@@ -55,8 +57,40 @@ class FrameworkLibrary(object):
return libspaths
def _create_framework_library(self, libname, install_name, libraries, arch):
raise NotImplemented
def _get_lib_file_name(self, lib):
return lib
class DynamicFrameworkLibrary(FrameworkLibrary):
def _create_framework_library(self, libname, install_name, libraries, arch):
extra_options = self._get_create_framework_options (libname)
libraries = ' '.join(['-Wl,-reexport_library %s' % x for x in libraries])'gcc -dynamiclib -o %s -arch %s -install_name %s %s' %
(libname, arch, install_name, libraries))
def _get_lib_file_name(self, lib):
return 'lib%s.dylib' % lib
class StaticFrameworkLibrary(FrameworkLibrary):
def _get_lib_file_name(self, lib):
return 'lib%s.a' % lib
def _create_framework_library(self, libname, install_name, libraries, arch):
tmpdir = tempfile.mkdtemp()
for lib in libraries:
libprefix = os.path.split(lib)[-1].replace('.', '_')
lib_tmpdir = tempfile.mkdtemp()
shutil.copy(lib, lib_tmpdir)
tmplib = os.path.join(lib_tmpdir, os.path.basename(lib))'ar -x %s' % tmplib, lib_tmpdir)
obj_files = shell.ls_files(['*.o'], lib_tmpdir)
for obj_f in obj_files:'cp %s %s' % (os.path.join(lib_tmpdir, obj_f), '%s-%s' % (libprefix, obj_f)), tmpdir)'ar -cqS %s %s-%s' % (libname, libprefix, obj_f), tmpdir)'ar -s %s' % (libname), tmpdir)
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.ide.xcode.fwlib import FrameworkLibrary
from cerbero.ide.xcode.fwlib import DynamicFrameworkLibrary
class Recipe(recipe.Recipe):
name = 'gstreamer-osx-framework'
......@@ -13,7 +13,7 @@ class Recipe(recipe.Recipe):
files_library = ['lib/GStreamer']
def install(self):
fwlib = FrameworkLibrary()
fwlib = DynamicFrameworkLibrary()
install_name = os.path.join(self.config.prefix, 'lib', 'GStreamer')
libs = ['gstreamer-0.10', 'gstreamer-app-0.10', 'gstreamer-audio-0.10',
'gstreamer-base-0.10', 'gstreamer-cdda-0.10',
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