Alien-libavro_c

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

use alienfile;
use strict;
use Config;
use Env qw/@PKG_CONFIG_PATH/;
use Text::ParseWords qw(shellwords);
use File::Spec;

sub update_pkg_conf_path {
    eval {
        require Alien::libjansson;
        require Alien::libsnappy;
        1;
    } or do {
        # ignored
    };
    # avro-c.pc has jansson as a dependency, so it won't be loaded
    # *at all* unless we have jansson.pc in the PKG_CONFIG_PATH
    # somewhere.  And if libjansson is coming from Alien::libjansson,
    # we MUST set this up here, otherwise the PkgConfig plugin
    # will never be able to use avro-c.pc
    require File::Spec;

    push @PKG_CONFIG_PATH,
        map File::Spec->catdir($_->dist_dir,  'lib', 'pkgconfig'),
        grep $_->install_type eq 'share',
        grep $_->can('install_type'),
        qw/
            Alien::libsnappy
            Alien::libjansson
        /,
    ;
    return;
}

# POS
update_pkg_conf_path();

sys {
# And then try with Probe::CBuilder:
plugin 'Probe::CBuilder' => (
  libs    => '-lavro',
  program => q{
#include <stdio.h>
#include <avro.h>
#include <avro/errors.h>

int main() {
    avro_schema_t schema = avro_schema_string();
    if ( schema == NULL ) {
        printf("ERROR: %s\n", avro_strerror());
    }
    else {
        printf("Success!\n");
    }
    return 0;
}
},
);
};

# Try probing with pkg-config, but at least on
# OSX the provided avro-c.pc file has some broken
# entries, so this always fails:
plugin 'PkgConfig' => (
    pkg_name        => 'avro-c',
);

share {



( run in 0.474 second using v1.01-cache-2.11-cpan-56fb94df46f )