view release on metacpan or search on metacpan
inc/My/Builder.pm view on Meta::CPAN
my $self = shift;
if ( ! -e 'build_done' ) {
my $inst = $self->notes('already_installed_lib');
if (defined $inst) {
$self->config_data('config', { LIBS => $inst->{lflags},
INC => $inst->{cflags},
});
}
else {
# some questions before we start
my $dbg = !$ENV{TRAVIS} ? $self->prompt("\nDo you want to see debug info + all messages during 'make' (y/n)?", 'n') : 'n';
inc/My/Builder.pm view on Meta::CPAN
$self->apply_patch("$build_src/cd", $_) foreach (@{$self->notes('cd_patches')});
}
}
$unpack = (-d "$build_src/zlib") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/zlib' exists, wanna replace with clean sources?", "n") : 'y';
if ($self->notes('zlib_url') && !$self->config_data('syszlib_lflags') && lc($unpack) eq 'y') {
File::Path::rmtree("$build_src/zlib") if -d "$build_src/zlib";
$self->prepare_sources($self->notes('zlib_url'), $self->notes('zlib_sha1'), $download, $build_src);
if ($self->notes('zlib_patches')) {
$self->apply_patch("$build_src/zlib", $_) foreach (@{$self->notes('zlib_patches')});
}
}
$unpack = (-d "$build_src/freetype") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/freetype' exists, wanna replace with clean sources?", "n") : 'y';
if ($self->notes('freetype_url') && !$self->config_data('sysfreetype_lflags') && lc($unpack) eq 'y') {
File::Path::rmtree("$build_src/freetype") if -d "$build_src/freetype";
$self->prepare_sources($self->notes('freetype_url'), $self->notes('freetype_sha1'), $download, $build_src);
if ($self->notes('freetype_patches')) {
$self->apply_patch("$build_src/freetype", $_) foreach (@{$self->notes('freetype_patches')});
}
inc/My/Builder.pm view on Meta::CPAN
# store info about build to ConfigData
$self->config_data('share_subdir', $share_subdir);
$self->config_data('config', { PREFIX => '@PrEfIx@',
LIBS => '-L' . $self->quote_literal('@PrEfIx@/lib') .
' -l' . join(' -l', @{$self->config_data('linker_libs')}) .
' ' . $self->config_data('extra_lflags'),
INC => '-I' . $self->quote_literal('@PrEfIx@/include') .
' ' . $self->config_data('extra_cflags'),
});
}
# mark sucessfully finished build
$self->touchfile('build_done');
}
inc/My/Builder.pm view on Meta::CPAN
push(@candidates, { L => '/usr/local/lib', I => '/usr/local/include' }) if -d '/usr/local/lib' && -d '/usr/local/include';
push(@candidates, { L => '/usr/lib', I => '/usr/include' }) if -d '/usr/lib' && -d '/usr/include';
print STDERR "Checking iup+im+cd already installed on your system ...\n";
foreach my $i (@candidates) {
my $lflags = $i->{L} ? '-L'.$self->quote_literal($i->{L}) : '';
my $cflags = $i->{I} ? '-I'.$self->quote_literal($i->{I}) : '';
#xxx does not work with MSVC compiler
#xxx $lflags = ExtUtils::Liblist->ext($lflags) if($Config{make} =~ /nmake/ && $Config{cc} =~ /cl/); # MSVC compiler hack
print STDERR "- testing: $cflags $lflags\n";
my $rv1 = $self->check_header( [ 'iup.h', 'im.h', 'cd.h' ], $cflags);
#xxx maybe we need to link with more libs
if ($self->check_lib( [ 'iup', 'im', 'cd' ], $cflags, $lflags)){
print STDERR "- iup+im+cd FOUND!\n";
$self->notes('already_installed_lib', { lflags => "$lflags -liup -lim -lcd", cflags => $cflags } );
return 1;
}
elsif ($self->check_lib( [ 'iupwin', 'im', 'cdwin' ], $cflags, $lflags)) {
print STDERR "- iupwin+im+cdwin FOUND!\n";
$self->notes('already_installed_lib', { lflags => "$lflags -liupwin -lim -lcdwin", cflags => $cflags } );
return 1;
}
elsif ($self->check_lib( [ 'iupgtk', 'im', 'cdgdk' ], $cflags, $lflags)) {
print STDERR "- iupgtk+im+cdgdk FOUND!\n";
$self->notes('already_installed_lib', { lflags => "$lflags -liupgtk -lim -lcdgdk", cflags => $cflags } );
return 1;
}
elsif ($self->check_lib( [ 'iupmot', 'im', 'cdx11' ], $cflags, $lflags)) {
print STDERR "- iupmot+im+cdx11 FOUND!\n";
$self->notes('already_installed_lib', { lflags => "$lflags -liupmot -lim -lcdx11", cflags => $cflags } );
return 1;
}
}
print STDERR "- iup+im+cd not found (we have to build it from sources)!\n";
return 0;
}
# check presence of header(s) specified as params
sub check_header {
my ($self, $h, $cflags) = @_;
$cflags ||= '';
my @header = ref($h) ? @$h : ( $h );
my ($fs, $src) = tempfile('tmpfileXXXXXX', SUFFIX => '.c', UNLINK => 1);
my ($fo, $obj) = tempfile('tmpfileXXXXXX', SUFFIX => '.o', UNLINK => 1);
my $inc = '';
inc/My/Builder.pm view on Meta::CPAN
MARKER
close($fs);
$src = $self->quote_literal($src);
$obj = $self->quote_literal($obj);
#Note: $Config{cc} might contain e.g. 'ccache cc' (FreeBSD 8.0)
my $rv = run3("$Config{cc} -c -o $obj $src $cflags", \undef, \undef, \undef, { return_if_system_error => 1 } );
return ($rv == 1 && $? == 0) ? 1 : 0;
}
# check presence of lib(s) specified as params
sub check_lib {
my ($self, $l, $cflags, $lflags) = @_;
$cflags ||= '';
$lflags ||= '';
$cflags =~ s/[\r\n]//g;
$lflags =~ s/[\r\n]//g;
my @libs = ref($l) ? @$l : ( $l );
my $liblist = scalar(@libs) ? '-l' . join(' -l', @libs) : '';
my ($fs, $src) = tempfile('tmpfileXXXXXX', SUFFIX => '.c', UNLINK => 1);
my ($fo, $obj) = tempfile('tmpfileXXXXXX', SUFFIX => '.o', UNLINK => 1);
inc/My/Builder.pm view on Meta::CPAN
$src = $self->quote_literal($src);
$obj = $self->quote_literal($obj);
$exe = $self->quote_literal($exe);
my $output;
#Note: $Config{cc} might contain e.g. 'ccache cc' (FreeBSD 8.0)
my $rv1 = run3("$Config{cc} -c -o $obj $src $cflags", \undef, \$output, \$output, { return_if_system_error => 1 } );
unless ($rv1 == 1 && $? == 0) {
#print STDERR "OUTPUT(compile):\n$output\n" if $output;
return 0
}
my $rv2 = run3("$Config{ld} $obj -o $exe $lflags $liblist", \undef, \$output, \$output, { return_if_system_error => 1 } );
unless ($rv2 == 1 && $? == 0) {
#print STDERR "OUTPUT(link):\n$output\n" if $output;
return 0
}
return 1;
inc/My/Builder.pm view on Meta::CPAN
sub pkg_config {
my ($self, $pkc, $nul) = @_;
if ($nul && $pkc && `$pkc --version 2>$nul`) {
warn "Checking system libraries zlib, freetype2\n";
(my $syszlib_ver = `$pkc zlib --modversion 2>$nul` ) =~ s/\s*$//;
(my $syszlib_lflags = `$pkc zlib --libs 2>$nul` ) =~ s/\s*$//;
(my $syszlib_cflags = `$pkc zlib --cflags 2>$nul` ) =~ s/\s*$//;
(my $sysfreetype_ver = `$pkc freetype2 --modversion 2>$nul`) =~ s/\s*$//;
(my $sysfreetype_lflags = `$pkc freetype2 --libs 2>$nul` ) =~ s/\s*$//;
(my $sysfreetype_cflags = `$pkc freetype2 --cflags 2>$nul` ) =~ s/\s*$//;
$self->config_data('syszlib_ver', $syszlib_ver );
$self->config_data('syszlib_lflags', $syszlib_lflags );
$self->config_data('syszlib_cflags', $syszlib_cflags );
$self->config_data('sysfreetype_ver', $sysfreetype_ver );
$self->config_data('sysfreetype_lflags', $sysfreetype_lflags);
$self->config_data('sysfreetype_cflags', $sysfreetype_cflags);
warn "FOUND: zlib-$syszlib_ver LF=$syszlib_lflags\n" if $syszlib_lflags;
warn "FOUND: freetype-$sysfreetype_ver LF=$sysfreetype_lflags\n" if $sysfreetype_lflags;
}
};
1;
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# Absolut-ize all paths
$ICONV_SOURCE_DIR = File::Spec->rel2abs($ICONV_SOURCE_DIR);
$ICONV_SOURCE = File::Spec->rel2abs($ICONV_SOURCE);
# Construct the necessary flags
my $CCFLAGS = $ENV{CCFLAGS};
my $LDFLAGS = $ENV{LDFLAGS};
if (! $RUNNING_IN_HELL) {
$CCFLAGS ||= '-I/usr/local/include';
$LDFLAGS ||= '-L/usr/local/lib';
view all matches for this distribution
view release on metacpan or search on metacpan
our $VERSION = 0.014_000;
use English qw(-no_match_vars); # for $OSNAME
# DEV NOTE: Windows OS, required macro to avoid build errors
my $configure_cxxflags = '';
if ($OSNAME eq 'MSWin32') {
$configure_cxxflags = 'CXXFLAGS="%CXXFLAGS% -DPCRE2_STATIC"';
}
#print {*STDERR} "\n\n", q{<<< DEBUG >>> in alienfile, have $configure_cxxflags = '}, $configure_cxxflags, q{'}, "\n\n";
plugin 'Probe::CBuilder' => (
aliens => [ 'Alien::PCRE2' ],
program => "#include <jpcre2.hpp>\nint main() { return 0; }\n",
lang => 'C++',
aliens => [ 'Alien::PCRE2' ],
public_I => 1,
public_l => 1,
);
build [
# '%{configure} --enable-cpp11 --enable-test ' . $configure_cxxflags, # DEV NOTE: disable C++11 features to support older compilers
'%{configure} --disable-cpp11 --enable-test ' . $configure_cxxflags,
'%{gmake}',
'%{gmake} check',
'%{gmake} install',
];
};
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_hasJVM.t view on Meta::CPAN
$errorMessage = $javaVersion;
$diagMessage .= "\nJVM is returning an Error when querying version information ... stopping tests.\n";
$diagMessage .= "!!!!!!!!!! Error Message !!!!!!!: = $errorMessage\n";
# flag as missing/not runnable
$javaVersion = 'missing';
}
SKIP: {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/My/Judy/Builder.pm view on Meta::CPAN
both]
--with-tags[=TAGS] include additional configurations [automatic]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <dougbaskins@yahoo.com>.
view all matches for this distribution
view release on metacpan or search on metacpan
meta->after_hook(
gather_share => sub {
my ($build) = @_;
$build->runtime_prop->{version} =
join '.', split //, $build->runtime_prop->{version};
$build->runtime_prop->{cflags} = join ' ',
'-Wno-format',
'-Wformat=0',
join('', '-DMACHTYPE_', $build->runtime_prop->{kent_machtype}),
join('', '-I', catfile $build->install_prop->{prefix}, 'inc'),
;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Keystone.pm view on Meta::CPAN
use Alien::Keystone;
# ...
my $keystone= Alien::Keystone->new;
my $build = Module::Build->new(
...
extra_compiler_flags => $keystone->cflags(),
extra_linker_flags => $keystone->libs(),
...
);
=head1 VERSION
lib/Alien/Keystone.pm view on Meta::CPAN
=item B<new>
Creates the object. Refer C<Alien::Base> for more information.
=item B<cflags>
This method provides the compiler flags needed to use the library on the system.
=item B<libs>
This method provides the linker flags needed to use the library on the system.
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Kiwisolver.pm view on Meta::CPAN
my ($self, $lang) = @_;
if( $lang =~ /^CPP$/ ) {
my $params = Alien::Base::Inline(@_);
$params->{CCFLAGSEX} = $self->runtime_prop->{cppstdflag};
$params->{PRE_HEAD} = <<' EOF';
#if defined(_MSC_VER) || defined(__MINGW32__)
# define NO_XSLOCKS /* To avoid Perl wrappers of C library */
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/LIBSVM.pm view on Meta::CPAN
$class->install_type eq 'share' ? ('-L' . File::Spec->catfile($class->dist_dir, qw(lib)) ) : (),
'-lsvm',
);
}
sub cflags {
my ($class) = @_;
join ' ', (
$class->install_type eq 'share' ? ('-I' . File::Spec->catfile($class->dist_dir, qw(include)) ) : (),
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/LMDB.pm view on Meta::CPAN
=head1 SYNOPSIS
my $lmdb = Alien::LMDB->new;
my $cflags = $lmdb->cflags;
## "-I/usr/local/share/perl/5.20.2/auto/share/dist/Alien-LMDB/include"
my $libs = $lmdb->libs;
## "-L/usr/local/share/perl/5.20.2/auto/share/dist/Alien-LMDB/lib -llmdb"
view all matches for this distribution
view release on metacpan or search on metacpan
my($build) = @_;
my $pc = Path::Tiny->new('lzo2.pc.in');
if(-f $pc)
{
$pc->edit_lines(sub {
/^Cflags:/ && s{/lzo$}{};
});
}
};
plugin 'Build::Autoconf' => ();
view all matches for this distribution
view release on metacpan or search on metacpan
];
};
gather [
[ 'pkg-config --modversion libcxcregion', \'%{.runtime.version}' ],
[ 'pkg-config --cflags libcxcregion', \'%{.runtime.cflags}' ],
[ 'pkg-config --libs libcxcregion', \'%{.runtime.libs}' ],
];
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Build/AlienLibJIT.pm view on Meta::CPAN
sub new {
my ($class, @args) = @_;
return $class->SUPER::new(
#include_dirs => [$LIBJIT_INCLUDE],
#extra_linker_flags => [$LIBJIT_RESULT, '-lpthread'],
@args,
);
}
sub ACTION_code {
view all matches for this distribution
view release on metacpan or search on metacpan
# save correct package settings
# for now there is no good way to retrieve them from cmake
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";
my $extra_libs = ' -lm';
$extra_libs .= ' -lshlwapi' if $^O eq 'MSWin32';
$build->runtime_prop->{libs} = "-L$prefix/lib -ljq -lonig". $extra_libs;
$build->runtime_prop->{libs_static} = "-L$prefix/lib -ljq -lonig". $extra_libs;
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/LibMagic.pm view on Meta::CPAN
use warnings;
use Path::Tiny;
use parent 'Alien::Base';
sub cflags {
my ($self) = @_;
my $top_include = File::Spec->catfile( File::Spec->rel2abs($self->dist_dir), qw(include) );
return "-I$top_include";
}
view all matches for this distribution
view release on metacpan or search on metacpan
if (isAtLeastFreeBSDv8) {
probe sub { 1 };
gather sub {
my ($build) = @_;
$build->runtime_prop->{version} = '1.0.9';
$build->runtime_prop->{cflags} = '-I/usr/include';
$build->runtime_prop->{libs} = '-L/usr/lib -lusb';
$build->runtime_prop->{libs_static} = '-L/usr/lib -lusb';
};
}
plugin 'PkgConfig' => 'libusb-1.0';
my ($cppflags, $ldflags) = ('', '');
share {
requires 'Alien::autoconf' => '0.03';
requires 'Alien::automake' => '0.05';
requires 'Alien::libtool' => '0.02';
view all matches for this distribution
view release on metacpan or search on metacpan
my $libusbx_version = '1.0.17';
# Override the CFLAGS/LIBS settings
sub alien_override($$$$) {
my ($builder, $version, $cflags, $libs) = @_;
my $dirname = '_dummy';
my $filename = "dummy-$version.tar";
unless (-d $dirname) {
mkdir($dirname) or croak "Could not create temporary directory '$dirname': $!";
exact_version => $version});
$builder->alien_build_commands(undef);
$builder->alien_install_commands(undef);
$builder->alien_provides_cflags($cflags);
$builder->alien_provides_libs($libs);
}
# Mirror list: http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors
my @mirrors = qw/aarnet dfn freefr garr heanet hivelocity internode
view all matches for this distribution
view release on metacpan or search on metacpan
examples/synopsis.pl view on Meta::CPAN
use strict;
use Alien::LibXML;
my $alien = Alien::LibXML->new;
say $alien->libs;
say $alien->cflags;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/LibYAML.pm view on Meta::CPAN
...
configure_requires => {
'Alien::LibYAML' => '0',
...
},
extra_compiler_flags => Alien::LibYAML->cflags,
extra_linker_flags => Alien::LibYAML->libs,
...
);
$build->create_build_script;
lib/Alien/LibYAML.pm view on Meta::CPAN
WriteMakefile(
...
CONFIGURE_REQUIRES => {
'Alien::LibYAML' => '0',
},
CCFLAGS => Alien::LibYAML->cflags . " $Config{ccflags}",
LIBS => [ Alien::LibYAML->libs ],
...
);
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
$dir = [$v,File::Spec->splitdir($d)];
$f;
} $alien->dlls;
my $build = bless {
cflags => [$alien->cflags],
libs => [$alien->libs],
dll_dir => $dir,
dlls => \@dlls,
prefix => File::Spec->rootdir,
}, $class;
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
};
return $build unless $@;
}
my $build = bless {
cflags => _try_pkg_config(undef, 'cflags', '', ''),
libs => _try_pkg_config(undef, 'libs', '-larchive', ''),
}, $class;
if($options{test} =~ /^(ffi|both)$/)
{
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
"exec_prefix=\${prefix}",
"libdir=\${exec_prefix}/lib",
"includedir=\${prefix}/include",
"Name: libarchive",
"Description: library that can create and read several streaming archive formats",
"Cflags: -I\${includedir}",
"Libs: advapi32.lib \${libdir}/archive_static.lib",
"Libs.private: ",
"";
require File::Path;
File::Path::mkpath($pkg_config_dir, 0, 0755);
}
my($version) = map { /^Version:\s*(.*)$/; $1 } grep /^Version: /, @content;
# older versions apparently didn't include the necessary -I and -L flags
if(defined $version && $version =~ /^[12]\./)
{
for(@content)
{
s/^Libs: /Libs: -L\${libdir} /;
}
push @content, "Cflags: -I\${includedir}\n";
}
open my $fh, '>', $pcfile;
print $fh @content;
close $fh;
};
my $build = bless {
cflags => _try_pkg_config($pkg_config_dir, 'cflags', '-I' . File::Spec->catdir($prefix, 'include'), '--static'),
libs => _try_pkg_config($pkg_config_dir, 'libs', '-L' . File::Spec->catdir($prefix, 'lib'), '--static'),
prefix => $prefix,
dll_dir => [ 'dll' ],
dlls => do {
opendir(my $dh, File::Spec->catdir($prefix, 'dll'));
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
}, $class;
if($^O eq 'cygwin' || $^O eq 'MSWin32')
{
# TODO: should this go in the munged pc file?
unshift @{ $build->{cflags} }, '-DLIBARCHIVE_STATIC';
}
$build->test_compile_run || die $build->error if $options{test} =~ /^(compile|both)$/;
$build->test_ffi || die $build->error if $options{test} =~ /^(ffi|both)$/;
$build;
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
die $error if $error;
$build;
}
sub cflags { shift->{cflags} }
sub libs { shift->{libs} }
sub version { shift->{version} }
sub dlls
{
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
};
my $test_object = eval {
$cbuilder->compile(
source => $fn,
extra_compiler_flags => $self->{cflags} || [],
);
};
if(my $error = $@)
{
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
}
my $test_exe = eval {
$cbuilder->link_executable(
objects => $test_object,
extra_linker_flags => $self->{libs} || [],
);
};
if(my $error = $@)
{
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
my %build_args;
my $installer = eval { Alien::Libarchive::Installer->system_install };
if($installer)
{
$build_args{extra_compiler_flags} = $installer->cflags,
$build_args{extra_linker_flags} = $installer->libs,
}
my $build = Module::Build->new(%build_args);
$build->create_build_script;
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
# reasonably assumes that build_install will never download
# a version older that 3.0
} || Alien::Libarchive::Installer->build_install("dir");
my $build = Module::Build->new(
extra_compiler_flags => $installer->cflags,
extra_linker_flags => $installer->libs,
);
$build->create_build_script;
FFI::Raw
lib/Alien/Libarchive/Installer.pm view on Meta::CPAN
Attributes of an L<Alien::Libarchive::Installer> provide the
information needed to use an existing libarchive (which may
either be provided by the system, or have just been built
using L<build_install|Alien::Libarchive::Installer#build_install>.
=head2 cflags
The compiler flags required to use libarchive.
=head2 libs
The linker flags and libraries required to use libarchive.
=head2 dlls
List of DLL or .so (or other dynamic library) files that can
be used by L<FFI::Raw> or similar.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Alien/LZO/Installer.pm view on Meta::CPAN
my %build_args;
my $installer = eval { Alien::LZO::Installer->system_install };
if($installer)
{
$build_args{extra_compiler_flags} = $installer->cflags,
$build_args{extra_linker_flags} = $installer->libs,
}
my $build = Module::Build->new(%build_args);
$build->create_build_script;
inc/Alien/LZO/Installer.pm view on Meta::CPAN
# reasonably assumes that build_install will never download
# a version older that 3.0
} || Alien::LZO::Installer->build_install("dir");
my $build = Module::Build->new(
extra_compiler_flags => $installer->cflags,
extra_linker_flags => $installer->libs,
);
$build->create_build_script;
FFI::Raw
inc/Alien/LZO/Installer.pm view on Meta::CPAN
if($options{alien} && eval q{ use Alien::LZO 0.01; 1 })
{
my $alien = Alien::LZO->new;
my $build = bless {
cflags => $alien->cflags,
libs => $alien->libs,
}, $class;
return $build if $options{test} =~ /^(compile|both)$/ && $build->test_compile_run;
return $build if $options{test} =~ /^(ffi|both)$/ && $build->test_compile_run;
}
my $build = bless {
cflags => [],
libs => ['-llzo2'],
}, $class;
$build->test_compile_run || die $build->error if $options{test} =~ /^(compile|both)$/;
$build->test_ffi || die $build->error if $options{test} =~ /^(ffi|both)$/;
inc/Alien/LZO/Installer.pm view on Meta::CPAN
}
};
}
my $build = bless {
cflags => ['-I' . _catdir($prefix, 'include')],
libs => ['-L' . _catdir($prefix, 'lib'), '-llzo2'],
prefix => $prefix,
dll_dir => [ 'dll' ],
dlls => do {
opendir(my $dh, _catdir($prefix, 'dll'));
inc/Alien/LZO/Installer.pm view on Meta::CPAN
Attributes of an L<Alien::LZO::Installer> provide the
information needed to use an existing lzo (which may
either be provided by the system, or have just been built
using L<build_install|Alien::LZO::Installer#build_install>.
=head2 cflags
The compiler flags required to use lzo.
=head2 libs
The linker flags and libraries required to use lzo.
=head2 dlls
List of DLL or .so (or other dynamic library) files that can
be used by L<FFI::Raw> or similar.
inc/Alien/LZO/Installer.pm view on Meta::CPAN
The version of lzo
=cut
sub cflags { shift->{cflags} }
sub libs { shift->{libs} }
sub version { shift->{version} }
sub dlls
{
inc/Alien/LZO/Installer.pm view on Meta::CPAN
};
my $test_object = eval {
$cbuilder->compile(
source => $fn,
extra_compiler_flags => $self->{cflags} || [],
);
};
if(my $error = $@)
{
inc/Alien/LZO/Installer.pm view on Meta::CPAN
}
my $test_exe = eval {
$cbuilder->link_executable(
objects => $test_object,
extra_linker_flags => $self->{libs} || [],
);
};
if(my $error = $@)
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Libarchive.pm view on Meta::CPAN
{
my($class) = @_;
bless {}, $class;
}
sub cflags
{
wantarray ## no critic (Community::Wantarray)
? shellwords(Alien::Libarchive3->cflags)
: Alien::Libarchive3->cflags;
}
sub libs
{
wantarray ## no critic (Community::Wantarray)
lib/Alien/Libarchive.pm view on Meta::CPAN
sub _macro_list
{
require Config;
my $cc = "$Config::Config{ccname} $Config::Config{ccflags} " . Alien::Libarchive3->cflags;
my $tempdir = Path::Tiny->tempdir;
my $file = path($tempdir, 'test.c');
$file->spew(
"#include <archive.h>\n#include <archive_entry.h>\n"
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Libbz2.pm view on Meta::CPAN
...
configure_requires => {
'Alien::Libbz2' => '0',
...
},
extra_compiler_flags => Alien::Libbz2->cflags,
extra_linker_flags => Alien::Libbz2->libs,
...
);
$build->create_build_script;
lib/Alien/Libbz2.pm view on Meta::CPAN
WriteMakefile(
...
CONFIGURE_REQUIRES => {
'Alien::Libbz2' => '0',
},
CCFLAGS => Alien::Libbz2->cflags . " $Config{ccflags}",
LIBS => [ Alien::Libbz2->libs ],
...
);
In your L<FFI::Platypus> script or module:
lib/Alien/Libbz2.pm view on Meta::CPAN
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
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Libgcrypt.pm view on Meta::CPAN
Alien::Libgcrypt - Download, configure, build and install libgcrypt.
=head1 SYNOPSIS
use Alien::Libgcrypt;
my $cflags = Alien::Libgcrypt->cflags;
...
=head1 SEE ALSO
L<Alien::Base>, L<Alien::Libssh2>.
view all matches for this distribution
view release on metacpan or search on metacpan
return $out
}
return;
}
sub alien_provides_cflags {
my $self = shift;
if ($self->use_installed_version) {
return $self->system_libgpg_error_config_get('cflags');
}
return;
}
sub alien_provides_libs {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Alien/Libjio.pm view on Meta::CPAN
return $self->{version};
}
sub ldflags {
my ($self) = @_;
Carp::croak('You must call this method as an object') unless ref($self);
# Return early if called in void context
return unless defined wantarray;
# If calling in array context, dereference and return
return @{ $self->{ldflags} } if wantarray;
return $self->{ldflags};
}
# Glob to create an alias to ldflags
*linker_flags = *ldflags;
sub cflags {
my ($self) = @_;
Carp::croak('You must call this method as an object') unless ref($self);
# Return early if called in void context
return unless defined wantarray;
# If calling in array context, dereference and return
return @{ $self->{cflags} } if wantarray;
return $self->{cflags};
}
*compiler_flags = *cflags;
sub method {
my ($self) = @_;
lib/Alien/Libjio.pm view on Meta::CPAN
}
sub _try_pkg_config {
my ($self) = @_;
my ($value, $err) = _get_pc('cflags');
return unless (defined $value && length $value);
#if (defined $err && length $err) {
# #warn "Problem with pkg-config; using ExtUtils::Liblist instead\n";
# return;
#}
$self->{installed} = 1;
$self->{method} = 'pkg-config';
# pkg-config returns things with a newline, so remember to remove it
$self->{cflags} = [ split(' ', $value) ];
$self->{ldflags} = [ split(' ', _get_pc('libs')) ];
$self->{version} = _get_pc('modversion');
return 1;
}
lib/Alien/Libjio.pm view on Meta::CPAN
my ($self) = @_;
use ExtUtils::Liblist ();
local $SIG{__WARN__} = sub { }; # mask warnings
my (undef, undef, $ldflags, $ldpath) = ExtUtils::Liblist->ext('-ljio');
return unless (defined($ldflags) && length($ldflags));
$self->{installed} = 1;
$self->{method} = 'ExtUtils::Liblist';
# Empty out cflags; initialize it
$self->{cflags} = [];
my $read;
my $pid = open3(undef, $read, undef, 'getconf', 'LFS_CFLAGS');
# We're using blocking wait, so the return value doesn't matter
lib/Alien/Libjio.pm view on Meta::CPAN
waitpid($pid, 0);
# Check the status code
if (($? >> 8) == 0) {
# This only takes the first line
push(@{ $self->{cflags} }, split(' ', <$read>));
}
else {
warn 'Problem using getconf: ', <$read>, "\n";
push(@{ $self->{cflags} },
'-D_LARGEFILE_SOURCE',
'-D_FILE_OFFSET_BITS=64',
);
}
# Used for resolving the include path, relative to lib
use Cwd ();
use File::Spec ();
push(@{ $self->{cflags} },
# The include path is taken as: $libpath/../include
'-I' . Cwd::realpath(File::Spec->catfile(
$ldpath,
File::Spec->updir(),
'include'
))
);
push(@{ $self->{ldflags} },
'-L' . $ldpath,
$ldflags,
);
return 1;
}
lib/Alien/Libjio.pm view on Meta::CPAN
=head1 SYNOPSIS
use Alien::Libjio;
my $jio = Alien::Libjio->new;
my $ldflags = $jio->ldflags;
my $cflags = $jio->cflags;
=head1 DESCRIPTION
To ensure reliability, some file systems and databases provide support for
something known as journalling. The idea is to ensure data consistency by
lib/Alien/Libjio.pm view on Meta::CPAN
Thankfully, Alberto Bertogli published a userspace C library called libjio
that can provide these features in a small (less than 1500 lines of code)
library with no external dependencies.
This package is designed to install it, and provide a way to get the flags
necessary to compile programs using it. It is particularly useful for Perl XS
programs that use it, such as B<IO::Journal>.
=head1 METHODS
=head2 Alien::Libjio->new
Creates a new C<Alien::Libjio> object, which essentially just has a few
convenience methods providing useful information like compiler and linker
flags.
Example code:
my $jio = Alien::Libjio->new();
lib/Alien/Libjio.pm view on Meta::CPAN
Example code:
my $version = $jio->version;
=head2 $jio->ldflags
=head2 $jio->linker_flags
This returns the flags required to link C code with the local installation of
libjio (typically in the LDFLAGS variable). It is particularly useful for
building and installing Perl XS modules such as L<IO::Journal>.
In scalar context, it returns an array reference suitable for passing to
other build systems, particularly L<Module::Build>. In list context, it gives
a normal array so that C<join> and friends will work as expected.
Example code:
my $ldflags = $jio->ldflags;
my @ldflags = @{ $jio->ldflags };
my $ldstring = join(' ', $jio->ldflags);
# or:
# my $ldflags = $jio->linker_flags;
=head2 $jio->cflags
=head2 $jio->compiler_flags
This method returns the compiler option flags to compile C code which uses
the libjio library (typically in the CFLAGS variable). It is particularly
useful for building and installing Perl XS modules such as L<IO::Journal>.
Example code:
my $cflags = $jio->cflags;
my @cflags = @{ $jio->cflags };
my $ccstring = join(' ', $jio->cflags);
# or:
# my $cflags = $jio->compiler_flags;
=head2 $jio->method
=head2 $jio->how
view all matches for this distribution
view release on metacpan or search on metacpan
t/librdkafka.t view on Meta::CPAN
use Alien::Librdkafka;
use version;
my $alien = Alien::Librdkafka->new;
ok defined( $alien->libs ), "libs directory defined";
ok defined( $alien->cflags ), "cflags defined";
subtest ffi => sub {
plan skip_all => 'test requires FFI::Platypus'
unless eval "use FFI::Platypus; 1;";
view all matches for this distribution
view release on metacpan or search on metacpan
my($build) = @_;
my $prefix = $build->runtime_prop->{prefix};
my @libs = grep /^[a-z]+\.lib$/, map { $_->basename } Path::Tiny->new('.')->child('lib')->children;
$build->runtime_prop->{$_} = "-I$prefix/include " for qw( cflags cflags_static );
$build->runtime_prop->{$_} = "-LIBPATH:$prefix/lib @libs " for qw( libs libs_static );
};
}
}
else
view all matches for this distribution
view release on metacpan or search on metacpan
my $prefix = $build->runtime_prop->{prefix};
my $include_path = File::Spec->catfile($prefix, qw(include));
my $lib_path = File::Spec->catfile($prefix, qw(lib));
my $cflags = "-I$include_path";
my @ldlibs = "-ltensorflow";
my $libs = join " ", "-L$lib_path", @ldlibs;
$build->runtime_prop->{cflags} = $cflags;
$build->runtime_prop->{libs} = $libs;
};
} else {
requires 'Alien::Bazel';
plugin 'Download::GitHub' => (
view all matches for this distribution
view release on metacpan or search on metacpan
doc = xmlReadFile("foo.xml", NULL, 0);
printf("xml version = '%s'\n", LIBXML_DOTTED_VERSION);
}
EOF
my @try_flags = (
{ cflags => '', libs => '-lxml2' },
{ cflags => '-I/usr/include/libxml2', libs => '-lxml2' },
{ cflags => '-I/usr/local/include/libxml2', libs => '-lxml2' },
);
plugin 'Probe::Vcpkg' => 'libxml2';
probe [
['xml2-config', '--version' => \'%{.install.my_version}'],
['xml2-config', '--cflags' => \'%{.install.my_cflags}'],
['xml2-config', '--libs' => \'%{.install.my_libs}'],
];
plugin 'PkgConfig' => 'libxml-2.0';
plugin 'Probe::CBuilder' => (
cflags => $_->{cflags},
libs => $_->{libs},
program => $test_program,
version => qr{xml version = '(.*?)'},
) for @try_flags;
plugin 'PkgConfig::MakeStatic' => ();
my %bad_versions = map { $_ => 1 } (
# known bad versions
# may have some extras, and may be incomplete.
plugin 'Gather::IsolateDynamic';
gather sub {
my($build) = @_;
my $prefix = $build->runtime_prop->{prefix};
$build->runtime_prop->{cflags} = "-I$prefix/include/libxml2";
$build->runtime_prop->{libs} = "-L$prefix/lib libxml2_a.lib";
};
}
else
{
gather_system => sub {
my($build) = @_;
return if defined $build->runtime_prop->{libs};
if($build->install_prop->{my_libs})
{
$build->runtime_prop->{$_} = $build->install_prop->{"my_$_"} for qw( version cflags libs );
}
},
);
};
view all matches for this distribution