view release on metacpan or search on metacpan
This method returns a string of ROOT features that were enabled when
ROOT was compiled.
Example code:
my $features = $aroot->features;
if ($features !~ /\bexplicitlink\b/) {
warn "ROOT was built without the --explicitlink option";
}
$aroot->bindir
This method returns the path to the executable directory of ROOT.
Example code:
my $dir = $aroot->bindir;
system(File::Spec->catfile($dir, 'root'));
$aroot->libdir
This method returns the path to the library (lib/) directory of ROOT.
Example code:
my $dir = $aroot->libdir;
$aroot->incdir
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
sub is_vmsish { return Perl::OSType::is_os_type('VMS') }
sub is_windowsish { return Perl::OSType::is_os_type('Windows') }
sub is_unixish { return Perl::OSType::is_os_type('Unix') }
1;
__END__
=for :stopwords
bindoc binhtml destdir distcheck distclean distdir distmeta distsign disttest
fakeinstall html installdirs installsitebin installsitescript installvendorbin
installvendorscript libdoc libhtml pardist ppd ppmdist realclean skipcheck
testall testcover testdb testpod testpodcoverage versioninstall
=head1 NAME
Module::Build - Build and install Perl modules
=head1 SYNOPSIS
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
Use PERL_MB_OPT or F<.modulebuildrc> to set options that should be applied
during subprocesses
=item docs
[version 0.20]
This will generate documentation (e.g. Unix man pages and HTML
documents) for any installable items under B<blib/> that
contain POD. If there are no C<bindoc> or C<libdoc> installation
targets defined (as will be the case on systems that don't support
Unix manpages) no action is taken for manpages. If there are no
C<binhtml> or C<libhtml> installation targets defined no action is
taken for HTML documents.
=item fakeinstall
[version 0.02]
This is just like the C<install> action, but it won't actually do
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
if one does not already exist.
=item manpages
[version 0.28]
This will generate man pages for any binary or library files under
B<blib/> that contain POD. The man pages will only be installed if the
install paths can be determined from values in C<Config.pm>. You can
also supply or override install paths by specifying there values on
the command line with the C<bindoc> and C<libdoc> installation
targets.
=item pardist
[version 0.2806]
Generates a PAR binary distribution for use with L<PAR> or L<PAR::Dist>.
It requires that the PAR::Dist module (version 0.17 and up) is
installed on your system.
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
Programs written in pure Perl. In order to improve reuse, try to make
these as small as possible - put the code into modules whenever
possible.
=item bin
"Architecture-dependent" executable programs, i.e. compiled C code or
something. Pretty rare to see this in a perl distribution, but it
happens.
=item bindoc
Documentation for the stuff in C<script> and C<bin>. Usually
generated from the POD in those files. Under Unix, these are manual
pages belonging to the 'man1' category.
=item libdoc
Documentation for the stuff in C<lib> and C<arch>. This is usually
generated from the POD in F<.pm> files. Under Unix, these are manual
pages belonging to the 'man3' category.
=item binhtml
This is the same as C<bindoc> above, but applies to HTML documents.
=item libhtml
This is the same as C<libdoc> above, but applies to HTML documents.
=back
Four other parameters let you control various aspects of how
installation paths are determined:
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
'installdirs' set to:
core site vendor
uses the following defaults from Config.pm:
lib => installprivlib installsitelib installvendorlib
arch => installarchlib installsitearch installvendorarch
script => installscript installsitescript installvendorscript
bin => installbin installsitebin installvendorbin
bindoc => installman1dir installsiteman1dir installvendorman1dir
libdoc => installman3dir installsiteman3dir installvendorman3dir
binhtml => installhtml1dir installsitehtml1dir installvendorhtml1dir [*]
libhtml => installhtml3dir installsitehtml3dir installvendorhtml3dir [*]
* Under some OS (eg. MSWin32) the destination for HTML documents is
determined by the C<Config.pm> entry C<installhtmldir>.
The default value of C<installdirs> is "site". If you're creating
vendor distributions of module packages, you may want to do something
like this:
inc/inc_Module-Build/Module/Build.pm view on Meta::CPAN
You can also set the whole bunch of installation paths by supplying the
C<install_base> parameter to point to a directory on your system. For
instance, if you set C<install_base> to "/home/ken" on a Linux
system, you'll install as follows:
lib => /home/ken/lib/perl5
arch => /home/ken/lib/perl5/i386-linux
script => /home/ken/bin
bin => /home/ken/bin
bindoc => /home/ken/man/man1
libdoc => /home/ken/man/man3
binhtml => /home/ken/html
libhtml => /home/ken/html
Note that this is I<different> from how C<MakeMaker>'s C<PREFIX>
parameter works. C<install_base> just gives you a default layout under the
directory you specify, which may have little to do with the
C<installdirs=site> layout.
The exact layout under the directory you specify may vary by system -
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
Assigning the value C<undef> to an element causes it to be removed.
=item install_types()
[version 0.28]
Returns a list of installable types that this build knows about.
These types each correspond to the name of a directory in F<blib/>,
and the list usually includes items such as C<lib>, C<arch>, C<bin>,
C<script>, C<libdoc>, C<bindoc>, and if HTML documentation is to be
built, C<libhtml> and C<binhtml>. Other user-defined types may also
exist.
=item invoked_action()
[version 0.28]
This is the name of the original action invoked by the user. This
value is set when the user invokes F<Build.PL>, the F<Build> script,
or programmatically through the L<dispatch()|/"dispatch($action, %args)">
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
=item PL_files()
=item allow_mb_mismatch()
=item auto_configure_requires()
=item autosplit()
=item base_dir()
=item bindoc_dirs()
=item blib()
=item build_bat()
=item build_class()
=item build_elements()
=item build_requires()
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
# The following warning could be unnecessary if the user is running
# an embedded perl, but there aren't too many of those around, and
# embedded perls aren't usually used to install modules, and the
# installation process sometimes needs to run external scripts
# (e.g. to run tests).
$p->{perl} = $self->find_perl_interpreter
or $self->log_warn("Warning: Can't locate your perl binary");
my $blibdir = sub { File::Spec->catdir($p->{blib}, @_) };
$p->{bindoc_dirs} ||= [ $blibdir->("script") ];
$p->{libdoc_dirs} ||= [ $blibdir->("lib"), $blibdir->("arch") ];
$p->{dist_author} = [ $p->{dist_author} ] if defined $p->{dist_author} and not ref $p->{dist_author};
# Synonyms
$p->{requires} = delete $p->{prereq} if defined $p->{prereq};
$p->{script_files} = delete $p->{scripts} if defined $p->{scripts};
# Convert to from shell strings to arrays
for ('extra_compiler_flags', 'extra_linker_flags') {
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
sub _default_install_paths {
my $self = shift;
my $c = $self->{config};
my $p = {};
my @libstyle = $c->get('installstyle') ?
File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
my $arch = $c->get('archname');
my $version = $c->get('version');
my $bindoc = $c->get('installman1dir') || undef;
my $libdoc = $c->get('installman3dir') || undef;
my $binhtml = $c->get('installhtml1dir') || $c->get('installhtmldir') || undef;
my $libhtml = $c->get('installhtml3dir') || $c->get('installhtmldir') || undef;
$p->{install_sets} =
{
core => {
lib => $c->get('installprivlib'),
arch => $c->get('installarchlib'),
bin => $c->get('installbin'),
script => $c->get('installscript'),
bindoc => $bindoc,
libdoc => $libdoc,
binhtml => $binhtml,
libhtml => $libhtml,
},
site => {
lib => $c->get('installsitelib'),
arch => $c->get('installsitearch'),
bin => $c->get('installsitebin') || $c->get('installbin'),
script => $c->get('installsitescript') ||
$c->get('installsitebin') || $c->get('installscript'),
bindoc => $c->get('installsiteman1dir') || $bindoc,
libdoc => $c->get('installsiteman3dir') || $libdoc,
binhtml => $c->get('installsitehtml1dir') || $binhtml,
libhtml => $c->get('installsitehtml3dir') || $libhtml,
},
vendor => {
lib => $c->get('installvendorlib'),
arch => $c->get('installvendorarch'),
bin => $c->get('installvendorbin') || $c->get('installbin'),
script => $c->get('installvendorscript') ||
$c->get('installvendorbin') || $c->get('installscript'),
bindoc => $c->get('installvendorman1dir') || $bindoc,
libdoc => $c->get('installvendorman3dir') || $libdoc,
binhtml => $c->get('installvendorhtml1dir') || $binhtml,
libhtml => $c->get('installvendorhtml3dir') || $libhtml,
},
};
$p->{original_prefix} =
{
core => $c->get('installprefixexp') || $c->get('installprefix') ||
$c->get('prefixexp') || $c->get('prefix') || '',
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
# Note: you might be tempted to use $Config{installstyle} here
# instead of hard-coding lib/perl5, but that's been considered and
# (at least for now) rejected. `perldoc Config` has some wisdom
# about it.
$p->{install_base_relpaths} =
{
lib => ['lib', 'perl5'],
arch => ['lib', 'perl5', $arch],
bin => ['bin'],
script => ['bin'],
bindoc => ['man', 'man1'],
libdoc => ['man', 'man3'],
binhtml => ['html'],
libhtml => ['html'],
};
$p->{prefix_relpaths} =
{
core => {
lib => [@libstyle],
arch => [@libstyle, $version, $arch],
bin => ['bin'],
script => ['bin'],
bindoc => ['man', 'man1'],
libdoc => ['man', 'man3'],
binhtml => ['html'],
libhtml => ['html'],
},
vendor => {
lib => [@libstyle],
arch => [@libstyle, $version, $arch],
bin => ['bin'],
script => ['bin'],
bindoc => ['man', 'man1'],
libdoc => ['man', 'man3'],
binhtml => ['html'],
libhtml => ['html'],
},
site => {
lib => [@libstyle, 'site_perl'],
arch => [@libstyle, 'site_perl', $version, $arch],
bin => ['bin'],
script => ['bin'],
bindoc => ['man', 'man1'],
libdoc => ['man', 'man3'],
binhtml => ['html'],
libhtml => ['html'],
},
};
return $p
}
sub _find_nested_builds {
my $self = shift;
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
meta_merge
original_prefix
prefix_relpaths
configure_requires
);
__PACKAGE__->add_property($_) for qw(
PL_files
autosplit
base_dir
bindoc_dirs
c_source
create_license
create_makefile_pl
create_readme
debugger
destdir
dist_abstract
dist_author
dist_name
dist_suffix
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
sub ACTION_testpod {
my $self = shift;
$self->depends_on('docs');
eval q{use Test::Pod 0.95; 1}
or die "The 'testpod' action requires Test::Pod version 0.95";
my @files = sort keys %{$self->_find_pods($self->libdoc_dirs)},
keys %{$self->_find_pods
($self->bindoc_dirs,
exclude => [ $self->file_qr('\.bat$') ])}
or die "Couldn't find any POD files to test\n";
{ package # hide from PAUSE
Module::Build::PodTester; # Don't want to pollute the main namespace
Test::Pod->import( tests => scalar @files );
pod_file_ok($_) foreach @files;
}
}
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
next unless %$files;
my $sub = $self->can("manify_${type}_pods");
$self->$sub() if defined( $sub );
}
}
sub manify_bin_pods {
my $self = shift;
my $files = $self->_find_pods( $self->{properties}{bindoc_dirs},
exclude => [ $self->file_qr('\.bat$') ] );
return unless keys %$files;
my $mandir = File::Spec->catdir( $self->blib, 'bindoc' );
File::Path::mkpath( $mandir, 0, oct(777) );
require Pod::Man;
foreach my $file (keys %$files) {
# Pod::Simple based parsers only support one document per instance.
# This is expected to change in a future version (Pod::Simple > 3.03).
my $parser = Pod::Man->new( section => 1 ); # binaries go in section 1
my $manpage = $self->man1page_name( $file ) . '.' .
$self->config( 'man1ext' );
my $outfile = File::Spec->catfile($mandir, $manpage);
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
return unless @install;
my ($command, @opts) = $self->split_like_shell($self->cpan_client);
# relative command should be relative to our active Perl
# so we need to locate that command
if ( ! File::Spec->file_name_is_absolute( $command ) ) {
# prefer site to vendor to core
my @loc = ( 'site', 'vendor', '' );
my @bindirs = File::Basename::dirname($self->perl);
push @bindirs,
map {
($self->config->{"install${_}bin"}, $self->config->{"install${_}script"})
} @loc;
for my $d ( @bindirs ) {
my $abs_cmd = $self->find_command(File::Spec->catfile( $d, $command ));
if ( defined $abs_cmd ) {
$command = $abs_cmd;
last;
}
}
}
if ( ! -x $command ) {
die "cpan_client '$command' is not executable\n";
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
my $ppm = $self->ppm_name;
$self->delete_filetree( $ppm );
$self->log_info( "Creating $ppm\n" );
$self->add_to_cleanup( $ppm, "$ppm.tar.gz" );
my %types = ( # translate types/dirs to those expected by ppm
lib => 'lib',
arch => 'arch',
bin => 'bin',
script => 'script',
bindoc => 'man1',
libdoc => 'man3',
binhtml => undef,
libhtml => undef,
);
foreach my $type ($self->install_types) {
next if exists( $types{$type} ) && !defined( $types{$type} );
my $dir = File::Spec->catdir( $self->blib, $type );
next unless -e $dir;
inc/inc_Module-Build/Module/Build/Base.pm view on Meta::CPAN
sub install_map {
my ($self, $blib) = @_;
$blib ||= $self->blib;
my( %map, @skipping );
foreach my $type ($self->install_types) {
my $localdir = File::Spec->catdir( $blib, $type );
next unless -e $localdir;
# the line "...next if (($type eq 'bindoc'..." was one of many changes introduced for
# improving HTML generation on ActivePerl, see https://rt.cpan.org/Public/Bug/Display.html?id=53478
# Most changes were ok, but this particular line caused test failures in t/manifypods.t on windows,
# therefore it is commented out.
# ********* next if (($type eq 'bindoc' || $type eq 'libdoc') && not $self->is_unixish);
if (my $dest = $self->install_destination($type)) {
$map{$localdir} = $dest;
} else {
push( @skipping, $type );
}
}
$self->log_warn(
"WARNING: Can't figure out install path for types: @skipping\n" .
inc/inc_Module-Build/Module/Build/Cookbook.pm view on Meta::CPAN
Please note that these examples use some capabilities of Module::Build
that first appeared in version 0.26. Before that it could
still be done, but the simple cases took a bit more work.
=head2 Adding new elements to the install process
By default, Module::Build creates seven subdirectories of the F<blib>
directory during the build process: F<lib>, F<arch>, F<bin>,
F<script>, F<bindoc>, F<libdoc>, and F<html> (some of these may be
missing or empty if there's nothing to go in them). Anything copied
to these directories during the build will eventually be installed
during the C<install> action (see L<Module::Build/"INSTALL PATHS">.
If you need to create a new custom type of installable element, e.g. C<conf>,
then you need to tell Module::Build where things in F<blib/conf/>
should be installed. To do this, use the C<install_path> parameter to
the C<new()> method:
my $build = Module::Build->new
lib/Alien/ROOT.pm view on Meta::CPAN
Carp::croak('You must call this as a class method') if ref($class);
my $self = {
installed => 0,
root_config => undef,
version => undef,
cflags => undef,
ldflags => undef,
features => undef,
libdir => undef,
bindir => undef,
incdir => undef,
etcdir => undef,
archdir => undef, # internal
private_root => undef,
};
bless($self, $class);
$self->_load_modules();
$self->_configure();
lib/Alien/ROOT.pm view on Meta::CPAN
or check C<$aroot-E<gt>installed> before using this.
=cut
sub setup_environment {
my $self = shift;
Carp::croak('You must call this method as an object') unless ref($self);
die "ROOT was not found. Make the 'root-config' utility accessible or set the ROOTSYS variable"
if not $self->installed;
my $bindir = $self->bindir;
my $libdir = $self->libdir;
if ($^O =~ /win32/i) {
$ENV{PATH} = $self->_add_to_path($ENV{PATH}, $bindir, $libdir);
}
else {
$ENV{PATH} = $self->_add_to_path($ENV{PATH}, $bindir);
}
$ENV{LD_LIBRARY_PATH} = $self->_add_to_path($ENV{LD_LIBRARY_PATH}, $libdir);
#require DynaLoader;
#unshift @DynaLoader::dl_library_path, $libdir; # doesn't help
}
sub _add_to_path {
my $self = shift;
my $string = shift;
my @paths = @_;
lib/Alien/ROOT.pm view on Meta::CPAN
sub features {
my $self = shift;
Carp::croak('You must call this method as an object') unless ref($self);
return $self->_config_get_one_line_param('features', qw(--features));
}
=head2 $aroot->bindir
This method returns the path to the executable directory of ROOT.
Example code:
my $dir = $aroot->bindir;
system(File::Spec->catfile($dir, 'root'));
=cut
sub bindir {
my $self = shift;
Carp::croak('You must call this method as an object') unless ref($self);
return $self->_config_get_one_line_param('bindir', qw(--bindir));
}
=head2 $aroot->libdir
This method returns the path to the library (F<lib/>) directory of ROOT.
Example code:
my $dir = $aroot->libdir;