summaryrefslogtreecommitdiff
path: root/python/build/makeproject.py
blob: fe676bfa4201fb5a9b3beeb24fdeb9708684c9f9 (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
import subprocess

from build.project import Project

class MakeProject(Project):
    def __init__(self, url, md5, installed,
                 install_target='install',
                 **kwargs):
        Project.__init__(self, url, md5, installed, **kwargs)
        self.install_target = install_target

    def get_simultaneous_jobs(self):
        return 12

    def get_make_args(self, toolchain):
        return ['--quiet', '-j' + str(self.get_simultaneous_jobs())]

    def get_make_install_args(self, toolchain):
        return ['--quiet', self.install_target]

    def make(self, toolchain, wd, args):
        subprocess.check_call(['/usr/bin/make'] + args,
                              cwd=wd, env=toolchain.env)

    def build(self, toolchain, wd, install=True):
        self.make(toolchain, wd, self.get_make_args(toolchain))
        if install:
            self.make(toolchain, wd, self.get_make_install_args(toolchain))