summaryrefslogtreecommitdiff
path: root/recipes/build-tools/cmake.recipe
blob: 60202ed2e7514e9ebd1f165785b9ab6670593b43 (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'cmake'
    version = '3.7.1'
    licenses = [License.BSD_like]
    btype = BuildType.MAKEFILE
    stype = SourceType.TARBALL
    url = 'https://www.cmake.org/files/v3.7/cmake-%(version)s.tar.gz'
    tarball_checksum = '449a5bce64dbd4d5b9517ebd1a1248ed197add6ad27934478976fd5f1f9330e1'
    deps = ['autoconf']

    add_host_build_target = False
    config_sh = './bootstrap'
    configure_tpl = "%(config-sh)s --prefix=%(prefix)s"
    can_use_configure_cache = False

    files_bins = ['cmake', 'ccmake']

    def prepare(self):
        if self.config.target_platform == Platform.WINDOWS:
            if self.config.target_arch == Architecture.X86_64:
                # Setting SYSTEM_NAME sets CMAKE_CROSSCOMPILING and the
                # binutils such as ar and ranlib are prefixed correctly
                self.configure_tpl += ' -- -DCMAKE_SYSTEM_NAME="Windows"'

    def configure(self):
        if self.config.target_platform == Platform.WINDOWS:
            if self.config.target_arch == Architecture.X86_64:
                # Bootstrap needs to be run twice for some dark reason
                try:
                    super(recipe.Recipe, self).configure()
                except:
                    pass
        super(recipe.Recipe, self).configure()
        # Windows XP does not have _mkgmtime64
        shell.replace(os.path.join(self.build_dir, 'CMakeCache.txt'),
            {'HAVE__MKGMTIME64:INTERNAL=1':'HAVE__MKGMTIME64:INTERNAL='})