require 5.006;
use ExtUtils::MakeMaker;

WriteMakefile(
   NAME => "Mozilla::CA",
   VERSION_FROM => "lib/Mozilla/CA.pm",
   ABSTRACT_FROM => "lib/Mozilla/CA.pm",
   AUTHOR => 'Gisle Aas <gisle@activestate.com>',
   LICENSE => 'mozilla_2_0',
   MIN_PERL_VERSION => 5.006,
   META_MERGE => {
       resources => {
	   repository => 'http://github.com/gisle/mozilla-ca',
       },
   },
   BUILD_REQUIRES => {
       Test => 0,
   },
);

BEGIN {
    # compatibility with older versions of MakeMaker
    my $developer = -d "eg";
    my %mm_req = (
        LICENCE => 6.31,
        META_MERGE => 6.45,
        META_ADD => 6.45,
        MIN_PERL_VERSION => 6.48,
        BUILD_REQUIRES => 6.56,
    );
    undef(*WriteMakefile);
    *WriteMakefile = sub {
        my %arg = @_;
        for (keys %mm_req) {
            unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
                warn "$_ $@" if $developer;
                delete $arg{$_};
            }
        }
        ExtUtils::MakeMaker::WriteMakefile(%arg);
    };
}

package MY;
sub MY::libscan {
    my $name = shift->SUPER::libscan(@_);
    # Remove private certificate bundle
    if ($name =~ /cacert.pem\z/) { $name = '' };
    return $name;
}
