use strict;
use warnings;
use alienfile;
 
my $on_windows = $^O eq 'MSWin32';

plugin 'Probe::CommandLine' => (
  command => 'patchelf',
);
 
share {

  Alien::Build->log ('$ENV{ALIEN_BUILD_PRELOAD} = ' . ($ENV{ALIEN_BUILD_PRELOAD} // ''));

  meta->prop->{start_url} = 'https://github.com/NixOS/patchelf.git';
  plugin 'Download::Git' =>(
    filter  => qr/^([0-9\.]+)$/,
    version => qr/^([0-9\.]+)$/,
  );

  requires 'Alien::Autotools';
  plugin 'Build::Autoconf';
  if ($on_windows) {
    plugin 'Build::MSYS';
  }
  if ($^O =~ /solaris/i) {
    plugin 'Build::Make' => 'gmake';
  }
  build [
    'sh ./bootstrap.sh',  #  windows needs explicit shell call
    '%{configure}',
    '%{make}',
    '%{make} install',
  ];
};
