summaryrefslogtreecommitdiff
path: root/recipes/toolchain/gcc-core.recipe
blob: 60e345f22de38d8e4e5e7f6ddc953522cc060b35 (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
from cerbero.utils import shell


class Recipe(recipe.Recipe):
    name = 'gcc-core'
    version = '4.7.3'
    licenses = [License.GPLv3]
    configure_options = '--disable-multilib --enable-fully-dynamic-string ' \
                        '--with-sysroot=$CERBERO_PREFIX ' \
                        '--enable-threads=posix ' \
                        '--enable-languages=c,c++ ' \
                        '--enable-sjlj-exceptions ' \
                        '--without-dwarf2 '
    make = 'make all-gcc'
    make_install = 'make install-gcc'
    use_system_libs = True
    supports_non_src_build = True
    add_host_build_target = False
    deps = ['mingw-w64-headers', 'gmp', 'mpfr', 'mpc']
    new_env = {'CPP': None}

    def prepare(self):
        self.remotes = {'origin': '%s/%s' %
                        (self.config.git_root, 'gcc')}
        self.repo_dir = os.path.join(self.config.local_sources, 'gcc')
        self.build_dir = os.path.join(self.config.sources, 'gcc-%s' %
                                      self.version)
        self.make_dir = os.path.abspath(os.path.join(self.build_dir,
                                                     self.srcdir))

        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
        if self.config.target_platform == Platform.WINDOWS:
            self.configure_options += ' --host=%s' % self._target
        self.configure_options += ' --oldincludedir=%s/%s/include ' % \
                (self.config.prefix, self._target)
        if self.config.target_platform == Platform.WINDOWS:
            self.allow_parallel_build = False

    def configure(self):
        # Create the winsup directory
        if self.config.target_platform == Platform.WINDOWS:
            winsup = os.path.join(self.build_dir, 'gcc', 'winsup', 'mingw')
            if not os.path.exists(winsup):
                os.makedirs(winsup)
            shell.call('ln -s %s/%s/include include' %
                    (self.config.toolchain_prefix, self.config.host), winsup,
                    fail=False)
        super(Recipe, self).configure()