use alienfile;

plugin 'Probe::Vcpkg' => 'librdkafka';
plugin 'PkgConfig' => (
  pkg_name        => 'rdkafka',
  minimum_version => '0.9.3',
);

share {
  start_url 'https://github.com/edenhill/librdkafka/archive/v1.3.0.tar.gz';
  plugin 'Download';
  plugin 'Extract' => 'tar.gz';
  plugin 'Build::Autoconf' => (
    with_pic => 0,
  );
  build [
    '%{configure}',
    '%{make}',
    '%{make} install',
  ];
  plugin 'Gather::IsolateDynamic';
};

if(meta->prop->{platform}->{compiler_type} eq 'microsoft')
{
  after gather => sub {
    my($build) = shift;
    $build->runtime_prop->{ffi_name} = 'rdkafka';
  };
}
