Alien-Libbz2
view release on metacpan or search on metacpan
In your Build.PL:
use Module::Build;
use Alien::Libbz2;
my $builder = Module::Build->new(
...
configure_requires => {
'Alien::Libbz2' => '0',
...
},
extra_compiler_flags => Alien::Libbz2->cflags,
extra_linker_flags => Alien::Libbz2->libs,
...
);
$build->create_build_script;
In your Makefile.PL:
use ExtUtils::MakeMaker;
use Config;
use Alien::Libbz2;
WriteMakefile(
...
CONFIGURE_REQUIRES => {
'Alien::Libbz2' => '0',
},
CCFLAGS => Alien::Libbz2->cflags . " $Config{ccflags}",
LIBS => [ Alien::Libbz2->libs ],
...
);
In your FFI::Platypus script or module:
use FFI::Platypus;
use Alien::Libbz2;
my $ffi = FFI::Platypus->new(
In your script or module:
use Alien::Libbz2;
use Env qw( @PATH );
unshift @PATH, Alien::Libbz2->bin_dir;
DESCRIPTION
This Alien module provides the necessary compiler and linker flags
needed for using libbz2 in XS.
METHODS
cflags
my $cflags = Alien::Libbz2->cflags;
Returns the C compiler flags.
libs
my $libs = Alien::Libbz2->libs;
Returns the linker flags.
HELPERS
bzip2
%{bzip2}
Returns the name of the bzip2 command. Usually just bzip2.
SEE ALSO
plugin 'Download' => (
url => 'https://sourceforge.net/projects/bzip2/files/latest/download',
);
plugin Extract => 'tar.gz';
patch [ '%{patch} -p1 < %{.install.patch}/bzip2-1.0.6.diff' ];
my @build;
push @build,
[ '%{make}', -f => '%{.meta.my_makefile}', 'all', "CC=%{perl.config.cc}", "CFLAGS=%{perl.config.cccdlflags} %{perl.config.optimize}", ],
[ '%{make}', -f => '%{.meta.my_makefile}', 'install', 'PREFIX=%{.install.prefix}', 'EXE=%{perl.config.exe_ext}' ];
push @build, sub {
my($build) = @_;
my($version) = path(".")->absolute->basename =~ /([0-9\.]+)$/;
$build->runtime_prop->{version} = $version;
};
if($^O !~ /^(MSWin32|cygwin|msys)$/)
{
}
}];
}
build \@build;
gather sub {
my($build) = @_;
my $prefix = $build->runtime_prop->{prefix};
$build->runtime_prop->{cflags} = "-I$prefix/include ";
$build->runtime_prop->{cflags_static} = "-I$prefix/include ";
if($compiler_type eq 'microsoft')
{
$build->runtime_prop->{libs} = "-LIBPATH:$prefix/lib libbz2.lib ";
$build->runtime_prop->{libs_static} = "-LIBPATH:$prefix/lib libbz2.lib ";
}
else
{
$build->runtime_prop->{cflags_static} .= ' -DBZ_STATIC=1';
$build->runtime_prop->{libs} = "-L$prefix/lib -lbz2 ";
$build->runtime_prop->{libs_static} = "-L$prefix/lib -lbz2 ";
}
};
};
---
pod_spelling_system:
skip: 0
# list of words that are spelled correctly
# (regardless of what spell check thinks)
stopwords:
- bz2
- cflags
- libbz2
- libs
- bzip
- dlls
pod_coverage:
skip: 0
# format is "Class#method" or "Class", regex allowed
# for either Class or method.
private:
travis_status = 1
release_tests = 1
installer = Author::Plicease::MakeMaker
github_user = Perl5-Alien
irc = irc://irc.perl.org/#native
test2_v0 = 1
diag_preamble = | $post_diag = sub {
diag_preamble = | require Alien::Libbz2;
diag_preamble = | diag "version = ", Alien::Libbz2->version;
diag_preamble = | diag "cflags = ", Alien::Libbz2->cflags;
diag_preamble = | diag "cflags_static = ", Alien::Libbz2->cflags_static;
diag_preamble = | diag "libs = ", Alien::Libbz2->libs;
diag_preamble = | diag "libs_static = ", Alien::Libbz2->libs_static;
diag_preamble = | diag "bin_dir = ", $_ for Alien::Libbz2->bin_dir;
diag_preamble = | diag "dist_dir = ", Alien::Libbz2->dist_dir;
diag_preamble = | diag "install_type = ", Alien::Libbz2->install_type;
diag_preamble = | };
[AlienBuild]
:version = 0.10
lib/Alien/Libbz2.pm view on Meta::CPAN
In your Build.PL:
use Module::Build;
use Alien::Libbz2;
my $builder = Module::Build->new(
...
configure_requires => {
'Alien::Libbz2' => '0',
...
},
extra_compiler_flags => Alien::Libbz2->cflags,
extra_linker_flags => Alien::Libbz2->libs,
...
);
$build->create_build_script;
In your Makefile.PL:
use ExtUtils::MakeMaker;
use Config;
use Alien::Libbz2;
WriteMakefile(
...
CONFIGURE_REQUIRES => {
'Alien::Libbz2' => '0',
},
CCFLAGS => Alien::Libbz2->cflags . " $Config{ccflags}",
LIBS => [ Alien::Libbz2->libs ],
...
);
In your L<FFI::Platypus> script or module:
use FFI::Platypus;
use Alien::Libbz2;
my $ffi = FFI::Platypus->new(
lib/Alien/Libbz2.pm view on Meta::CPAN
In your script or module:
use Alien::Libbz2;
use Env qw( @PATH );
unshift @PATH, Alien::Libbz2->bin_dir;
=head1 DESCRIPTION
This L<Alien> module provides the necessary compiler and linker flags needed
for using libbz2 in XS.
=head1 METHODS
=head2 cflags
my $cflags = Alien::Libbz2->cflags;
Returns the C compiler flags.
=head2 libs
my $libs = Alien::Libbz2->libs;
Returns the linker flags.
=head1 HELPERS
=head2 bzip2
%{bzip2}
Returns the name of the bzip2 command. Usually just C<bzip2>.
=head1 SEE ALSO
lib/Alien/bz2.pm view on Meta::CPAN
our $VERSION = '0.24'; # VERSION
sub new
{
my($class) = @_;
bless {}, $class;
}
sub cflags
{
my $cflags = Alien::Libbz2->cflags;
return $cflags if ! wantarray;
require Text::ParseWords;
Text::ParseWords::shellwords($cflags);
}
sub libs
{
my $libs = Alien::Libbz2->libs;
return $libs if ! wantarray;
require Text::ParseWords;
Text::ParseWords::shellwords($libs);
}
lib/Alien/bz2.pm view on Meta::CPAN
=head1 SYNOPSIS
Build.PL
use Alien::bz2;
use Module::Build;
my $alien = Alien::bz2->new;
my $build = Module::Build->new(
...
extra_compiler_flags => [$alien->cflags],
extra_linker_flags => [$alien->libs],
...
);
$build->create_build_script;
Makefile.PL
use Alien::bz2;
use ExtUtils::MakeMaker;
my $alien = Alien::bz2;
WriteMakefile(
...
CCFLAGS => scalar $alien->cflags,
LIBS => [$alien->libs],
);
FFI::Platypus
use Alien::bz2;
use FFI::Platypus;
my $ffi = FFI::Platypus->new(lib => [Alien::bz2->new->dlls]);
$ffi->attach( BZ2_bzlibVersion => [] => 'string' );
lib/Alien/bz2.pm view on Meta::CPAN
=head1 CONSTRUCTOR
=head2 new
my $alien = Alien::bz2->new;
Although not necessary, you may create an instance of L<Alien::bz2>.
=head1 METHODS
=head2 cflags
my $cflags = Alien::bz2->cflags;
my @cflags = Alien::bz2->cflags;
Returns the C compiler flags necessary to build against bz2.
Returns flags as a list in list context and combined into a string in
scalar context.
=head2 libs
my $libs = Alien::bz2->libs;
my @libs = Alien::bz2->libs;
Returns the library flags necessary to build against bz2.
Returns flags as a list in list context and combined into a string in
scalar context.
=head2 dlls
my @dlls = Alien::bz2->dlls;
Returns a list of dynamic libraries (usually a list of just one library)
that make up bz2. This can be used for L<FFI::Platypus>.
Returns just the first dynamic library found in scalar context.
t/00_diag.t view on Meta::CPAN
Alien::Build::MM
ExtUtils::CBuilder
ExtUtils::MakeMaker
Test2::V0
Test::Alien
);
$post_diag = sub {
require Alien::Libbz2;
diag "version = ", Alien::Libbz2->version;
diag "cflags = ", Alien::Libbz2->cflags;
diag "cflags_static = ", Alien::Libbz2->cflags_static;
diag "libs = ", Alien::Libbz2->libs;
diag "libs_static = ", Alien::Libbz2->libs_static;
diag "bin_dir = ", $_ for Alien::Libbz2->bin_dir;
diag "dist_dir = ", Alien::Libbz2->dist_dir;
diag "install_type = ", Alien::Libbz2->install_type;
};
my @modules = sort keys %modules;
sub spacer ()
t/alien_bz2.t view on Meta::CPAN
use Test2::V0 -no_srand => 1;
use Alien::bz2;
diag '';
diag '';
diag '';
diag 'cflags = ' . Alien::bz2->cflags;
diag 'libs = ' . Alien::bz2->libs;
diag 'dlls = ' . $_ for Alien::bz2->dlls;
diag 'version = ' . Alien::bz2->version;
diag 'install_type = ' . Alien::bz2->install_type;
diag '';
diag '';
ok 1;
( run in 7.335 seconds using v1.01-cache-2.11-cpan-94b05bcf43c )