PkgConfig-LibPkgConf
view release on metacpan or search on metacpan
- Compatability with pkgconf 1.3.90
- Require pkgconf 1.3.90
0.07 2017-03-15 10:45:03 -0400
- Use correct CCFLAGS for Perl ABI (ppisar++ gh#5)
0.06 2017-03-02 17:43:40 -0500
- Update for 1.3.0 API
0.05 2017-01-31 08:25:00 -0500
- Expose pkgconf_path_relocate as PkgConfig::LibPkgConf::Util::path_relocate
0.04 2017-01-22 02:43:49 -0500
- Update XS to work with libpkgconf 1.2.0
- Requires libpkgconf 1.2.0
- No interface change
0.03 2017-01-18 08:32:50 -0500
- Fixed linker issues on FreeBSD
0.02 2017-01-03 11:24:13 -0500
LibPkgConf.xs view on Meta::CPAN
const char *
version()
CODE:
RETVAL = STRINGIZE_VALUE_OF(MY_PKGCONF_VERSION);
OUTPUT:
RETVAL
SV *
path_relocate(in)
const char *in;
INIT:
char out[PKGCONF_BUFSIZE];
bool ok;
CODE:
strncpy(out, in, PKGCONF_BUFSIZE-1);
ok = pkgconf_path_relocate(out, sizeof out);
RETVAL = newSVpv(ok ? out : in, 0);
OUTPUT:
RETVAL
MODULE = PkgConfig::LibPkgConf PACKAGE = PkgConfig::LibPkgConf::Test
IV
send_error(client, msg)
lib/PkgConfig/LibPkgConf/Util.pm view on Meta::CPAN
package PkgConfig::LibPkgConf::Util;
use strict;
use warnings;
use base qw( Exporter );
use PkgConfig::LibPkgConf::XS;
our $VERSION = '0.11';
our @EXPORT_OK = qw( argv_split compare_version path_sep path_relocate );
=head1 NAME
PkgConfig::LibPkgConf::Util - Non OO functions for PkgConfig::LibPkgConf
=head1 SYNOPSIS
use PkgConfig::LibPkgConf::Util qw( argv_split compare_version );
my @args = argv_split('-L/foo -lfoo'); # ('-L/foo', '-lfoo');
lib/PkgConfig/LibPkgConf/Util.pm view on Meta::CPAN
Splits a string into an argument list.
=head2 compare_version
my $cmp = compare_version($version1, $version2);
Compare versions using RPM version comparison rules as described in the LSB.
Returns -1 if the first version is greater, 0 if both versions are equal,
1 if the second version is greater.
=head2 path_relocate
my $path = path_relocate($path);
Relocates a path, possibly calling realpath() or cygwin_conv_path() on it.
=head2 path_sep
my $sep = path_sep;
Returns the path separator as understood by C<pkgconf>. This is usually
C<:> on UNIX and C<;> on Windows.
use strict;
use warnings;
use Test::More;
use File::Temp ();
use File::Path qw( mkpath );
use PkgConfig::LibPkgConf::Client;
use PkgConfig::LibPkgConf::Util qw( path_sep path_relocate );
use File::Basename qw( basename );
use Data::Dumper ();
sub _dump
{
Data::Dumper
->new([$_[0]], ['$x'])
->Terse(1)
->Sortkeys(1)
->Dump;
foo/include bar/include trans/include formers/include
);
subtest 'search path' => sub {
local $ENV{PKG_CONFIG_PATH} = join $sep, "$root/foo", "$root/bar";
local $ENV{PKG_CONFIG_LIBDIR} = join $sep, "$root/baz", "$root/ralph";
_is_deeply
[PkgConfig::LibPkgConf::Client->new->path],
[map { path_relocate "$root$_" } qw( /foo /bar /baz /ralph )];
_is_deeply
[PkgConfig::LibPkgConf::Client->new(path => join($sep, map { "$root$_" } qw( /trans /formers )))->path],
[map { path_relocate "$root$_" } qw( /trans /formers )];
_is_deeply
[PkgConfig::LibPkgConf::Client->new(path => [map { "$root$_" } qw( /trans /formers )])->path],
[map { path_relocate "$root$_" } qw( /trans /formers )];
};
subtest 'filter lib dirs' => sub {
local $ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} = join $sep, map { "$root$_" } '/foo/lib', '/bar/lib';
_is_deeply
[PkgConfig::LibPkgConf::Client->new->filter_lib_dirs],
[map { path_relocate "$root$_" } qw( /foo/lib /bar/lib )];
_is_deeply
[PkgConfig::LibPkgConf::Client->new(filter_lib_dirs => [map { "$root$_" } qw( /trans/lib /formers/lib )])->filter_lib_dirs],
[map { path_relocate "$root$_" } qw( /trans/lib /formers/lib )];
};
subtest 'filter include dirs' => sub {
local $ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} = join $sep, map { "$root$_" } '/foo/include', '/bar/include';
_is_deeply
[PkgConfig::LibPkgConf::Client->new->filter_include_dirs],
[map { path_relocate "$root$_" } qw( /foo/include /bar/include )];
_is_deeply
[PkgConfig::LibPkgConf::Client->new(filter_include_dirs => [map { "$root$_" } qw( /trans/include /formers/include )])->filter_include_dirs],
[map { path_relocate "$root$_" } qw( /trans/include /formers/include )];
};
};
subtest 'maxdepth' => sub {
is [PkgConfig::LibPkgConf::Client->new->maxdepth]->[0], 2000;
is [PkgConfig::LibPkgConf::Client->new(maxdepth => 22)->maxdepth]->[0], 22;
use strict;
use warnings;
use Test::More;
use PkgConfig::LibPkgConf::Util qw( argv_split compare_version path_sep path_relocate );
subtest 'argv_split' => sub {
is_deeply [argv_split("foo bar baz")], [qw( foo bar baz )];
};
subtest 'compare_version' => sub {
is compare_version('1.2.3', '1.2.3'), 0;
is compare_version('1.2.4', '1.2.3'), 1;
};
subtest 'path_sep' => sub {
like path_sep(), qr{^[;:]$};
};
subtest 'path_relocate' => sub {
require Cwd;
my $path = Cwd::getcwd();
$path = path_relocate $path;
ok $path, 'called path_relocate';
note "path = $path";
};
done_testing;
( run in 1.637 second using v1.01-cache-2.11-cpan-5511b514fd6 )