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
|
import shutil
class Recipe(recipe.Recipe):
name = 'binutils'
version = '2.31.1'
licenses = [License.LGPLv2Plus]
licenses_bins = [License.GPLv2Plus]
url = 'https://ftpmirror.gnu.org/gnu/binutils/binutils-%(version)s.tar.bz2'
tarball_checksum = 'ffcc382695bf947da6135e7436b8ed52d991cf270db897190f19d6f9838564d0'
stype = SourceType.TARBALL
autoreconf = True
configure_options = '--enable-ld=yes ' \
'--enable-gold=no ' \
'--disable-sim ' \
'--disable-gdb ' \
'--disable-nls ' \
'--enable-multilib '
add_host_build_target = False
files_bins = ['addr2line', 'ar', 'as', 'c++filt', 'dlltool', 'dllwrap',
'elfedit', 'gprof', 'ld', 'ld.bfd', 'nm', 'objcopy',
'objdump', 'ranlib', 'readelf', 'size', 'strings', 'strip',
'windmc', 'windres']
files_binutils = ['%(host)s/bin/ar%(bext)s',
'%(host)s/bin/as%(bext)s',
'%(host)s/bin/dlltool%(bext)s',
'%(host)s/bin/ld%(bext)s',
'%(host)s/bin/ld.bfd%(bext)s',
'%(host)s/bin/nm%(bext)s',
'%(host)s/bin/objcopy%(bext)s',
'%(host)s/bin/objdump%(bext)s',
'%(host)s/bin/ranlib%(bext)s',
'%(host)s/bin/strip%(bext)s',
'%(host)s/lib/ldscripts/i386pe.x',
'%(host)s/lib/ldscripts/i386pe.xa',
'%(host)s/lib/ldscripts/i386pe.xbn',
'%(host)s/lib/ldscripts/i386pe.xn',
'%(host)s/lib/ldscripts/i386pe.xr',
'%(host)s/lib/ldscripts/i386pe.xu',
'%(host)s/lib32/ldscripts/i386pe.x',
'%(host)s/lib32/ldscripts/i386pe.xa',
'%(host)s/lib32/ldscripts/i386pe.xbn',
'%(host)s/lib32/ldscripts/i386pe.xn',
'%(host)s/lib32/ldscripts/i386pe.xr',
'%(host)s/lib32/ldscripts/i386pe.xu']
files_lib = ['lib/libiberty.a']
files_lang = ['bfd', 'binutils', 'gas', 'gprof',
'ld', 'opcodes']
def prepare(self):
if self.config.target_arch == Architecture.X86:
raise InvalidRecipeError(self)
self.target = 'x86_64-w64-mingw32'
self.configure_options += ' --target=%s ' % self.target
self.configure_options += '--with-sysroot=$CERBERO_PREFIX/%s/sysroot ' % self.target
if self.config.target_platform == Platform.WINDOWS:
self.configure_options += ' --host=%s' % self.target
# Append the host prefix to the binaries
self.files_bins = ['%s-%s' % (self.target, x) for x in self.files_bins]
# Replace host in files
files = [x % {'host': self.target, 'bext': '%(bext)s'} for x in
self.files_binutils]
# Add mingw symlink files
files.extend([x % {'host': 'mingw', 'bext': '%(bext)s'} for x in
self.files_binutils])
self.files_binutils = files
async def configure(self):
for d in ['bfd', 'opcodes', 'gas', 'binutils', 'gprof', 'ld']:
shell.new_call(['autoreconf', '-ivf'], os.path.join(self.build_dir, d))
await super().configure()
def post_install(self):
# Prefix binaries with the host triplet
if self.config.target_platform == Platform.WINDOWS:
for f in self.files_list_by_category('bins'):
f = os.path.join(self.config.prefix, f)
shutil.copy(f.replace(self.target + '-', ''), f)
# libtool m4 macros uses non-prefixed 'strings' command.
elif self.config.target_platform == Platform.LINUX:
bindir = os.path.join(self.config.prefix, 'bin')
strings = os.path.join(bindir, 'strings')
if os.path.exists(strings):
os.remove(strings)
shell.symlink('%s-strings' % self.target, 'strings', bindir)
super().post_install()
|