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
120
121
122
123
124
125
126
127
128
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.errors import FatalError
from cerbero.utils import shell
from cerbero.utils import messages as m
import shutil
class Recipe(recipe.Recipe):
name = 'libvpx'
version = 'v1.3.0'
licenses = [License.BSD]
stype = SourceType.TARBALL
btype = BuildType.MAKEFILE
url = 'http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2'
configure_tpl = "./configure --prefix=%(prefix)s "\
"--libdir=%(libdir)s %(options)s"
configure_options = "--enable-pic --as=yasm --disable-unit-tests "
add_host_build_target = False
supports_cache_variables = False
can_use_configure_cache = False
make = 'make HAVE_GNU_STRIP=no'
patches = ['libvpx/0001-darwin-add-support-for-newer-sdk-s.patch',
'libvpx/0002-Include-Android-cpu-features.c-instead-of-.h.patch',
'libvpx/0004-configure-add-support-for-iOS-6.patch',
'libvpx/0005-Add-support-for-iOS-7.0-toolchain.patch',
'libvpx/0006-Add-armv7s-ios-support.patch',
'libvpx/0007-configure-quote-local-variables-correctly.patch',
'libvpx/0008-Add-support-for-iOS-simulator-on-x86-64.patch',
]
files_libs = ['libvpx']
files_bins = ['vpxenc', 'vpxdec']
files_devel = ['include/vpx', 'lib/pkgconfig/vpx.pc']
# libvpx does not have check target
make_check = None
def prepare (self):
if self.config.target_arch == Architecture.X86_64:
arch = 'x86_64'
elif self.config.target_arch == Architecture.X86:
arch = 'x86'
elif self.config.target_arch == Architecture.PPC:
arch = 'ppc32'
elif self.config.target_arch == Architecture.ARM:
arch = 'arm'
elif self.config.target_arch == Architecture.ARMv7:
arch = 'armv7'
elif self.config.target_arch == Architecture.ARMv7S:
arch = 'armv7s'
self.new_env['LD'] = os.environ.get('CC', 'gcc')
if self.config.target_platform == Platform.DARWIN:
if self.config.target_distro_version in [DistroVersion.OS_X_MOUNTAIN_LION,
DistroVersion.OS_X_LION, DistroVersion.OS_X_MAVERICKS,
DistroVersion.OS_X_YOSEMITE] and arch != 'x86':
platform = 'darwin11'
else:
platform = 'darwin10'
if self.config.target_arch == Architecture.PPC:
platform = 'darwin9'
elif self.config.target_platform == Platform.IOS:
if self.config.target_distro_version in [DistroVersion.IOS_7_0, DistroVersion.IOS_7_1, DistroVersion.IOS_8_0, DistroVersion.IOS_8_1]:
platform = 'ios7'
else:
platform = 'ios6'
if self.config.target_arch == Architecture.ARM:
arch = 'armv6'
self.config_sh = './configure'
elif self.config.target_platform == Platform.WINDOWS:
self.config_sh = './configure'
if self.config.target_arch == Architecture.X86_64:
platform = 'win64'
else:
platform = 'win32'
# FIXME:
elif self.config.target_platform == Platform.ANDROID:
platform = 'android'
self.append_env['CFLAGS'] = " -Dandroid_getCpuFamily=vpx_android_getCpuFamily "\
"-Dandroid_getCpuFeatures=vpx_android_getCpuFeatures "\
"-Dandroid_getCpuCount=vpx_android_getCpuCount " \
"-Dandroid_cpuInit=vpx_android_cpuInit " \
"-Dandroid_cpuInitDummy=vpx_android_cpuInitDummy " \
"-Dandroid_getCpuIdArm=vpx_android_getCpuIdArm " \
"-Dandroid_setCpu=vpx_android_setCpu " \
"-Dandroid_setCpuArm=vpx_android_setCpuArm "
if self.config.target_arch == Architecture.ARM:
arch = 'armv5te'
# Fix compiler error with -mthumb
self.new_env['CFLAGS'] = os.environ['CFLAGS'].replace('-mthumb', '')
elif self.config.target_arch == Architecture.ARMv7:
pass
elif self.config.target_arch == Architecture.X86:
pass
else:
raise FatalError("Unsupported Android architecture %s" % self.config.target_arch)
self.config_sh = 'LD=$CC ./configure'
self.configure_options.replace('--as=yasm', '')
self.configure_options += ' --sdk-path=%s ' % self.config.toolchain_prefix
else:
self.configure_options += '--enable-shared '
platform = 'linux'
self.configure_options += '--target=%s-%s-gcc ' % (arch, platform)
def configure(self):
if self.config.target_platform == Platform.ANDROID:
cpufeatures_path = os.path.join(self.config.toolchain_prefix, 'sources', 'android', 'cpufeatures')
o = os.path.join(cpufeatures_path, 'cpu-features.h')
f = os.path.join(self.make_dir, 'vpx_ports')
m.action("copying %s to %s" % (o, f))
shutil.copy(o, f)
f = self.make_dir
m.action("copying %s to %s" % (o, f))
shutil.copy(o, f)
o = os.path.join(cpufeatures_path, 'cpu-features.c')
f = os.path.join(self.make_dir, 'vpx_ports')
m.action("copying %s to %s" % (o, f))
shutil.copy(o, f)
super(recipe.Recipe, self).configure()
def install(self):
if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
for f in ['vpxenc', 'vpxdec', 'libvpx.a']:
shell.touch(os.path.join(self.build_dir, f))
super(Recipe, self).install()
|