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
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil
from cerbero.errors import FatalError
class Recipe(recipe.Recipe):
name = 'mingw'
version = '0.1'
licenses = [License.LGPL]
btype = BuildType.CUSTOM
stype = SourceType.CUSTOM
files_libs = ['libgcc_s_sjlj']
files_satic = []
files_headers = ['include/GL']
def prepare(self):
self.mingw_static_files = ['%(host)s/lib/libmingwex.a',
'%(host)s/lib/libdxerr9.a',
'%(host)s/lib/libmoldname.a']
if self.config.platform == Platform.WINDOWS:
self.mingw_static_files += ['%(mingw)s/lib/gcc/%(host)s/4.7.2/libgcc.a']
# static build deps
if self.config.platform == Platform.WINDOWS:
# the native compiler install libraries in 'lib' and
# not in the cross prefix
mingw = '.'
else:
mingw = self.config.host
self.mingw_static_files = [f % {'mingw':mingw, 'host':self.config.host} for f in self.mingw_static_files]
self.files_static = [os.path.join('lib', os.path.basename(f)) for f in self.mingw_static_files]
def install(self):
if self.config.target_platform != Platform.WINDOWS:
raise FatalError("%s can only be installed on Windows" % self.name)
if self.config.platform == Platform.WINDOWS:
libmingw = 'lib'
else:
libmingw = os.path.join(self.config.host, 'lib')
# copy some dll's required at runtime
for f in ['libgcc_s_sjlj-1']:
shutil.copy(
os.path.join(self.config.toolchain_prefix, libmingw, f + '.dll'),
os.path.join(self.config.prefix, 'bin', f + '.dll'))
for f in self.files_headers:
src = os.path.join(self.config.toolchain_prefix, self.config.host, f)
dest = os.path.join(self.config.prefix, f)
if os.path.exists(dest):
shutil.rmtree(dest)
shutil.copytree(src, dest)
for f in self.mingw_static_files:
out_file = os.path.join('lib', os.path.basename(f))
self.files_static.append(out_file)
shutil.copy(os.path.join(self.config.toolchain_prefix, f),
os.path.join(self.config.prefix, out_file))
|