summaryrefslogtreecommitdiff
path: root/recipes/libmpeg2.recipe
blob: 32a3a93712e577c3a778b50075c9f191b50852af (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.utils import shell

class Recipe(recipe.Recipe):
    name = 'libmpeg2'
    version = '0.5.1'
    stype = SourceType.TARBALL
    url = 'http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz'
    licenses = [License.GPLv2Plus]
    autoreconf = True
    patches = ['libmpeg2/0001-Disable-AC_C_ALWAYS_INLINE.patch',
               'libmpeg2/0002-Import-revision-1206-from-upstream-to-fix-PIE-build.patch']

    files_libs = ['libmpeg2', 'libmpeg2convert']
    files_bins = ['mpeg2dec', 'extract_mpeg2', 'corrupt_mpeg2']
    files_devel = ['include/mpeg2dec', 'lib/pkgconfig/libmpeg2.pc',
                   'lib/pkgconfig/libmpeg2convert.pc']

    def prepare(self):
        if self.config.variants.nox11:
            self.configure_options += ' --without-x '
        if self.config.variants.nosdl:
            self.configure_options += ' --disable-sdl '
        if self.config.target_platform == Platform.IOS:
            if Architecture.is_arm(self.config.target_arch):
                self.new_env = {'CCAS': os.environ['GAS']}
                self.new_env['CCAS'] += ' -no-integrated-as '
                self.append_env = {'LDFLAGS': ' -Wl,-read_only_relocs,suppress'}

    def compile(self):
        if self.config.target_platform == Platform.IOS:
            if Architecture.is_arm(self.config.target_arch):
                arm_f = os.path.join(self.build_dir, 'libmpeg2', 'motion_comp_arm_s.S')
                shell.replace(arm_f,
                    {'.global MC_put_o_16_arm\nMC_put_o_16_arm:': '.global _MC_put_o_16_arm\n_MC_put_o_16_arm:',
                     '.global MC_put_o_8_arm\nMC_put_o_8_arm:': '.global _MC_put_o_8_arm\n_MC_put_o_8_arm:',
                     '.global MC_put_x_16_arm\nMC_put_x_16_arm:': '.global _MC_put_x_16_arm\n_MC_put_x_16_arm:',
                     '.global MC_put_x_8_arm\nMC_put_x_8_arm:': '.global _MC_put_x_8_arm\n_MC_put_x_8_arm:',
                    })
        super(recipe.Recipe, self).compile()