Allow dependencies to override the make target at compilation and install.

This allow UUID dependency to just override the target instead of
overwrite the all function.
This commit is contained in:
Matthieu Gautier 2017-01-09 11:35:30 +01:00
parent cf6d16e6b2
commit edecfb34f9
1 changed files with 12 additions and 14 deletions

View File

@ -285,6 +285,8 @@ class MakeMixin:
install_option = "" install_option = ""
configure_script = "./configure" configure_script = "./configure"
configure_env = None configure_env = None
make_target = ""
make_install_target = "install"
@command("configure") @command("configure")
def _configure(self, context): def _configure(self, context):
@ -311,13 +313,19 @@ class MakeMixin:
@command("compile") @command("compile")
def _compile(self, context): def _compile(self, context):
context.try_skip(self.source_path) context.try_skip(self.source_path)
command = "make -j4 " + self.make_option command = "make -j4 {make_target} {make_option}".format(
make_target = self.make_target,
make_option = self.make_option
)
self.buildEnv.run_command(command, self.source_path, context) self.buildEnv.run_command(command, self.source_path, context)
@command("install") @command("install")
def _install(self, context): def _install(self, context):
context.try_skip(self.source_path) context.try_skip(self.source_path)
command = "make install " + self.make_option command = "make {make_install_target} {make_option}".format(
make_install_target = self.make_install_target,
make_option = self.make_option
)
self.buildEnv.run_command(command, self.source_path, context) self.buildEnv.run_command(command, self.source_path, context)
def build(self): def build(self):
@ -425,18 +433,8 @@ class UUID(Dependency, ReleaseDownloadMixin, MakeMixin):
source_dir = extract_dir = 'e2fsprogs-1.42' source_dir = extract_dir = 'e2fsprogs-1.42'
configure_option = "--enable-libuuid" configure_option = "--enable-libuuid"
configure_env = {'_format_CFLAGS' : "{env.CFLAGS} -fPIC"} configure_env = {'_format_CFLAGS' : "{env.CFLAGS} -fPIC"}
make_target = 'libs'
@command("compile") make_install_target = 'install-libs'
def _compile(self, context):
context.try_skip(self.source_path)
command = "make -j4 libs " + self.make_option
self.buildEnv.run_command(command, self.source_path, context)
@command("install")
def _install(self, context):
context.try_skip(self.source_path)
command = "make install-libs " + self.make_option
self.buildEnv.run_command(command, self.source_path, context)
class Xapian(Dependency, ReleaseDownloadMixin, MakeMixin): class Xapian(Dependency, ReleaseDownloadMixin, MakeMixin):