Alien-Gnuplot
view release on metacpan or search on metacpan
# Separate hook after the above to give hints about installation to the system.
meta->around_hook( probe => sub {
my $orig = shift;
my $build = shift;
my $install_type = $orig->($build, @_);
# Map[ $^O, Tuple[ Name, Command, InstallCommand, Maybe[URL] ] ]
#
# NOTE: If the URL is defined, this is a self-installed package manager
# (i.e., for systems that do not come with a standard package manager), so
# print out its information regardless of whether it is installed.
my %os_installers = (
darwin => [
['MacPorts','port', 'port install gnuplot', 'https://www.macports.org/'],
['Fink' ,'fink', 'fink install gnuplot', 'https://www.finkproject.org/'],
['Homebrew','brew', 'brew install gnuplot', 'https://brew.sh/'],
],
linux => [
[ 'YUM', 'yum' , 'yum install gnuplot' , undef ],
[ 'APT', 'apt-get', 'apt-get install gnuplot', undef ],
],
MSWin32 => [
['Chocolatey', 'choco', 'choco install gnuplot', 'https://chocolatey.org/' ],
],
);
if( $install_type eq 'share' and exists $os_installers{$^O} ) {
$build->log(<<EOF);
Gnuplot seems to not exist on your system. You can use the following package
manager(s) to install Gnuplot to your system.
EOF
for my $manager (@{ $os_installers{$^O} }) {
next if ! defined $manager->[3] && ! which( $manager->[1] );
$build->log(<<EOF);
- $manager->[0]@{[ defined $manager->[3] ? " (available at <$manager->[3]>)" : "" ]}:
\$ $manager->[2]
EOF
}
}
return $install_type;
});
sub do_binary_release_mswin32 {
requires 'Alien::7zip' => '0.03';
requires 'Alien::Build::CommandSequence';
start_url 'https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.6/gp546-win64-mingw-2.7z/download';
plugin 'Download';
extract [ '%{sevenzip} x %{.install.download}' ];
plugin 'Build::Copy';
gather sub {
my ($build) = @_;
$build->runtime_prop->{'style'} = 'binary';
};
}
sub do_source_release {
start_url 'https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.6/gnuplot-5.4.6.tar.gz/download';
plugin 'Download';
plugin 'Extract' => 'tar.gz';
plugin 'Build::Autoconf';
build [
'%{configure}',
'%{make}',
'%{make} install',
];
gather sub {
my ($build) = @_;
$build->runtime_prop->{'style'} = 'source';
};
}
share {
if( $^O eq 'MSWin32' ) {
do_binary_release_mswin32;
} else {
do_source_release;
}
}
( run in 0.565 second using v1.01-cache-2.11-cpan-e1769b4cff6 )