Alien-LibreSSL

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

    "-L$libdir -lcrypto -lssl",
  );

  meta->after_hook(gather_system => sub {
    my $build = shift;
    if($build->runtime_prop->{version} =~ /^(open|libre)ssl (\S+)/i)
    {
      $build->runtime_prop->{version} = $2;
    }
  });
}
else
{
  plugin 'PkgConfig' => 'openssl';
}

share {

  start_url 'https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/';
  plugin Download => (
    version       => qr/^libressl-([0-9\.]+)\.tar\.gz$/,
    bootstrap_ssl => 1,
  );

  unless(meta->has_hook('fetch'))
  {
    my $ftp_ok = $ENV{ALIEN_OPENSSL_FTP};
    $ftp_ok = 1 unless defined $ftp_ok;
    if($ftp_ok)
    {
      log(" ************************************************* ");
      log(" *  WARNING downloading LibreSSL via HTTP        * ");
      log(" ************************************************* ");
      start_url 'http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/';
      plugin 'Fetch::HTTPTiny';
    }
    else
    {
      log("Unable to download LibreSSL via https without OpenSSL!");
      log("Recommend installing wget or curl to bootstrap Alien::LibreSSL");
      die "unable to download LibreSSL via https";
    }
  }

  plugin Extract => 'tar.gz';

  meta->prop->{out_of_source} = 1;

  if($^O eq 'MSWin32')
  {
    plugin 'Build::CMake';

    if(meta->prop->{platform}->{compiler_type} eq 'microsoft')
    {
      gather sub {
        my($build) = @_;
        my $prefix = $build->runtime_prop->{prefix};

        my @libs = grep /^[a-z]+\.lib$/, map { $_->basename } Path::Tiny->new('.')->child('lib')->children;
        
        $build->runtime_prop->{$_} = "-I$prefix/include " for qw( cflags cflags_static );
        $build->runtime_prop->{$_} = "-LIBPATH:$prefix/lib @libs " for qw( libs libs_static );
      };
    }
  }
  else
  {
    plugin 'Build::Autoconf';

    if($^O eq 'darwin')
    {
      build [
        '%{configure} --enable-shared --enable-static',
        '%{make}',
        '%{make} install',
      ];

      plugin 'Gather::IsolateDynamic';
    }
  }
}



( run in 0.611 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )