The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

make2build - create a Build.PL derived from Makefile.PL

SYNOPSIS

 ./make2build.pl    # In the root directory of an 
                    # ExtUtils::MakeMaker based distribution
                    
 Usage: ./make2build.pl [switches]
  -h           help screen
  -i length    indentation length
  -n           native ordering of build args
  -v(v)        verbosity level
  -V           version 

DESCRIPTION

ExtUtils::MakeMaker has been a de-facto standard for the common distribution of Perl modules; Module::Build is expected to supersede ExtUtils::MakeMaker in some time.

The transition takes place slowly, as the converting process manually achieved is yet an uncommon practice. This Makefile.PL parser is intended to ease the transition process.

ARGUMENTS

Globals

$MAKEFILE_PL

The filename of the Makefile script. Defaults to Makefile.PL.

$BUILD_PL

The filename of the Build script. Defaults to Build.PL.

$MANIFEST

The filename of the MANIFEST file. Defaults to MANIFEST.

$USE_NATIVE_ORDER

Native sorting order. If set to 1, the native sorting order of the Makefile arguments will be tried to preserve; it's equal to using the commandline switch '-n'. Defaults to 0.

$VERBOSE

Verbose mode. If set to 1, overridden defaults and skipped arguments are printed while converting; if set to 2, output of $VERBOSE=1 and created Build script will be printed. Can be set via the commandline switches '-v' (mode 1) and '-vv' (mode 2). Defaults to 0.

$LEN_INDENT

Indentation (character width). Can be set via the commandline switch '-i'. Defaults to 3.

$DD_INDENT

Data::Dumper indendation mode. Mode 0 will be disregarded in favor of 2. Defaults to 2.

$DD_SORTKEYS

Data::Dumper sort keys. Defaults to 1.

Data section

argument conversion

ExtUtils::MakeMaker arguments followed by their Module::Build equivalents. Converted data structures preserve their native structure, i.e. HASH -> HASH, etc.

 NAME                  module_name
 DISTNAME              dist_name
 ABSTRACT              dist_abstract
 AUTHOR                dist_author
 VERSION               dist_version
 VERSION_FROM          dist_version_from
 PREREQ_PM             requires
 PM                    pm_files
 CCFLAGS               extra_compiler_flags
 SIGN                  sign
 LICENSE               license
 clean.FILES           @add_to_cleanup
default arguments

Module::Build default arguments may be specified as key/value pairs. Arguments attached to multidimensional structures are unsupported.

 recommends            HASH
 build_requires        HASH
 conflicts             HASH
 license               unknown
 create_makefile_pl    passthrough

Value may be either a string or of type SCALAR, ARRAY, HASH.

sorting order

Module::Build arguments are sorted as enlisted herein. Additional arguments, that don't occur herein, are lower prioritized and will be inserted in unsorted order after preceedingly sorted arguments.

 module_name
 dist_name
 dist_abstract
 dist_author
 dist_version
 dist_version_from
 requires
 recommends
 build_requires
 conflicts
 pm_files
 add_to_cleanup
 extra_compiler_flags
 sign
 license
 create_makefile_pl
begin code

Code that preceeds converted Module::Build arguments.

 use Module::Build;

 my $b = Module::Build->new
 $INDENT(
end code

Code that follows converted Module::Build arguments.

 $INDENT);

 $b->create_build_script;

INTERNALS

co-opting WriteMakefile()

In order to convert arguments, a typeglob from WriteMakefile() to an internal sub will be set; subsequently Makefile.PL will be executed and the arguments are then accessible to the internal sub.

Data::Dumper

Converted ExtUtils::MakeMaker arguments will be dumped by Data::Dumper's Dump() and are then furtherly processed.

SEE ALSO

ExtUtils::MakeMaker, Module::Build, http://www.makemaker.org/wiki/index.cgi?ModuleBuildConversionGuide

AUTHOR

Steven Schubiger <schubiger@cpan.org>