Alien-Gnuplot-1.043/0000755000175000017500000000000014606553132014132 5ustar osboxesosboxesAlien-Gnuplot-1.043/META.json0000644000175000017500000000446214606553132015561 0ustar osboxesosboxes{ "abstract" : "Find and verify functionality of the gnuplot executable.", "author" : [ "Craig DeForest " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Alien-Gnuplot", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "Alien::Build" : "2.19", "Alien::Build::MM" : "0.32", "Env" : "0", "ExtUtils::MakeMaker" : "6.52", "File::Spec" : "0", "File::Temp" : "0", "File::Which" : "0", "HTTP::Tiny" : "0", "POSIX" : "0", "Time::HiRes" : "0", "version" : "0.77" } }, "configure" : { "requires" : { "Alien::Build" : "2.19", "Alien::Build::MM" : "0.32", "ExtUtils::MakeMaker" : "6.52" } }, "runtime" : { "requires" : { "Alien::Build" : "0.25", "Env" : "0", "File::Spec" : "0", "File::Temp" : "0", "File::Which" : "0", "HTTP::Tiny" : "0", "POSIX" : "0", "Time::HiRes" : "0", "perl" : "5.006000" } }, "test" : { "requires" : { "Test::Exception" : "0", "Test::More" : "0" } } }, "release_status" : "stable", "resources" : { "homepage" : "https://github.com/drzowie/Alien-Gnuplot", "repository" : { "type" : "git", "url" : "git://github.com/drzowie/Alien-Gnuplot.git" } }, "version" : "1.043", "x_alienfile" : { "generated_by" : "Alien::Build::MM version 2.38", "requires" : { "share" : { "Archive::Tar" : "0", "Config" : "0", "HTTP::Tiny" : "0.044", "IO::Socket::SSL" : "1.56", "IO::Zlib" : "0", "Net::SSLeay" : "1.49", "URI" : "0" }, "system" : {} } }, "x_serialization_backend" : "JSON::PP version 4.04" } Alien-Gnuplot-1.043/README.pod0000644000175000017500000001035614376535425015611 0ustar osboxesosboxes=head1 OVERVIEW Alien::Gnuplot is intended for distribution via CPAN. This repository stores the history for the Alien::Gnuplot module on CPAN. Install the module via CPAN. =cut =head1 NAME Alien::Gnuplot - Find and verify functionality of the gnuplot executable. =head1 SYNOPSIS package MyGnuplotter; use strict; use Alien::Gnuplot; $gnuplot = $Alien::Gnuplot::executable; `$gnuplot < /tmp/plotfile`; 1; =head1 DESCRIPTION Alien::Gnuplot verifies existence and sanity of the gnuplot external application. It only declares one access method, C, which does the actual work and is called automatically at load time. Alien::Gnuplot doesn't have any actual plotting methods - making use of gnuplot, once it is found and verified, is up to you or your client module. Using Alien::Gnuplot checks for existence of the executable, verifies that it runs properly, and sets several global variables to describe the properties of the gnuplot it found: =over 3 =item * C<$Alien::Gnuplot::executable> gets the path to the gnuplot executable. =item * C<$Alien::Gnuplot::version> gets the self-reported version number of the executable. =item * C<$Alien::Gnuplot::pl> gets the self-reported patch level. =item * C<@Alien::Gnuplot::terms> gets a list of the names of all supported terminal devices. =item * C<%Alien::Gnuplot::terms> gets a key for each supported terminal device; values are the 1-line description from gnuplot. This is useful for testing whether a particular terminal is supported. =item * C<@Alien::Gnuplot::colors> gets a list of the names of all named colors recognized by this gnuplot. =item * C<%Alien::Gnuplot::colors> gets a key for each named color; values are the C<#RRGGBB> form of the color. This is useful for decoding colors, or for checking whether a particular color name is recognized. All the color names are lowercase alphanumeric. =back You can point Alien::Gnuplot to a particular path for gnuplot, by setting the environment variable GNUPLOT_BINARY to the path. Otherwise your path will be searched (using File::Spec) for the executable file. If there is no executable application in your path or in the location pointed to by GNUPLOT_BINARY, then the module throws an exception. You can also verify that it has not completed successfully, by examining $Alien::Gnuplot::version, which is undefined in case of failure and contains the gnuplot version string on success. If you think the global state of the gnuplot executable may have changed, you can either reload the module or explicitly call C to force a fresh inspection of the executable. =head1 INSTALLATION STRATEGY When you install Alien::Gnuplot, it checks that gnuplot itself is installed as well. If it is not, then Alien::Gnuplot attempts to use one of several common package managers to install gnuplot for you. If it can't find one of those, if dies (and refuses to install), printing a friendly message about how to get gnuplot before throwing an error. In principle, gnuplot could be automagically downloaded and built, but it is distributed via Sourceforge -- which obfuscates interior links, making such tools surprisingly difficult to write. =head1 CROSS-PLATFORM BEHAVIOR On POSIX systems, including Linux and MacOS, Alien::Gnuplot uses fork/exec to invoke the gnuplot executable and asynchronously monitor it for hangs. Microsoft Windows process control is more difficult, so if $^O contains "MSWin32", a simpler system call is used, that is riskier -- it involves waiting for the unknown executable to complete. =head1 REPOSITORIES Gnuplot's main home page is at L. Alien::Gnuplot development is at L. A major client module for Alien::Gnuplot is PDL::Graphics::Gnuplot, which can be found at L. PDL is at L. =head1 AUTHOR Craig DeForest (with special thanks to Chris Marshall, Juergen Mueck, and Sisyphus for testing and debugging on the Microsoft platform) =head1 COPYRIGHT AND LICENSE Copyright (C) 2013 Craig DeForest This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Alien-Gnuplot-1.043/t/0000755000175000017500000000000014606553131014374 5ustar osboxesosboxesAlien-Gnuplot-1.043/t/03-env.t0000644000175000017500000000110414376535301015570 0ustar osboxesosboxes#=============================================================================== # # FILE: 03-env.t # # DESCRIPTION: Environment variable # # AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk # #=============================================================================== use strict; use warnings; use Alien::Gnuplot; use Test::More tests => 1; use Test::Exception; # Set the path to something non-existent $ENV{GNUPLOT_BINARY} = '/this/is/not/a/real/path'; throws_ok { Alien::Gnuplot->load_gnuplot } qr/no executable gnuplot found!/, 'Duff path fatality'; Alien-Gnuplot-1.043/t/02-version.t0000644000175000017500000000106714076415574016502 0ustar osboxesosboxes#=============================================================================== # # FILE: 02-version.t # # DESCRIPTION: Test of VERSION() sub # # AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk # #=============================================================================== use strict; use warnings; use Alien::Gnuplot; use Test::More tests => 2; use Test::Exception; lives_ok { Alien::Gnuplot->VERSION (0.1) } 'Installed version > 0,1'; throws_ok { Alien::Gnuplot->VERSION (99) } qr/You should upgrade gnuplot/, 'Installed version < 99'; Alien-Gnuplot-1.043/t/01-vars.t0000644000175000017500000000240414076415574015763 0ustar osboxesosboxes#=============================================================================== # # FILE: 01-vars.t # # DESCRIPTION: Check variables match intended formats # # AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk # #=============================================================================== use strict; use warnings; use Alien::Gnuplot; use Test::More tests => 12; my $exec = $Alien::Gnuplot::executable; ok (defined $exec, 'executable defined'); ok (length ($exec), 'executable path not empty'); my $version = $Alien::Gnuplot::version; ok (defined $version, 'version defined'); ok (length ($version), 'version not empty'); like ($version, qr/^[\d.]+$/, 'version looks like version string'); my $pl = $Alien::Gnuplot::pl; ok (defined $pl, 'patch level defined'); ok (length ($pl), 'patch level not empty'); like ($pl, qr/^\d+$/, 'patch level looks like patch level string'); my @terms = @Alien::Gnuplot::terms; ok (scalar @terms, 'terms not empty'); my %terms = %Alien::Gnuplot::terms; is (scalar @terms, scalar keys %terms, '%terms has correct number of entries'); my @hues = @Alien::Gnuplot::colors; ok (scalar @hues, 'colors not empty'); my %hues = %Alien::Gnuplot::colors; is (scalar @hues, scalar keys %hues, '%colors has correct number of entries'); Alien-Gnuplot-1.043/META.yml0000644000175000017500000000255514606553132015412 0ustar osboxesosboxes--- abstract: 'Find and verify functionality of the gnuplot executable.' author: - 'Craig DeForest ' build_requires: Alien::Build: '2.19' Alien::Build::MM: '0.32' Env: '0' ExtUtils::MakeMaker: '6.52' File::Spec: '0' File::Temp: '0' File::Which: '0' HTTP::Tiny: '0' POSIX: '0' Test::Exception: '0' Test::More: '0' Time::HiRes: '0' version: '0.77' configure_requires: Alien::Build: '2.19' Alien::Build::MM: '0.32' ExtUtils::MakeMaker: '6.52' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Alien-Gnuplot no_index: directory: - t - inc requires: Alien::Build: '0.25' Env: '0' File::Spec: '0' File::Temp: '0' File::Which: '0' HTTP::Tiny: '0' POSIX: '0' Time::HiRes: '0' perl: '5.006000' resources: homepage: https://github.com/drzowie/Alien-Gnuplot repository: git://github.com/drzowie/Alien-Gnuplot.git version: '1.043' x_alienfile: generated_by: 'Alien::Build::MM version 2.38' requires: share: Archive::Tar: '0' Config: '0' HTTP::Tiny: '0.044' IO::Socket::SSL: '1.56' IO::Zlib: '0' Net::SSLeay: '1.49' URI: '0' system: {} x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Alien-Gnuplot-1.043/Changes0000644000175000017500000000332214606553102015422 0ustar osboxesosboxes1.043 2024-04-13 - make any failure more verbose to help debugging 1.042 2023-03-30 - Update Gnuplot 5.4.6 URI for second release of Windows binaries. GH#13. 1.041 2023-03-12 - Minimum Alien::Build for Build::Copy plugin is Alien::Build v2.19. Thanks to Andreas K. Hüttel (akhuettel++) for the bug report. GH#11. 1.040 2023-02-23 - Switch to using Alien::Build / alienfile to check and install Gnuplot. - Alien::Gnuplot is now a subclass of Alien::Base. - Remove interactive installation option for using system package manager. The build now gives hints on what command to run instead. - Add check for broken Gnuplot pipe IPC on Windows for versions in the exclusive range ( 5.2.8, 5.4.6 ). See for more information. - Can now download then build Gnuplot from source on non-MSWin32 platforms and download then install the pre-built Gnuplot binaries on MSWin32. GH#2. - API change: load_gnuplot() is no longer called when loading the module with `require` or `do`. It is instead called by `import()`. This means that the usual `use Alien::Gnuplot;` should continue to work. 1.034 2021-07-23 - reset stdin position before exec - thanks @vividsnow 1.033 2017-02-24 - bumb version number again and fix MANIFEST problem 1.032 2017-02-23 - bump version number to get around a CPAN funny 1.031 2015-10-04 - slightly more tolerant logic on the terminfo parsing avoids a problem where some terminals were being ignored on some systems. 1.030 2013-11-13 - switch tempfile() call to no-arguments version, to ensure /tmp is used in POSIX systems 1.020 2013-10-28 - fixes to Microsoft Windows support Alien-Gnuplot-1.043/lib/0000755000175000017500000000000014606553131014677 5ustar osboxesosboxesAlien-Gnuplot-1.043/lib/Alien/0000755000175000017500000000000014606553131015727 5ustar osboxesosboxesAlien-Gnuplot-1.043/lib/Alien/Gnuplot.pm0000644000175000017500000002477314606553102017730 0ustar osboxesosboxes=head1 NAME Alien::Gnuplot - Find and verify functionality of the gnuplot executable. =head1 SYNOPSIS package MyGnuplotter; use strict; use Alien::Gnuplot; $gnuplot = $Alien::Gnuplot::executable; `$gnuplot < /tmp/plotfile`; 1; =head1 DESCRIPTION Alien::Gnuplot verifies existence and sanity of the gnuplot external application. It only declares one access method, C, which does the actual work and is called automatically at load time. Alien::Gnuplot doesn't have any actual plotting methods - making use of gnuplot, once it is found and verified, is up to you or your client module. Using Alien::Gnuplot checks for existence of the executable, verifies that it runs properly, and sets several global variables to describe the properties of the gnuplot it found: =over 3 =item * C<$Alien::Gnuplot::executable> gets the path to the gnuplot executable. =item * C<$Alien::Gnuplot::version> gets the self-reported version number of the executable. =item * C<$Alien::Gnuplot::pl> gets the self-reported patch level. =item * C<@Alien::Gnuplot::terms> gets a list of the names of all supported terminal devices. =item * C<%Alien::Gnuplot::terms> gets a key for each supported terminal device; values are the 1-line description from gnuplot. This is useful for testing whether a particular terminal is supported. =item * C<@Alien::Gnuplot::colors> gets a list of the names of all named colors recognized by this gnuplot. =item * C<%Alien::Gnuplot::colors> gets a key for each named color; values are the C<#RRGGBB> form of the color. This is useful for decoding colors, or for checking whether a particular color name is recognized. All the color names are lowercase alphanumeric. =back You can point Alien::Gnuplot to a particular path for gnuplot, by setting the environment variable GNUPLOT_BINARY to the path. Otherwise your path will be searched (using File::Spec) for the executable file. If there is no executable application in your path or in the location pointed to by GNUPLOT_BINARY, then the module throws an exception. You can also verify that it has not completed successfully, by examining $Alien::Gnuplot::version, which is undefined in case of failure and contains the gnuplot version string on success. If you think the global state of the gnuplot executable may have changed, you can either reload the module or explicitly call C to force a fresh inspection of the executable. =head1 INSTALLATION STRATEGY When you install Alien::Gnuplot, it checks that gnuplot itself is installed as well. If it is not, then Alien::Gnuplot attempts to use one of several common package managers to install gnuplot for you. If it can't find one of those, if dies (and refuses to install), printing a friendly message about how to get gnuplot before throwing an error. In principle, gnuplot could be automagically downloaded and built, but it is distributed via Sourceforge -- which obfuscates interior links, making such tools surprisingly difficult to write. =head1 CROSS-PLATFORM BEHAVIOR On POSIX systems, including Linux and MacOS, Alien::Gnuplot uses fork/exec to invoke the gnuplot executable and asynchronously monitor it for hangs. Microsoft Windows process control is more difficult, so if $^O contains "MSWin32", a simpler system call is used, that is riskier -- it involves waiting for the unknown executable to complete. =head1 REPOSITORIES Gnuplot's main home page is at L. Alien::Gnuplot development is at L. A major client module for Alien::Gnuplot is PDL::Graphics::Gnuplot, which can be found at L. PDL is at L. =head1 AUTHOR Craig DeForest (with special thanks to Chris Marshall, Juergen Mueck, and Sisyphus for testing and debugging on the Microsoft platform) =head1 COPYRIGHT AND LICENSE Copyright (C) 2013 Craig DeForest This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut package Alien::Gnuplot; use strict; our $DEBUG = 0; # set to 1 for some debugging output use parent qw( Alien::Base ); use File::Spec; use File::Temp qw/tempfile/; use File::Which; use Time::HiRes qw/usleep/; use POSIX ":sys_wait_h"; use Fcntl qw/SEEK_SET/; use Env qw( @PATH ); # VERSION here is for CPAN to parse -- it is the version of the module itself. But we # overload the system VERSION to compare a required version against gnuplot itself, rather # than against the module version. our $VERSION = '1.043'; # On install, try to make sure at least this version is present. our $GNUPLOT_RECOMMENDED_VERSION = '4.6'; our $executable; # Holds the path to the found gnuplot our $version; # Holds the found version number our $pl; # Holds the found patchlevel our @terms; our %terms; our @colors; our %colors; sub VERSION { my $module =shift; my $req_v = shift; # Need this line when using # # use Alien::Gnuplot 4.4; # # to check Gnuplot version. $module->load_gnuplot unless $version; # already have version unless($req_v <= $version) { die qq{ Alien::Gnuplot: Found gnuplot version $version, but you requested $req_v. You should upgrade gnuplot, either by reinstalling Alien::Gnuplot or getting it yourself from L. }; } } sub exe { ############################## # Search the path for the executable # my ($class) = @_; $class ||= __PACKAGE__; my $exec_path; # GNUPLOT_BINARY overrides at runtime if($ENV{'GNUPLOT_BINARY'}) { $exec_path = $ENV{'GNUPLOT_BINARY'}; } else { local $ENV{PATH} = $ENV{PATH}; unshift @PATH, $class->bin_dir; $exec_path = which("gnuplot"); } return $exec_path; } sub load_gnuplot { my ($class) = @_; $class ||= __PACKAGE__; my $exec_path = $class->exe; $class->check_gnuplot($exec_path); } sub check_gnuplot { my $exec_path = pop @_; unless(-x $exec_path) { die q{ Alien::Gnuplot: no executable gnuplot found! If you have gnuplot, you can put its exact location in your GNUPLOT_BINARY environment variable or make sure your PATH contains it. If you do not have gnuplot, you can reinstall Alien::Gnuplot (and its installation script will try to install gnuplot) or get it yourself from L. }; } ############################## # Execute the executable to make sure it's really gnuplot, and parse # out its reported version. This is complicated by gnuplot's shenanigans # with STDOUT and STDERR, so we fork and redirect everything to a file. # The parent process gives the daughter 2 seconds to report progress, then # kills it dead. my($pid); my ($undef, $file) = tempfile(); # Create command file open FOO, ">${file}_gzinta"; print FOO "show version\nset terminal\n\n\n\n\n\n\n\n\n\nprint \"CcColors\"\nshow colornames\n\n\n\n\n\n\n\nprint \"FfFinished\"\nexit\n"; close FOO; if($^O =~ /MSWin32/i) { if( $exec_path =~ m/([\"\*\?\<\>\|])/ ) { die "Alien::Gnuplot: Invalid character '$1' in path to gnuplot -- I give up" ; } # Microsoft Windows sucks at IPC (and many other things), so # use "system" instead of civilized fork/exec. # This leaves us vulnerable to gnuplot itself hanging, but # sidesteps the problem of waitpid hanging on Strawberry Perl. open FOO, ">&STDOUT"; open BAR, ">&STDERR"; open STDOUT,">$file"; open STDERR,">$file"; system(qq{"$exec_path" < ${file}_gzinta}); open STDOUT,">&FOO"; open STDERR,">&BAR"; close FOO; close BAR; } else { $pid = fork(); if(defined($pid)) { if(!$pid) { # daughter open BAR, ">&STDERR"; # preserve stderr eval { open STDOUT, ">$file"; open STDERR, ">&STDOUT"; open STDIN, "<${file}_gzinta"; seek STDIN, 0, SEEK_SET; no warnings; exec($exec_path); print BAR "Execution of $exec_path failed!\n"; exit(1); }; print STDERR "Alien::Gnuplot: Unknown problems spawning '$exec_path' to probe gnuplot.\n"; exit(2); # there was a problem! } else { # parent # Assume we're more POSIX-compliant... if($DEBUG) { print "waiting for pid $pid (up to 20 iterations of 100ms)"; flush STDOUT; } for (1..20) { if($DEBUG) { print "."; flush STDOUT; } if(waitpid($pid,WNOHANG)) { $pid=0; last; } usleep(1e5); } if($DEBUG) { print "\n"; flush STDOUT; } if($pid) { if( $DEBUG) { print "gnuplot didn't complete. Killing it dead...\n"; flush STDOUT; } kill 9,$pid; # zap waitpid($pid,0); # reap } } #end of parent case } else { # fork returned undef - error. die "Alien::Gnuplot: Couldn't fork to test gnuplot! ($@)\n"; } } ############################## # Read what gnuplot had to say, and clean up our mess... open FOO, "<$file"; my @lines = ; close FOO; unlink $file; unlink $file."_gzinta"; ############################## # Whew. Now parse out the 'GNUPLOT' and version number... my $lines = join("", map { chomp $_; $_} @lines); $lines =~ s/\s+G N U P L O T\s*// or die qq{ Alien::Gnuplot: the executable '$exec_path' appears not to be gnuplot, or perhaps there was a problem running it. You can remove it or set your GNUPLOT_BINARY variable to an actual gnuplot. Raw output from Gnuplot: $lines }; $lines =~ m/Version (\d+\.\d+) (patchlevel (\d+))?/ or die qq{ Alien::Gnuplot: the executable file $exec_path claims to be gnuplot, but I could not parse a version number from its output. Sorry, I give up. Raw output from Gnuplot: $lines }; $version = $1; $pl = $3; $executable = $exec_path; ############################## # Parse out available terminals and put them into the # global list and hash. @terms = (); %terms = (); my $reading_terms = 0; for my $line(@lines) { last if($line =~ m/CcColors/); if(!$reading_terms) { if($line =~ m/^Available terminal types\:/) { $reading_terms = 1; } } else { $line =~ s/^Press return for more\:\s*//; $line =~ m/^\s*(\w+)\s(.*[^\s])\s*$/ || next; push(@terms, $1); $terms{$1} = $2; } } ############################## # Parse out available colors and put them into that global list and hash. @colors = (); %colors = (); for my $line(@lines) { last if($line =~ m/FfFinished/); next unless( $line =~ m/\s+([\w\-0-9]+)\s+(\#......)/); $colors{$1} = $2; } @colors = sort keys %colors; } sub import { my $pkg = shift; $pkg->SUPER::import(@_); $pkg->load_gnuplot(); }; 1; Alien-Gnuplot-1.043/MANIFEST0000644000175000017500000000045214606553132015264 0ustar osboxesosboxesChanges lib/Alien/Gnuplot.pm alienfile Makefile.PL MANIFEST This list of files README.pod t/01-vars.t t/02-version.t t/03-env.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Alien-Gnuplot-1.043/Makefile.PL0000644000175000017500000000561114403460057016105 0ustar osboxesosboxesuse strict; use ExtUtils::MakeMaker; use Alien::Build::MM; sub MY::libscan { package MY; my ($self, $file) = @_; # Don't install the README.pod or any .pl file return undef if $file =~ /\.pl$|^README.pod/; return $self->SUPER::libscan ($file); } ######################################## ######################################## # reroute the main POD into a separate README.pod if requested. This is here # purely to generate a README.pod for the github front page my $POD_header = <README.pod' or die "Couldn't open README.pod"; print README $POD_header; while () { if (/^=/../^=cut/) { print README; } } } ############################## ############################## ## Write a generic Makefile that puts the module in place. Include a postamble ## that will also make the source code, if necessary. my $abmm = Alien::Build::MM->new; my %configure_and_build_prereqs = ( "Alien::Build" => "2.19", "Alien::Build::MM" => "0.32", "ExtUtils::MakeMaker" => "6.52", ); ## Shared build and runtime prereqs because the `alienfile` calls into ## `lib/Alien/Gnuplot.pm`. my %build_and_runtime_prereqs = ( 'Time::HiRes' => 0, 'File::Temp' => 0, 'HTTP::Tiny' => 0, 'POSIX' => 0, 'Env' => 0, 'File::Spec' => 0, 'File::Which' => 0, ); WriteMakefile($abmm->mm_args( NAME => 'Alien::Gnuplot', AUTHOR => 'Craig DeForest ', DISTNAME => 'Alien-Gnuplot', VERSION_FROM => 'lib/Alien/Gnuplot.pm', ABSTRACT_FROM => 'lib/Alien/Gnuplot.pm', ($ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE'=> 'perl') : ()), ($ExtUtils::MakeMaker::VERSION >= 6.48 ? ('MIN_PERL_VERSION' => '5.6.0') : ()), PREREQ_PM => { %build_and_runtime_prereqs, }, BUILD_REQUIRES => { 'version' => '0.77', %configure_and_build_prereqs, %build_and_runtime_prereqs, }, CONFIGURE_REQUIRES => { %configure_and_build_prereqs, }, META_ADD => { resources => { homepage => 'https://github.com/drzowie/Alien-Gnuplot', repository => 'git://github.com/drzowie/Alien-Gnuplot.git', bugtracker => 'craig@deforest.org' } }, TEST_REQUIRES => { 'Test::More' => 0, 'Test::Exception' => 0 }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Alien-Gnuplot-* src/*[0-9]' }, )); sub MY::postamble { $abmm->mm_postamble(@_); } sub MY::install { $abmm->mm_install(@_); } Alien-Gnuplot-1.043/alienfile0000644000175000017500000001120214411222527015774 0ustar osboxesosboxesuse alienfile; use File::Which; use version 0.77; for my $gnuplot ( ( $ENV{'GNUPLOT_BINARY'} ? $ENV{'GNUPLOT_BINARY'} : () ), 'gnuplot' ) { plugin 'Probe::CommandLine' => ( command => $gnuplot, args => [ '--version' ], match => qr/^gnuplot ([0-9\.]+ patchlevel [0-9]+)/, version => qr/^gnuplot ([0-9\.]+ patchlevel [0-9]+)/, ); } meta->around_hook( probe => sub { my $orig = shift; my $build = shift; eval { unshift @INC, '../../lib', 'lib'; require Alien::Gnuplot; }; my $install_type = $orig->($build, @_); $build->log("Checking @{[ $build->runtime_prop->{command} ]}"); eval { Alien::Gnuplot->check_gnuplot( map { -f $_ ? $_ : which($_) } $build->runtime_prop->{command} ); 1; } or do { $build->log($@); return 'share'; }; # Fix up the version from output to include the patchlevel as a dotted # version component. if( exists $build->runtime_prop->{version} ) { $build->runtime_prop->{version} =~ s/^([0-9\.]+) patchlevel ([0-9]+)$/$1.$2/; } # Check against minimum version. my $got_version = version->parse($build->runtime_prop->{version}); if( version->parse($Alien::Gnuplot::GNUPLOT_RECOMMENDED_VERSION) > $got_version ) { $build->log(<runtime_prop->{version} ]}. The minimum recommended version is $Alien::Gnuplot::GNUPLOT_RECOMMENDED_VERSION. EOF return 'share'; } else { $build->log(<parse($_), ( '5.2.8', '5.4.6' ); if( $^O eq 'MSWin32' && $exclusive_range[0] < $got_version && $got_version < $exclusive_range[1] ) { $build->log(< for more information. EOF return 'share'; } } return $install_type; }); # 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(<[3] && ! which( $manager->[1] ); $build->log(<[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; } }