Alien-ProtoBuf

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Alien-ProtoBuf

0.09      2019-09-11 20:46:38 CEST

    - Compilation fix for Perl 5.8

0.08      2018-11-10 22:37:30 CET

    - Add cxxflags method, to support protobuf 3.6

0.07      2018-07-22 14:12:42 CEST

    - Tweak build for FreeBSD

0.06      2017-07-18 13:37:06 CEST

    - Add dependency from Alien::Base

0.05      2016-03-10 21:27:41 CET

inc/AP/Build.pm  view on Meta::CPAN


    if (!$self->alien_check_installed_version) {
        # this should get us an "NA"
        warn "Could not find an installed protobuf library";
        exit 0;
    }

    return $self;
}

sub alien_provides_cflags {
    my $self = shift;
    my $cflags = $self->SUPER::alien_provides_cflags || '';
    if ($^O eq 'freebsd' && $cflags !~ m{/usr/local/include}) {
        $cflags = "$cflags -I/usr/local/include";
    }
    return $cflags;
}

sub ACTION_alien_code {
    my $self = shift;
    $self->SUPER::ACTION_alien_code();
    my $system_provides = scalar $self->config_data('system_provides');

    my $version = $self->alien_check_installed_version;
    my ($major, $minor) = split /\./, $version;
    if ($major > 3 || ($major == 3 && $minor >= 6)) {
        if (!ExtUtils::CppGuess->new->is_msvc) {
            $system_provides->{'C++flags'} = "-std=c++11";
        }
    }
}

1;

lib/Alien/ProtoBuf.pm  view on Meta::CPAN

package Alien::ProtoBuf;
# ABSTRACT: find Google ProtoBuf library

use strict;
use warnings;
use parent 'Alien::Base';

our $VERSION = '0.09'; # VERSION

sub cxxflags {
    return $_[0]->config('system_provides')->{'C++flags'} || '';
}

1;

__END__

=pod

=encoding UTF-8

lib/Alien/ProtoBuf.pm  view on Meta::CPAN

Alien::ProtoBuf - find Google ProtoBuf library

=head1 VERSION

version 0.09

=head1 SYNOPSIS

    use Alien::ProtoBuf;

    my $cflags = Alien::ProtoBuf->cflags;
    my $libs = Alien::ProtoBuf->libs;

    # use $cflags and $libs to compile a program using protocol buffers

=head1 AUTHOR

Mattia Barbon <mattia@barbon.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Mattia Barbon.

This is free software; you can redistribute it and/or modify it under

t/010_found_library.t  view on Meta::CPAN

#!/usr/bin/perl

use Test::More tests => 2;
use Alien::ProtoBuf;

Alien::ProtoBuf->cflags;
Alien::ProtoBuf->libs;
ok(1, 'survived');

ok(Alien::ProtoBuf->libs, 'we got some libs');



( run in 0.264 second using v1.01-cache-2.11-cpan-94b05bcf43c )