Alien-Base-ModuleBuild
view release on metacpan or search on metacpan
lib/Alien/Base/ModuleBuild/API.pod view on Meta::CPAN
foo => '$ENV{FOO}||"my preferred value if not already set"'
},
alien_env => {
FOO => '%{foo}',
},
...
);
...
A common pitfall with environment variables is that setting one to the
empty string (C<''>) is not portable. On Unix it works fine as you would
expect, but in Windows it actually unsets the environment variable, which
may not be what you intend.
...
Alien::Base::ModuleBuild->new(
...
alien_env => {
# is allowed, but may not do what you intend
# on some platforms!
FOO => '',
lib/Alien/Base/ModuleBuild/API.pod view on Meta::CPAN
=item exact_filename
This key may be specified in place of C<pattern> when the filename of the tarball is known, in which case such a file is downloaded from the given C<host> and C<location>. Note that, in general, specifying a C<pattern> gives more flexibility, but the...
=item exact_version
This key may be specified with the C<exact_filename> key when the version of the tarball is known.
=item platform
This attribute is a string telling the repository validator which platform the repository serves. This may be the string C<src> (the default) for platform-independent source files, or a string which matches the L<Module::Build> method C<os_type> (e.g...
=item c_compiler_required
If true (the default), then a C compiler is required to build from source.
=back
=item alien_repository_class
[version 0.001]
lib/Alien/Base/ModuleBuild/API.pod view on Meta::CPAN
=over
=item %{I<helper>}
[version 0.020]
Call the given helper, either provided by the C<alien_helper> or C<alien_bin_requires> property. See L<Alien::Base#alien_helper>.
=item %c
Platform independent incantation for running autoconf C<configure> script. On *nix systems this is C<./configure>, on Windows this is C<sh configure>. On windows L<Alien::MSYS> is injected as a dependency and all commands are executed in an C<MSYS>...
=item %n
Shortcut for the name stored in C<alien_name>
pkg-config --modversion %n
=item %p
B<deprecated>
Platform independent "local command prefix". On *nix systems this is C<./>, on Windows it is an empty string.
%pconfigure
Please note that this only works to run scripts on Unix, and does not work on Windows. It is thus, not fit for purpose and should not be used. As an alternative:
=over 4
=item autoconf "configure"
If you are trying to invoke the autoconf configure script, use C<%c> instead. This will use the correct incantation on either Unix like systems and on Windows.
=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
lib/Alien/Base/ModuleBuild/API.pod view on Meta::CPAN
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
# Build.PL
use Alien::Base::ModuleBuild;
use Config;
Alien::Base::ModuleBuild->new(
...
alien_bin_requires => {
'Alien::CMake' => 0.07,
},
alien_build_commands => [
# acutal required arguments may vary
"cmake -G 'Unix Makefiles' -DCMAKE_MAKE_PROGRAM=$Config{make} -DCMAKE_INSTALL_PREFIX:PATH=%s",
"$Config{make}",
],
alien_install_commands => [
"$Config{make} install",
],
...
)->create_build_script;
=head3 vanilla Makefiles?
t/alien_base_modulebuild.t view on Meta::CPAN
my $builder = builder(
module_name => 'My::Test::Module',
dist_version => '1.234.567',
);
ok( $builder->alien_validate_repo( {platform => undef} ), "undef validates to true");
subtest 'windows test' => sub {
skip_all "Windows test" unless $builder->is_windowsish();
ok( $builder->alien_validate_repo( {platform => 'Windows'} ), "platform Windows on Windows");
ok( ! $builder->alien_validate_repo( {platform => 'Unix'} ), "platform Unix on Windows is false");
};
subtest 'unix test' => sub {
skip_all "Unix test" unless $builder->is_unixish();
ok( $builder->alien_validate_repo( {platform => 'Unix'} ), "platform Unix on Unix");
ok( ! $builder->alien_validate_repo( {platform => 'Windows'} ), "platform Windows on Unix is false");
};
subtest 'need c compiler' => sub {
skip_all "Needs c compiler" unless $builder->have_c_compiler();
ok( $builder->alien_validate_repo( {platform => 'src'} ), "platform src");
};
};
subtest 'basic interpolation' => sub {
( run in 0.944 second using v1.01-cache-2.11-cpan-64ef6c95b5d )