Alien-Build

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  - Add heuristic to determine version from filename using
    Prefer::SortVersions plugin
  - Add log method to Alien::Build
  - Fixed bug in probe where first 'share' would be accepted (gh#7)

0.09      2017-02-04 17:31:00 -0500
  - Using an undefined property in command interpolation is now an
    error.
  - Added patch support.
  - Add meta property platform.compiler_type to flag Microsoft
    Visual C++ ("microsoft") compared with everything else ("unix")

0.08      2017-02-04 11:33:01 -0500
  - Fixed prereq bug introduced in 0.07

0.07      2017-02-04 11:21:13 -0500
  - The namespace Alien::Build::Plugin::Core is reserved for plugins
    that are automatically loaded for all instances of Alien::Build
  - Major refactor of Alien::Base2.  Please do not use it.
  - Improved documentation
  - Added Alien::Build::Plugin::Fetch::Local

README  view on Meta::CPAN


      platform.compiler_type

	Refers to the type of flags that the compiler accepts. May be
	expanded in the future, but for now, will be one of:

	microsoft

	  On Windows when using Microsoft Visual C++

	unix

	  Virtually everything else, including gcc on windows.

	The main difference is that with Visual C++ -LIBPATH should be used
	instead of -L, and static libraries should have the .LIB suffix
	instead of .a.

      platform.system_type

	$^O is frequently good enough to make platform specific logic in
	your alienfile, this handles the case when $^O can cover platforms
	that provide multiple environments that Perl might run under. The
	main example is windows, but others may be added in the future.

	unix

	vms

	windows-activestate

	windows-microsoft

	windows-mingw

	windows-strawberry

	windows-unknown

	Note that cygwin and msys are considered unix even though they run
	on windows!

      platform.cpu.count

	Contains a non-negative integer of available (possibly virtual)
	CPUs on the system. This can be used by build plugins to build in
	parallel. The environment variable ALIEN_CPU_COUNT can be set to
	override the CPU count.

      platform.cpu.arch.name

author.yml  view on Meta::CPAN

    - libs
    - PkgConfig
    - sys
    - destdir
    - alienfile
    - unstaged
    - checkpointed
    - ssl
    - readme
    - toolset
    - unixy
    - microsoft
    - GnuWin
    - alienizing
    - libfoo
    - libpkgconf
    - pc
    - DJERIUS
    - Diab
    - Jerius
    - ffi

author.yml  view on Meta::CPAN

    - Florian
    - Weimer

pod_coverage:
  skip: 0
  # format is "Class#method" or "Class", regex allowed
  # for either Class or method.
  private:
    - Alien::Base#Inline
    - Alien::Base#split_flags
    - Alien::Base#split_flags_unix
    - Alien::Base#split_flags_windows
    - Alien::Build::Plugin::.*#init
    - Alien::Build::Plugin::Probe::GnuWin32#new
    - Test::Alien::CanCompile#skip
    - Test::Alien::CanCompileCpp#skip
    - Test::Alien::CanPlatypus#skip
    - Test::Alien#with_subtest
    - Test::Alien#capture_merged
    - Alien::Base::PkgConfig
    - Alien::Build::Temp

lib/Alien/Base.pm  view on Meta::CPAN


  return $config->config(@_);
}

# helper method to split flags based on the OS
sub split_flags {
  my ($class, $line) = @_;
  if( $^O eq 'MSWin32' ) {
    $class->split_flags_windows($line);
  } else {
    # $os eq 'Unix'
    $class->split_flags_unix($line);
  }
}

sub split_flags_unix {
  my ($class, $line) = @_;
  shellwords($line);
}

sub split_flags_windows {
  # NOTE a better approach would be to write a function that understands cmd.exe metacharacters.
  my ($class, $line) = @_;

  # Double the backslashes so that when they are unescaped by shellwords(),
  # they become a single backslash. This should be fine on Windows since

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


Refers to the type of flags that the compiler accepts.  May be expanded in the
future, but for now, will be one of:

=over 4

=item microsoft

On Windows when using Microsoft Visual C++

=item unix

Virtually everything else, including gcc on windows.

=back

The main difference is that with Visual C++ C<-LIBPATH> should be used instead
of C<-L>, and static libraries should have the C<.LIB> suffix instead of C<.a>.

=item platform.system_type

C<$^O> is frequently good enough to make platform specific logic in your
L<alienfile>, this handles the case when $^O can cover platforms that provide
multiple environments that Perl might run under.  The main example is windows,
but others may be added in the future.

=over 4

=item unix

=item vms

=item windows-activestate

=item windows-microsoft

=item windows-mingw

=item windows-strawberry

=item windows-unknown

=back

Note that C<cygwin> and C<msys> are considered C<unix> even though they run
on windows!

=item platform.cpu.count

Contains a non-negative integer of available (possibly virtual) CPUs on the
system. This can be used by build plugins to build in parallel. The environment
variable C<ALIEN_CPU_COUNT> can be set to override the CPU count.

=item platform.cpu.arch.name

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}

