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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary
class Recipe(recipe.Recipe):
name = 'openh264'
version = '1.7.0'
url = 'https://github.com/cisco/%(name)s/archive/v%(version)s.tar.gz'
tarball_checksum = '9c07c38d7de00046c9c52b12c76a2af7648b70d05bd5460c8b67f6895738653f'
stype = SourceType.TARBALL
btype = BuildType.MAKEFILE
licenses = [{License.BSD: ['LICENSE']}]
files_libs = ['libopenh264']
files_devel = ['include/wels', 'lib/pkgconfig/openh264.pc']
patches = ['openh264/0001-openh264-Build-for-8.0-fembed-bitcode.patch',
'openh264/0002-ios-Remove-flags-incompatible-with-fembed-bitcode.patch',
'openh264/0001-android-build-switch-to-using-the-c-_shared-c-librar.patch']
def prepare(self):
make = self.make
if self.config.target_platform == Platform.IOS:
make += ' OS=ios '
if self.config.target_arch == Architecture.X86:
make += ' ARCH=i386'
elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64'
elif self.config.target_arch == Architecture.ARMv7:
make += ' ARCH=armv7'
elif self.config.target_arch == Architecture.ARMv7S:
make += ' ARCH=armv7s'
elif self.config.target_arch == Architecture.ARM:
make += ' ARCH=arm APP_ABI=armeabi'
elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64'
elif self.config.target_platform == Platform.DARWIN:
make += ' OS=darwin '
if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86'
elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64'
elif self.config.target_platform == Platform.ANDROID:
v = DistroVersion.get_android_api_version(self.config.target_distro_version)
make += ' OS=android TARGET=android-' + str(v) + ' NDKLEVEL=' + str(v)
make += ' NDKROOT=' + self.config.toolchain_prefix
if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86'
elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64'
elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64'
elif self.config.target_platform == Platform.WINDOWS:
make += ' OS=mingw_nt'
if self.config.target_arch == Architecture.X86:
make += ' ARCH=x86'
elif self.config.target_arch == Architecture.X86_64:
make += ' ARCH=x86_64'
elif self.config.target_platform == Platform.LINUX:
if self.config.target_arch == Architecture.ARMv7:
make += ' ARCH=armv7'
elif self.config.target_arch == Architecture.ARMv7S:
make += ' ARCH=armv7s'
elif self.config.target_arch == Architecture.ARM:
make += ' ARCH=arm APP_ABI=armeabi'
elif self.config.target_arch == Architecture.ARM64:
make += ' ARCH=arm64'
self.make = make + ' libraries'
# `make install` also needs the exact same parameters as `make`
self.make_install = make + ' install'
def configure(self):
if self.config.platform == Platform.WINDOWS:
# Convert c:/foo to /c/foo for this build system. It will add the
# initial / by itself, /c:/foo does not work and and //c is not
# the same as /c on Windows. //c/foo is a network path.
if not self.config.prefix.startswith('/') and self.config.prefix[1] == ':':
p = "/" + self.config.prefix[0] + self.config.prefix[2:]
else:
p = self.config.prefix
shell.replace(os.path.join(self.build_dir, 'Makefile'),
# Fix hard-coded prefix
{'PREFIX=/usr/local': "PREFIX=" + p})
else:
shell.replace(os.path.join(self.build_dir, 'Makefile'),
# Fix hard-coded prefix
{'PREFIX=/usr/local': "PREFIX=" + self.config.prefix})
shell.replace(os.path.join(self.build_dir, 'build',
'x86-common.mk'),
# Use yasm instead of nasm, since that's what Cerbero
# ships with
{'ASM = nasm': "ASM = yasm"})
if self.config.target_platform == Platform.IOS and self.config.target_arch in [Architecture.X86, Architecture.X86_64]:
shell.replace(os.path.join(self.build_dir, 'build',
'platform-ios.mk'),
# Use correct compiler flag for iOS simulator
{'-miphoneos-version-min': '-mios-simulator-version-min'})
# No configure script
def post_install(self):
# XXX: Don't forget to keep this in sync with the library version!
dependency_libs=[]
if self.config.target_platform == Platform.IOS:
dependency_libs += ['-lc++']
elif self.config.target_platform == Platform.DARWIN:
dependency_libs += ['-lstdc++']
elif self.config.target_platform == Platform.ANDROID:
dependency_libs += ['gnustl', '-lm']
elif self.config.target_platform in [Platform.WINDOWS, Platform.LINUX]:
dependency_libs += ['-lstdc++', '-lm']
else:
raise NotImplementedError
libtool_la = LibtoolLibrary('openh264', 0, None, None, self.config.libdir,
self.config.target_platform,
deps=dependency_libs)
libtool_la.save()
super().post_install()
|