From f6613fe1ee6d879192fd4e503cb632b0dcab1fe7 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Thu, 9 Jul 2015 22:24:21 +0100 Subject: Add support for Module::Build build system ExtUtils::MakeMaker is preferred, Module::Build was meant to replace it but essentially wasn't good enough, some projects still use Module::Build though. Change-Id: I124ee7b33f32167302e9bcb5299f6422f4fc346e --- morphlib/buildsystem.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/morphlib/buildsystem.py b/morphlib/buildsystem.py index 141b4a55..4655f2ee 100644 --- a/morphlib/buildsystem.py +++ b/morphlib/buildsystem.py @@ -192,7 +192,7 @@ class PythonDistutilsBuildSystem(BuildSystem): class ExtUtilsMakeMakerBuildSystem(BuildSystem): - '''The Perl cpan build system. + '''The ExtUtils::MakeMaker build system. To install perl distributions into the correct location in our chroot we need to set PREFIX to / in the configure-commands. @@ -205,6 +205,8 @@ class ExtUtilsMakeMakerBuildSystem(BuildSystem): ''' + # This is called the 'cpan' build system for historical reasons, + # back when morph only supported one of the perl build systems. name = 'cpan' def __init__(self): @@ -233,6 +235,44 @@ class ExtUtilsMakeMakerBuildSystem(BuildSystem): return any(x in file_list for x in indicators) + +class ModuleBuildBuildSystem(BuildSystem): + + '''The Module::Build build system''' + + name = 'module-build' + + def __init__(self): + super(ModuleBuildBuildSystem, self).__init__() + + self.configure_commands = [ + # See the comment in ExtUtilsMakeMakerBuildSystem + # to see why --prefix is set to $DESTDIR$PREFIX here, + # (--prefix in Module::Build has the same meaning + # as PREFIX in ExtUtils::MakeMaker) + 'perl Build.PL --prefix "$DESTDIR$PREFIX"' + ] + + self.build_commands = [ + './Build' + ] + + self.test_commands = [ + './Build test' + ] + + self.install_commands = [ + './Build install' + ] + + def used_by_project(self, file_list): + indicators = [ + 'Build.PL' + ] + + return any(x in file_list for x in indicators) + + class CMakeBuildSystem(BuildSystem): '''The cmake build system.''' @@ -296,6 +336,7 @@ build_systems = [ AutotoolsBuildSystem(), PythonDistutilsBuildSystem(), ExtUtilsMakeMakerBuildSystem(), + ModuleBuildBuildSystem(), CMakeBuildSystem(), QMakeBuildSystem(), DummyBuildSystem(), -- cgit v1.2.1