Alien-Build

 view release on metacpan or  search on metacpan

Changes.Alien-Base  view on Meta::CPAN

    "configure" script
  - The new default for build uses "%c" instead of "%pconfigure"
  - Added property alien_isolate_dynamic which allows an Alien author to
    avoid using dynamic libraries when building XS modules (plicease gh#51)
  - Added dynamic_libs which returns a list of dynamic libraries (.dll, .so or
    .dylib depending on platform) which can be used for FFI modules (see FFI::Platypus)
    (plicease gh#51)
  - Added support for LWP as an alternative to HTTP::Tiny (preaction++ gh#24)
  - Added support for content-disposition HTTP header to determine correct filename
    and determine format from that (rsimoes++ gh#27)
  - By default run autotools style configure scripts with --with-pic and add
    alien_autoconf_with_pic property to allow disabling that (plicease gh#47)

0.004  Mar 5, 2014
  - Added version token to the interpolator (MidLifeXis++)
  - Fixed broken test (MidLifeXis++)

0.003  Mar 3, 2013
	- Added 'blib scheme' detection logic
		- Improves Mac/CPANtesters compatibility
		- Controlled by ALIEN_BLIB env var

corpus/alien_build_plugin_fetch_wget/record/old.json  view on Meta::CPAN

{"-k --content-disposition -S http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar":{"stderr":"--2021-05-12 00:10:35--  http://localhost/corpus/alien_build_plugin_fetch_wget/dir/foo-1.01.tar\nResolving localhost (localhost)... ::1, ...

corpus/alien_build_plugin_fetch_wget/record/old.yml  view on Meta::CPAN

  stdout: |
    GNU Wget 1.20.1, a non-interactive network retriever.
    Usage: wget [OPTION]... [URL]...
    
    Mandatory arguments to long options are mandatory for short options too.
    
    Startup:
      -V,  --version                   display the version of Wget and exit
      -h,  --help                      print this help
      -b,  --background                go to background after startup
      -e,  --execute=COMMAND           execute a `.wgetrc'-style command
    
    Logging and input file:
      -o,  --output-file=FILE          log messages to FILE
      -a,  --append-output=FILE        append messages to FILE
      -d,  --debug                     print lots of debugging information
      -q,  --quiet                     quiet (no output)
      -v,  --verbose                   be verbose (this is the default)
      -nv, --no-verbose                turn off verboseness, without being quiet
           --report-speed=TYPE         output bandwidth as TYPE.  TYPE can be bits
      -i,  --input-file=FILE           download URLs found in local or external FILE

corpus/dir/http.html  view on Meta::CPAN

<html><head>
  <title>Index of /corpus/dist/</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type='text/css'>
table { width:100%%; }
.name { text-align:left; }
.size, .mtime { text-align:right; }
.type { width:11em; }
.mtime { width:15em; }
  </style>
</head><body>
<h1>Index of /corpus/dist/</h1>
<hr />
<table>
  <tr>
    <th class='name'>Name</th>
    <th class='size'>Size</th>
    <th class='type'>Type</th>
    <th class='mtime'>Last Modified</th>
  </tr>

corpus/dir/http_rel.html  view on Meta::CPAN

<html><head>
  <title>Index of /foo/bar/</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type='text/css'>
table { width:100%%; }
.name { text-align:left; }
.size, .mtime { text-align:right; }
.type { width:11em; }
.mtime { width:15em; }
  </style>
</head><body>
<h1>Index of /foo/bar/</h1>
<hr />
<table>
  <tr>
    <th class='name'>Name</th>
    <th class='size'>Size</th>
    <th class='type'>Type</th>
    <th class='mtime'>Last Modified</th>
  </tr>

lib/Alien/Build/Interpolate/Default.pm  view on Meta::CPAN

=head2 cp

 %{cp}

The copy command.

=head2 devnull

 %{devnull}

The null device, if available.  On Unix style operating systems this will be C</dev/null> on Windows it is C<NUL>.

=head2 flex

 %{flex}

Requires: L<Alien::flex> 0.08 if not already in C<PATH>.

=head2 gmake

 %{gmake}

lib/Alien/Build/Interpolate/Default.pm  view on Meta::CPAN

Requires: L<Alien::pkgconf> 0.06.

=head2 cwd

 %{cwd}

=head2 sh

 %{sh}

Unix style command interpreter (/bin/sh).

Deprecated: use the L<Alien::Build::Plugin::Build::MSYS> plugin instead.

=head2 rm

 %{rm}

The remove command

=head2 xz

lib/Alien/Build/Manual/AlienAuthor.pod  view on Meta::CPAN

 }

More details on testing L<Alien> modules can be found in the
L<Test::Alien> documentation.

You can also run the tests that come with the package that you are alienizing,
by using a C<test> block in your L<alienfile>.  Keep in mind that some packages
use testing tools or have other prerequisites that will not be available on your
users machines when they attempt to install your alien.  So you do not want to
blindly add a test block without checking what the prereqs are.  For Autoconf
style packages you typically test a package using the C<make check> command:

 use alienfile;
 
 plugin 'PkgConfig' => 'libfoo';
 
 share {
   ... # standard build steps.
   test [ '%{make} check' ];
 };

lib/Alien/Build/Manual/FAQ.pod  view on Meta::CPAN

=head1 DESCRIPTION

This document serves to answer the most frequently asked questions made by developers
creating L<Alien> modules using L<Alien::Build>.

=head1 QUESTIONS

=head2 What is Alien, Alien::Base and Alien::Build?

Alien in 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 for the L<Alien> runtime.  L<Alien::Build> is
a tool for probing the operating system for existing libraries and tools, and downloading, building
and installing packages.  L<alienfile> is a recipe format for describing how to probe,
download, build and install a package.

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

=head3 autoconf

Use the autoconf plugin (L<Alien::Build::Plugin::Build::Autoconf>).  If your package

lib/Alien/Build/Manual/FAQ.pod  view on Meta::CPAN

=back

=head3 autoconf-like

If you see an error like this:

 Unknown option "--with-pic".

It is because the autoconf plugin uses the C<--with-pic> option by default, since
it makes sense most of the time, and autoconf usually ignores options that it does
not recognize.  Some autoconf style build systems fail when they see an option that
they do not recognize.  You can turn this behavior off for these packages:

 plugin 'Build::Autoconf' => (
   with_pic => 0,
 );

Another thing about the autoconf plugin is that it uses C<DESTDIR> to do a double
staged install.  If you see an error like "nothing was installed into destdir", that
means that your package does not support C<DESTDIR>.  You should instead use the
MSYS plugin and use a command sequence to do the build like this:

lib/Alien/Build/Manual/PluginAuthor.pod  view on Meta::CPAN


and then from L<alienfile>:

 use alienfile;
 plugin 'Build::MyPlugin' => (
   arg1 => 'override for arg1',
   arg2 => [ 'something', 'else' ],
 );

=for html <p>flowchart</p>
<div style="display: flex"><div style="margin: 3px; flex: 1 1 50%">
<img src="image/PluginAuthor-flowchart.png" style="max-width: 100%">
</div></div>
<p><b>Notes</b>: The colored blocks indicate <tt>alienfile</tt> blocks.
Hooks are indicated as predefined process (rectangle with double struck
vertical edges).  Hooks that can easily be implemented from an
<tt>alienfile</tt> are indicated in blue (Note that <tt>[]</tt> is used
to indicate passing in an array reference, but a subroutine
reference can also be used).  For simplicity, the the flowchart does
not include when required modules are loaded.  Except for configure
time requirements, they are loaded when the corresponding <tt>alienfile</tt>
blocks are entered.  It is not shown, but generally any plugin can cause

lib/Alien/Build/Plugin/Build/Autoconf.pm  view on Meta::CPAN

      );

      my $ret = $orig->($build, @_);

      if(_win)
      {
        my $real_prefix = Path::Tiny->new($build->install_prop->{prefix});
        my @pkgconf_dirs;
        push @pkgconf_dirs, Path::Tiny->new($ENV{DESTDIR})->child($prefix)->child("$_/pkgconfig") for qw(lib share);

        # for any pkg-config style .pc files that are dropped, we need
        # to convert the MSYS /C/Foo style paths to C:/Foo
        for my $pkgconf_dir (@pkgconf_dirs) {
            if(-d $pkgconf_dir)
            {
              foreach my $pc_file ($pkgconf_dir->children)
              {
                $pc_file->edit(sub {s/\Q$prefix\E/$real_prefix->stringify/eg;});
              }
            }
        }
      }

lib/Alien/Build/Plugin/Build/Autoconf.pm  view on Meta::CPAN


This plugin provides some tools for building projects that use autoconf.  The main thing
this provides is a C<configure> helper, documented below and the default build stage,
which is:

 '%{configure} --disable-shared',
 '%{make}',
 '%{make} install',

On Windows, this plugin also pulls in the L<Alien::Build::Plugin::Build::MSYS> which is
required for autoconf style projects on windows.

The other thing that this plugin does is that it does a double staged C<DESTDIR> install.
The author has found this improves the overall reliability of L<Alien> modules that are
based on autoconf packages.

This plugin supports out-of-source builds (known in autoconf terms as "VPATH" builds) via
the meta property C<out_of_source>.

B<NOTE>: by itself, this plugin is only intended for use on packages that include a
C<configure> script.  For packages that expect you to use Autotools to generate a

lib/Alien/Build/Plugin/Build/Autoconf.pm  view on Meta::CPAN

=head1 PROPERTIES

=head2 with_pic

Adds C<--with-pic> option when running C<configure>.  If supported by your package, it
will generate position independent code on platforms that support it.  This is required
to XS modules, and generally what you want.

autoconf normally ignores options that it does not understand, so it is usually a safe
and reasonable default to include it.  A small number of projects look like they use
autoconf, but are really an autoconf style interface with a different implementation.
They may fail if you try to provide it with options such as C<--with-pic> that they do
not recognize.  Such packages are the rationale for this property.

=head2 msys_version

The version of L<Alien::MSYS> required if it is deemed necessary.  If L<Alien::MSYS>
isn't needed (if running under Unix, or MSYS2, for example) this will do nothing.

=head2 config_site

The content for the generated C<config.site>.

=head1 HELPERS

=head2 configure

 %{configure}

The correct incantation to start an autoconf style C<configure> script on your platform.
Some reasonable default flags will be provided.

=head1 ENVIRONMENT

=over 4

=item C<SITE_CONFIG>

For a share install, this plugin needs to alter the behavior of autotools using C<site.config>.
It does this by generating a C<site.config> file on the fly, and setting the C<SITE_CONFIG>

lib/Alien/Build/Plugin/Build/MSYS.pm  view on Meta::CPAN

The version of L<Alien::MSYS> required if it is deemed necessary.  If L<Alien::MSYS>
isn't needed (if running under Unix, or MSYS2, for example) this will do nothing.

=head1 HELPERS

=head2 make

 %{make}

On windows the default C<%{make}> helper is replace with the make that comes with
L<Alien::MSYS>.  This is almost certainly what you want, as most unix style make
projects will not build with C<nmake> or C<dmake> typically used by Perl on Windows.

=head1 SEE ALSO

L<Alien::Build::Plugin::Build::Autoconf>, L<Alien::Build::Plugin>, L<Alien::Build>, L<Alien::Base>, L<Alien>

L<http://www.mingw.org/wiki/MSYS>

=head1 AUTHOR

lib/Alien/Build/Plugin/Fetch/Local.pm  view on Meta::CPAN

In some cases you may need to use this plugin directly instead.

This fetch plugin fetches files from the local file system.  It is mostly useful if you
intend to bundle packages (as tarballs or zip files) with your Alien.  If you intend to
bundle a source tree, use L<Alien::Build::Plugin::Fetch::LocalDir>.

=head1 PROPERTIES

=head2 url

The initial URL to fetch.  This may be a C<file://> style URL, or just the path on the
local system.

=head2 root

The directory from which the URL should be relative.  The default is usually reasonable.

=head2 ssl

This property is for compatibility with other fetch plugins, but is not used.

lib/Alien/Build/Version/Basic.pm  view on Meta::CPAN

operators.  Although C<$version> must be a version object, C<$other> may
be either a version object, or a string that could be used to create a
valid version object.

=head1 SEE ALSO

=over 4

=item L<Sort::Versions>

Good, especially if you have to support rpm style versions (like C<1.2.3-2-b>)
or don't care if trailing zeros (C<1.2.3> vs C<1.2.3.0>) are treated as
different values.

=item L<version>

Problematic for historical reasons.

=back

=head1 AUTHOR

t/alien_build_plugin_core_download.t  view on Meta::CPAN


  # This test uses fake HTTP in class written below
  # to test http fetch.  Does not realy connect to
  # real HTTP
  local $ENV{ALIEN_DOWNLOAD_RULE} = 'warn';

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
    plugin 'Decode::HTML';
    plugin 'Fetch::FauxHTTP', url => 'http://foo.test', style => 'html';
    plugin 'Prefer::SortVersions';
  };

  alienfile_skip_if_missing_prereqs;
  alien_download_ok;

  is
    path($build->install_prop->{download}),
    object {
      call basename  => 'foo-1.01.tar.gz';

t/alien_build_plugin_core_download.t  view on Meta::CPAN

alien_subtest 'http html' => sub {

  # This test uses fake HTTP in class written below
  # to test http fetch.  Does not really connect to
  # real HTTP
  local $ENV{ALIEN_DOWNLOAD_RULE} = 'warn';

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
    plugin 'Fetch::FauxHTTP', url => 'http://foo.test', style => 'list';
    plugin 'Prefer::SortVersions';
  };

  alienfile_skip_if_missing_prereqs;
  alien_download_ok;

  is
    path($build->install_prop->{download}),
    object {
      call basename  => 'foo-1.01.tar.gz';

t/alien_build_plugin_core_download.t  view on Meta::CPAN

    'downloaded 1.01';

};

alien_subtest 'https html' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
    plugin 'Decode::HTML';
    plugin 'Fetch::FauxHTTP', url => 'https://foo.test', style => 'html';
    plugin 'Prefer::SortVersions';
  };

  alienfile_skip_if_missing_prereqs;
  alien_download_ok;

  is
    path($build->install_prop->{download}),
    object {
      call basename  => 'foo-1.00.tar.gz';

t/alien_build_plugin_core_download.t  view on Meta::CPAN

    },
    'downloaded 1.01';

};

alien_subtest 'https html' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
    plugin 'Fetch::FauxHTTP', url => 'https://foo.test', style => 'list';
    plugin 'Prefer::SortVersions';
  };

  alienfile_skip_if_missing_prereqs;
  alien_download_ok;

  is
    path($build->install_prop->{download}),
    object {
      call basename  => 'foo-1.00.tar.gz';

t/alien_build_plugin_core_download.t  view on Meta::CPAN


done_testing;

package
  Alien::Build::Plugin::Fetch::FauxHTTP;

use Alien::Build::Plugin;

BEGIN {
  has '+url'  => '';
  has 'style' => 'html';
}

sub init
{
  my($self, $meta) = @_;

  $meta->prop->{start_url} ||= $self->url;

  $meta->register_hook( fetch => sub {
    my($build, $url) = @_;

    $url ||= $self->url;

    if($url =~ m{^(https?)://foo\.test/?$})
    {
      if($self->style eq 'html')
      {
        return {
          type    => 'html',
          base    => "$url",
          content => q{
            <html><head><title>my listing</title></head><body><ul>
              <li><a href="foo-1.00.tar.gz">foo-1.00.tar.gz</a>
              <li><a href="http://foo.test/foo-1.01.tar.gz">foo-1.01.tar.gz</a>
            </ul></body></html>
          },
          protocol => $1,
        };
      }

      elsif($self->style eq 'list')
      {
        return {
          type => 'list',
          list => [
            { filename => 'foo-1.00.tar.gz', url => 'https://foo.test/foo-1.00.tar.gz' },
            { filename => 'foo-1.01.tar.gz', url => 'http://foo.test/foo-1.01.tar.gz' },
          ],
          protocol => $1,
        };
      }



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