Alien-Base-ModuleBuild

 view release on metacpan or  search on metacpan

lib/Alien/Base/ModuleBuild/API.pod  view on Meta::CPAN

=item alien_arch

[version 0.019]

Install module into an architecture specific directory.  This is off by default, unless $ENV{ALIEN_ARCH} is true.  Most Alien distributions will be installing binary code.  If you are an integrator where the C<@INC> path is shared by multiple Perls i...

=item alien_autoconf_with_pic

[version 0.005]

Add C<--with-pic> option to autoconf style C<configure> script when called.  This is the default, and normally a good practice.  Normally autoconf will ignore this and any other options that it does not recognize, but some non-autoconf C<configure> s...

=item alien_bin_requires

[version 0.006]

Hash reference of modules (keys) and versions (values) that specifies C<Alien> modules that provide binary tools that are required to build.  Any L<Alien::Base> module that includes binaries should work.  Also supported are L<Alien::MSYS>, L<Alien::C...

[version 0.007]

These only become required for building if L<Alien::Base::ModuleBuild> determines that a source code build is required.

lib/Alien/Base/ModuleBuild/API.pod  view on Meta::CPAN

=item Some other script

Invoke the interpreter directly.  For example, if you have a Python script use C<python foo.py>, if you have a Perl script use "%X foo.pl", if you have an sh script use "sh foo.sh".  These are all portable.
For sh, be sure to set the C<alien_msys> property so that it will work on Windows.

=back

=item %s

The full path to the installed location of the the share directory (builder method C<alien_library_destination>).
This is where the library should install itself; for autoconf style installs this will look like

 --prefix=%s

This will be the local blib directory location if C<alien_stage_install> is true (which is the default as of 0.17.
This will be the final install location if C<alien_stage_install> is false (which was the default prior to 0.17).
Please see the documentation above on C<alien_stage_install> which includes some caveats before you consider changing
this option.

=item %v

Captured version of the original archive.

=item %x

The current Perl interpreter (aka $^X)

=item %X

[version 0.027]

The current Perl interpreter using the Unix style path separator C</>
instead of the native Windows C<\>.

=item %%

A literal C<%>.

=back

=head1 SEE ALSO

lib/Alien/Base/ModuleBuild/FAQ.pod  view on Meta::CPAN

please see L<Alien::Base::ModuleBuild::API>.  Although the
Alien-Base / Alien-Build team will continue to maintain this module,
(we will continue to fix bugs where appropriate), we aren't adding any
new features to this module.

This document serves to answer the most frequently asked questions made by L<Alien::Base> authors.

=head2 What is Alien and Alien::Base?

Alien is a Perl namespace for defining dependencies in CPAN for libraries and tools which are not "native"
to CPAN.  For a manifesto style description of the Why, and How see L<Alien>.  L<Alien::Base> is a base
class and framework for creating Alien distributions.  The idea is to address as many of the common challenges
to developing Alien modules in the base class to simplify the process.

=head2 How do I specify a minimum or exact version requirement for packages that use pkg-config?

The C<alien_version_check> attribute to L<Alien::Base::ModuleBuild> will be executed to determine if
the library is provided by the operating system.  The default for this is C<%{pkg_config} --modversion %n>
which simply checks to see if any version of that package is available, and prints the version
number.  You can use the C<--atleast-version>, C<--exact-version> options to require a specific range of versions,
but these flags do not work with the C<--modversion> flag, so be sure to invoke separately.

lib/Alien/Base/ModuleBuild/FAQ.pod  view on Meta::CPAN

     "%x -I../../inc -MMy::AlienPatch -e alien_patch",
     ...
   ],
   ...
 )->create_build_script;

=head2 How do I build a package that uses I<build system>?

=head3 autoconf

By default L<Alien::Base::ModuleBuild> assumes a package with an autoconf style C<configure> script.  The
default is

 # Build.PL
 use Alien::Base::ModuleBuild;
 Alien::Base::ModuleBuild->new(
   ...
   alien_build_commands => [
     '%c --prefix=%s',
     'make',
   ],

lib/Alien/Base/ModuleBuild/FAQ.pod  view on Meta::CPAN

also tells L<Alien::Base::ModuleBuild> to use L<Alien::MSYS> on Windows platforms and to add that as a
dependency.  The C<%s> is a placeholder for the location to which the package will be installed.  This is
normally in a share directory specific to your distribution.

=head3 autoconf-like

If you see an error like this:

 Unknown option "--with-pic".

It may be because your package provides a C<configure> script that provides an autoconf-style interface, but is
not actually autoconf.  L<Alien::Base::ModuleBuild> is aggressive in using the C<--with-pic> option because when
supported by autoconf it produces position independent code (important for reliably building XS extensions), and
when not supported autoconf simply ignores the option. Unfortunately some autoconf-style C<configure> scripts
consider it an error when they see options that they do not recognize.  You can tell L<Alien::Base::ModuleBuild>
to not use the C<--with-pic> option via the C<alien_autoconf_with_pic> property:

 # Build.PL
 use Alien::Base::ModuleBuild;
 Alien::Base::ModuleBuild->new(
   ...
   alien_autoconf_with_pic => 0,
   ...
 )->create_build_script;

lib/Alien/Base/ModuleBuild/FAQ.pod  view on Meta::CPAN

 system 'mytool';

=head2 How do I use C<Alien::Base> from C<Dist::Zilla>

For creating L<Alien::Base> based dists from L<Dist::Zilla> you can use the plugin
L<Dist::Zilla::Plugin::Alien>.

=head2 How do I check the built version if my library doesn't provide a C<.pc> file.

The default implementation of C<alien_check_built_version> uses several heuristics,
but leans heavily on C<pkg-config> style C<.pc> files, so if your library or tool
does not provide a C<.pc>, the version may not be detected and your build may fail.

A lot of libraries are bundled as tarballs with the version in the directory name
that they are extracted into, and the current directory when C<alien_check_built_version>
is called is the build root, so you can use C<File::chdir> as an easy way to determine
the version number:

 package My::ModuleBuild;
 
 use strict;



( run in 1.617 second using v1.01-cache-2.11-cpan-49f99fa48dc )