summaryrefslogtreecommitdiff
path: root/recipes/gcc-core.recipe
blob: 0b5b39146736827e96a3757c10e2a855ca1b5d65 (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
class Recipe(recipe.Recipe):
    name = 'gcc-core'
    version = '4.6.2'
    licenses = [License.GPLv3]
    configure_options = '--disable-multilib --enable-fully-dynamic-string'
    make = 'make all-gcc'
    make_install = 'make install-gcc'
    use_system_libs = True
    supports_non_src_build = True
    deps = ['mingw-w64-headers', 'gmp', 'mpfr', 'mpc']

    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:
            target = 'i686-w64-mingw32'
        else:
            target = 'x86_64-w64-mingw32'
        self.configure_options += ' --target=%s' % target
        if self.config.target_platform == Platform.WINDOWS:
            self.allow_parallel_build = False

    def configure(self):
        from cerbero.utils import shell
        # 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()