summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-07-09 22:24:21 +0100
committerTiago Gomes <tiago.gomes@codethink.co.uk>2015-09-07 14:42:02 +0000
commitf6613fe1ee6d879192fd4e503cb632b0dcab1fe7 (patch)
tree2baba17136a43584ed5154b80fcd67c059946411
parentb150ef7dbb9d079d94434db51fef070820a98bcb (diff)
downloadmorph-f6613fe1ee6d879192fd4e503cb632b0dcab1fe7.tar.gz
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
-rw-r--r--morphlib/buildsystem.py43
1 files changed, 42 insertions, 1 deletions
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 <destdir>/<prefix> 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(),