Requires: L<Alien::gmake> 0.11

Deprecated: use L<Alien::Build::Plugin::Build::Make> instead.

=head2 install

 %{install}

The Unix C<install> command.  Not normally available on Windows.

=head2 ld

 %{ld}

The linker used to build Perl

=head2 m4

 %{m4}

Requires: L<Alien::m4> 0.08

L<Alien::m4> should pull in a version of C<m4> that will work with Autotools.

=head2 make

 %{make}

Make.  On Unix this will be the same make used by Perl.  On Windows this will be
C<gmake> or C<nmake> if those are available, and only C<dmake> if the first two
are not available.

=head2 make_path

 %{make_path}

Make directory, including all parent directories as needed.  This is usually C<mkdir -p>
on Unix and simply C<md> on windows.

=head2 nasm

 %{nasm}

Requires: L<Alien::nasm> 0.11 if not already in the C<PATH>.

=head2 patch

 %{patch}

Requires: L<Alien::patch> 0.09 if not already in the C<PATH>.

On Windows this will normally render C<patch --binary>, which makes patch work like it does on Unix.

=head2 perl

 %{perl}

Requires: L<Devel::FindPerl>

=head2 pkgconf

 %{pkgconf}

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

Sometimes though you will have a package that builds both, or maybe
you I<want> both static and dynamic libraries to work with XS and FFI.
For that case, there is the L<Alien::Build::Plugin::Gather::IsolateDynamic>
plugin.

 use alienfile;
 ...
 plugin 'Gather::IsolateDynamic';

What it does, is that it moves the dynamic libraries (usually .so on
Unix and .DLL on Windows) to a place where they can be found by FFI,
and where they won't be used by the compiler for building XS.  It usually
doesn't do any harm to include this plugin, so if you are just starting
out you might want to add it anyway.  Arguably it should have been the
default behavior from the beginning.

If you have already published an Alien that does not isolate its
dynamic libraries, then you might get some fails from old upgraded
aliens because the share directory isn't cleaned up by default (this is
perhaps a design bug in the way that share directories work, but it
is a long standing characteristic).  One work around for this is to

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


L<Alien::Build> provides a helper (C<%{make}>) for the C<make> that is used by Perl and
L<ExtUtils::MakeMaker> (EUMM).  Unfortunately the C<make> supported by Perl and EUMM on
Windows (C<nmake> and C<dmake>) are not widely supported by most open source projects.
(Thankfully recent perls and EUMM support GNU Make on windows now).

You can use the C<make> plugin (L<Alien::Build::Plugin::Build::Make>) to tell the
L<Alien::Build> system which make the project that you are alienizing requires.

 plugin 'Build::Make' => 'umake';
 # umake makes %{make} either GNU Make or BSD Make on Unix and GNU Make on Windows.
 build {
   build [
     # You can use the Perl config compiler and cflags using the %{perl.config...} helper
     [ '%{make}', 'CC=%{perl.config.cc}', 'CFLAGS=%{perl.config.cccdlflags} %{perl.config.optimize}' ],
     [ '%{make}', 'install', 'PREFIX=%{.install.prefix}' ],
   ],
 };

Some open source projects require GNU Make, and you can specify that, and L<Alien::gmake>
will be pulled in on platforms that do not already have it.

lib/Alien/Build/Plugin/Build.pod  view on Meta::CPAN


version 2.84

=head1 SYNOPSIS

For autoconf:

 use alienfile;
 plugin 'Build::Autoconf';

for unixy (even on windows):

 use alienfile;
 plugin 'Build::MSYS';

=head1 DESCRIPTION

Build plugins provide tools for building your package once it has been
downloaded and extracted.

=over 4

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


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}

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


    {
      my($out, $err) = capture { system $Config{make}, '--version' };
      return 'MinGW Makefiles' if $out =~ /GNU Make/;
    }

    die 'make not detected';
  }
  else
  {
    return 'Unix Makefiles';
  }
}

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

  $meta->prop->{destdir} = $^O eq 'MSWin32' ? 0 : 1;

  $meta->add_requires('configure' => 'Alien::Build::Plugin::Build::CMake' => '0.99');

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


=head1 HELPERS

=head2 cmake

This plugin replaces the default C<cmake> helper with the one that comes from L<Alien::cmake3>.

=head2 cmake_generator

This is the appropriate C<cmake> generator to use based on the make used by your Perl.  This is
frequently C<Unix Makefiles>.  One place where it may be different is if your Windows Perl uses
C<nmake>, which comes with Visual C++.

=head2 make

This plugin I<may> replace the default C<make> helper if the default C<make> is not supported by
C<cmake>.  This is most often an issue with older versions of Strawberry Perl which used C<dmake>.
On Perls that use C<dmake>, this plugin will search for GNU Make in the PATH, and if it can't be
found will fallback on using L<Alien::gmake>.

