name    = IP-Geolocation-MMDB
version = 1.013
author  = Andreas Vögele <voegelas@cpan.org>
license = Perl_5
copyright_holder = Andreas Vögele

[@Filter]
-bundle = @Basic
-remove = GatherDir
-remove = MakeMaker
-remove = Readme

[MetaResources]
homepage        = https://github.com/voegelas/IP-Geolocation-MMDB/wiki
bugtracker.web  = https://github.com/voegelas/IP-Geolocation-MMDB/issues
repository.url  = https://github.com/voegelas/IP-Geolocation-MMDB.git
repository.web  = https://github.com/voegelas/IP-Geolocation-MMDB
repository.type = git

[CPANFile]

[GatherDir]
exclude_filename = cpanfile
exclude_filename = LICENSE
exclude_filename = Makefile.PL
exclude_filename = META.json

[CopyFilesFromBuild]
copy = cpanfile
copy = LICENSE
copy = Makefile.PL
copy = META.json

[MetaProvides::Package]

[MetaJSON]

[PodCoverageTests]

[PodSyntaxTests]

[MakeMaker::Awesome]
min_perl_version = 5.014

delimiter = |

header = use Config;
header = use File::Spec::Functions qw(devnull);
header = use Math::BigInt;

header = my @defines;
header = my $byteorder = $Config{byteorder};
header = if (!defined $byteorder) {
header = | warn "\$Config{byteorder} is undefined";
header = | die "OS unsupported\n";
header = }
header = if ($byteorder == 4321 || $byteorder == 87654321) {
header = | push @defines, '-DWORDS_BIGENDIAN';
header = }
header = elsif (!($byteorder == 1234 || $byteorder == 12345678)) {
header = | warn "Unknown byte order: $byteorder\n";
header = | die "OS unsupported\n";
header = }

header = my $ccflags = '';
header = my $libs = '';
header = my $version;
header = if (eval { require Alien::libmaxminddb }) {
header = | $ccflags = Alien::libmaxminddb->cflags;
header = | $libs = Alien::libmaxminddb->libs;
header = | $version = Alien::libmaxminddb->version;
header = }
header = else {
header = | my $devnull = devnull();
header = | for my $pkgconf (qw(pkgconf pkg-config)) {
header = |  my $output = `$pkgconf --version 2>$devnull`;
header = |  if ($? == 0) {
header = |   $ccflags = `$pkgconf --cflags libmaxminddb 2>$devnull`;
header = |   last if $? != 0;
header = |   $libs = `$pkgconf --libs libmaxminddb 2>$devnull`;
header = |   last if $? != 0;
header = |   $version = `$pkgconf --modversion libmaxminddb 2>$devnull`;
header = |   last if $? != 0;
header = |   chomp($ccflags, $libs, $version);
header = |   last;
header = |  }
header = | }
header = }

header = if ($^O eq 'MSWin32' && $^V < 5.034) {
header = | # Amend the library search path
header = | my $libdir = 'C:\strawberry\c\x86_64-w64-mingw32\lib';
header = | if (-d $libdir) {
header = |  $libs = "-L$libdir $libs";
header = | }
header = }

WriteMakefile_arg = CCFLAGS => join(q{ }, $ccflags, $Config{ccflags})
WriteMakefile_arg = LIBS => [ $libs ]
WriteMakefile_arg = DEFINE => join(q{ }, @defines)

footer = package MY;

footer = # Bail out if something is wrong
footer = sub post_initialize {
footer = | my $text = '';
footer = | if (!defined $version) {
footer = |  $text = <<'TEXT';
footer = |.PHONY: die
footer = |die :
footer = |	$(NOECHO) $(ECHO) "Error: libmaxminddb not found"
footer = |	$(NOECHO) $(ECHO) "OS unsupported"
footer = |	$(FALSE)
footer = |TEXT
footer = | }
footer = | elsif ($version =~ m{^(0|1\.[01])\.}) {
footer = |  $text = <<'TEXT';
footer = |.PHONY: die
footer = |die :
footer = |	$(NOECHO) $(ECHO) "Error: libmaxminddb is too old"
footer = |	$(NOECHO) $(ECHO) "OS unsupported"
footer = |	$(FALSE)
footer = |TEXT
footer = | }
footer = | elsif (!eval { Math::BigInt->from_bytes(pack 'C6', 0xff, 0xff, 0xb0, 0x09, 0x00, 0x00)->as_hex eq '0xffffb0090000' }) {
footer = |  # Some Math::BigInt versions fail on i386 if Perl is built with -Dusequadmath.
footer = |  $text = <<'TEXT';
footer = |.PHONY: die
footer = |die :
footer = |	$(NOECHO) $(ECHO) "Error: Math::BigInt is too old or broken"
footer = |	$(NOECHO) $(ECHO) "OS unsupported"
footer = |	$(FALSE)
footer = |TEXT
footer = | }
footer = | return $text;
footer = }

footer = sub const_loadlibs {
footer = | my $text = shift->SUPER::const_loadlibs(@_);
footer = | if ($^O eq 'MSWin32' && $^V < 5.034) {
footer = |  # Ignore unneeded libraries, which may contain invalid symbols
footer = |  my $filter = sub {
footer = |   my $list = shift;
footer = |   my $pattern = $list =~ m{"} ? qr{(?<=")\h+(?=")} : qr{\h+};
footer = |   join q{ }, grep { m{ maxminddb | ws2_32 }x } split $pattern, $list;
footer = |  };
footer = |  $text =~ s{
footer = |   ^ ( (?: EXTRA | LDLOAD ) LIBS ) \h* = \h* (.*?) \h* $
footer = |  }
footer = |  {sprintf '%s = %s', $1, $filter->($2)}egxm;
footer = | }
footer = | return $text;
footer = }

footer = sub const_config {
footer = | my $text = shift->SUPER::const_config(@_);
footer = | # Some BSDs prepend -L/usr/local/lib, which may contain an old library
footer = | # version, to the library search path
footer = | $text =~ s{
footer = |  ^ ( LD(?:DL)?FLAGS \h* = .*? ) -L/usr/local/lib ( $ | \h+ (.*) $ )
footer = | }
footer = | {$1$2}gxm;
footer = | return $text;
footer = }

[Test::Kwalitee]

[Encoding]
encoding = bytes
match    = ^t/data/

[AutoPrereqs]

[Prereqs / ConfigureRequires]
Alien::libmaxminddb = 0
Math::BigInt = 1.999806

[Prereqs / BuildRequires]
Alien::libmaxminddb = 0
Math::BigInt = 1.999806

[Prereqs / DevelopRequires]
Dist::Zilla = 0
Dist::Zilla::Plugin::CopyFilesFromBuild = 0
Dist::Zilla::Plugin::MakeMaker::Awesome = 0.27
Dist::Zilla::Plugin::MetaProvides::Package = 0
Dist::Zilla::Plugin::Test::Kwalitee = 0