use alienfile;

plugin 'PkgConfig' => (
    pkg_name => 'libuv',
    minimum_version => '1.0.0',
);

share {
  # note on apple weirdisms: https://github.com/joyent/libuv/issues/1200
  meta->prop->{env}->{LIBTOOLIZE} = 'libtoolize' if $^O eq 'darwin';

  requires 'Alien::autoconf' => '0.03';
  requires 'Alien::automake' => '0.05';
  requires 'Alien::libtool'  => '0.04';
  requires 'Alien::m4'       => '0.11';

  plugin Download => (
    url     => 'http://dist.libuv.org/dist/v1.12.0',
    version => qr/^libuv-v([0-9\.]+)\.tar\.gz$/,
  );

  plugin Extract => 'tar.gz';

  plugin 'Build::Autoconf' => ();

  build [
    'sh autogen.sh',
    '%{configure}',
    '%{make}',
    '%{make} test',
    '%{make} install',
  ];

  plugin 'Gather::IsolateDynamic' => ();
};