summaryrefslogtreecommitdiff
path: root/recipes/binutils.recipe
blob: 186c0c184aa8937af65f772f21e2f624793bcccf (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class Recipe(recipe.Recipe):
    name = 'binutils'
    version = '2.22'
    licenses = [License.GPL]
    configure_options = '--with-sysroot=$CERBERO_PREFIX --disable-multilib'

    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:
            self.target = 'i686-w64-mingw32'
        else:
            self.target = 'x86_64-w64-mingw32'
        self.configure_options += ' --target=%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

    def post_install(self):
        import shutil
        # 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.move(f.replace(self.target + '-', ''), f)