summaryrefslogtreecommitdiff
path: root/recipes/stlport.recipe
blob: caba70bd556c5374fa3cf6b45b98a065fda5ed2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil

from cerbero.tools.libtool import LibtoolLibrary
from cerbero.tools.pkgconfig import PkgConfigWritter

class Recipe(recipe.Recipe):
    name = 'stlport'
    version = '0.1'
    licenses = [License.LGPLv2_1]
    stype = SourceType.CUSTOM
    btype = BuildType.CUSTOM

    files_stlport = [
            'lib/libstlport.so']
    files_devel= [
            'lib/pkgconfig/stlport.pc',
            'lib/libstlport.la',
            'lib/libstlport.a',
            ]

    def prepare(self):
        if self.config.target_platform != Platform.ANDROID:
            raise InvalidRecipeError(self, "Invalid platform")

    def install(self):
        stlport_prefix = os.path.join(self.config.toolchain_prefix, 'sources',
                'cxx-stl', 'stlport')
        stlport_libdir = os.path.join(stlport_prefix, 'libs', 'armeabi')
        libdir = os.path.join(self.config.prefix, 'lib')

        # Copies libraries to the prefix
        shutil.copy(os.path.join(stlport_libdir, 'libstlport_shared.so'),
                    os.path.join(libdir, 'libstlport.so'))
        shutil.copy(os.path.join(stlport_libdir, 'libstlport_static.a'),
                    os.path.join(libdir, 'libstlport.a'))


        # Create a libtool library for stlport (libstlport.la)
        lib = LibtoolLibrary('stlport', None, None, None, libdir,
                self.config.target_platform)
        lib.change_value('dependency_libs', ' -lstdc++')
        lib.save()

        # Create pkg-config file (stlport.pc)
        stlport_pc = PkgConfigWritter('stlport', 'stlport', '1.0',
                '', '-L${libdir} -lstlport -lstdc++ ',
                '-I%s/stlport -fno-exceptions' % stlport_prefix, self.config.prefix)
        stlport_pc.libs_priv = '${libdir}/libstlport.a'
        stlport_pc.rel_incldir = 'stlport'
        stlport_pc.save('stlport', os.path.join(self.config.prefix, 'lib',
            'pkgconfig'))