=head1 SEE ALSO

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


=head1 SYNOPSIS

 use alienfile;
 plugin 'Build::Copy';

=head1 DESCRIPTION

This plugin copies all of the files from the source to the staging prefix.
This is mainly useful for software packages that are provided as binary
blobs.  It works on both Unix and Windows using the appropriate commands
for those platforms without having worry about the platform details in your
L<alienfile>.

If you want to filter add or remove files from what gets installed you can
use a C<before> hook.

 build {
   ...
   before 'build' => sub {
     # remove or modify files

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

        unshift @PATH, Alien::MSYS::msys_path();

        $orig->($build, @_);
      },
    ) for qw( build build_ffi test_share test_ffi );
  }


  if($^O eq 'MSWin32')
  {
    # Most likely if we are trying to build something unix-y and
    # we are using MSYS, then we want to use the make that comes
    # with MSYS.
    $meta->interpolator->replace_helper(
      make => sub { 'make' },
    );

  }

  $self;
}

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

not do anything on non-windows platforms.  MSYS provides the essential tools
for building software that is normally expected in a UNIX or POSIX environment.
This like C<sh>, C<awk> and C<make>.  To provide MSYS, this plugin uses
L<Alien::MSYS>.

=head1 PROPERTIES

=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.

=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/Core/Setup.pm  view on Meta::CPAN

sub _platform
{
  my(undef, $hash) = @_;

  if($^O eq 'MSWin32' && $Config{ccname} eq 'cl')
  {
    $hash->{compiler_type} = 'microsoft';
  }
  else
  {
    $hash->{compiler_type} = 'unix';
  }

  if($^O eq 'MSWin32')
  {
    $hash->{system_type} = 'windows-unknown';

    if(defined &Win32::BuildNumber)
    {
      $hash->{system_type} = 'windows-activestate';
    }

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

      }
    }
  }
  elsif($^O =~ /^(VMS)$/)
  {
    # others probably belong in here...
    $hash->{system_type} = lc $^O;
  }
  else
  {
    $hash->{system_type} = 'unix';
  }

  $hash->{cpu}{count} =
    exists $ENV{ALIEN_CPU_COUNT} && $ENV{ALIEN_CPU_COUNT} > 0
    ? $ENV{ALIEN_CPU_COUNT}
    : _cpu_count();

  $hash->{cpu}{arch} = _cpu_arch(\%Config);
}

spellcheck.ini  view on Meta::CPAN

[Perl]
skip_sections = contributors
skip_sections = author
skip_sections = copyright and license
skip_sections = thanks
[StopWords]
word = unixy
word = umake
word = tar.exe

t/alien_base.t  view on Meta::CPAN

  );

  is( -f path(Alien::libfoo2->bin_dir)->child('foo-config'), T(), 'has a foo-config');

  is( Alien::libfoo2->runtime_prop->{arbitrary}, 'two', 'runtime_prop' );

};

subtest 'build flags' => sub {

  my %unix_flags = (
    q{ -L/a/b/c -lz -L/a/b/c } => [ "-L/a/b/c", "-lz", "-L/a/b/c" ],
  );

  my %win_flags = (
    q{ -L/a/b/c -lz -L/a/b/c } => [ "-L/a/b/c", "-lz", "-L/a/b/c" ],
    q{ -LC:/a/b/c -lz -L"C:/a/b c/d" } => [ "-LC:/a/b/c", "-lz", "-LC:/a/b c/d" ],
    q{ -LC:\a\b\c -lz } => [ q{-LC:\a\b\c}, "-lz" ],
  );

  subtest 'unix' => sub {
    foreach my $flag (keys %unix_flags)
    {
      is( [ Alien::Base->split_flags_unix( $flag ) ], $unix_flags{$flag} );
    }
  };

  subtest 'windows' => sub
  {
    foreach my $flag (keys %win_flags)
    {
      is( [ Alien::Base->split_flags_windows( $flag ) ], $win_flags{$flag} );
    }
  };

t/alien_build_plugin_probe_vcpkg.t  view on Meta::CPAN

$ENV{PERL_WIN32_VCPKG_DEBUG} = 0;
$ENV{VCPKG_DEFAULT_TRIPLET}  = 'x64-windows';

alien_subtest 'non vc' => sub {

  require Alien::Build::Plugin::Core::Setup;
  my $mock = mock 'Alien::Build::Plugin::Core::Setup' => (
    after => [
      _platform => sub {
        my(undef, $hash) = @_;
        $hash->{compiler_type} = 'unix';
      },
    ],
  );

  alienfile_ok q{
    use alienfile;

    plugin 'Probe::Vcpkg' => (
      lib => ['foo'],
    );



( run in 1.249 second using v1.01-cache-2.11-cpan-df04353d9ac )