#!/usr/bin/perl # Check for Module::Build at the right version or use or own bundled one # if the available one does not fit. my $Minimal_MB = 0.34; my $Installed_MB = `$^X -e "eval q{require Module::Build; print Module::Build->VERSION} or exit 1"`; chomp $Installed_MB; $Installed_MB = 0 if $?; # Use our bundled copy of Module::Build if it's newer than the installed. unshift @INC, "inc/Module-Build" if $Minimal_MB > $Installed_MB; require Module::Build; use strict; use Data::Dumper; my %REQS = ( "JSON" => "2.12", "LWP::UserAgent" => 0, "URI" => "1.35", "Data::Dumper" => 0, "Getopt::Long" => 0, "Carp" => 0, "Module::Find" => 0, "Scalar::Util" => 0, "base" => 0, "Sys::SigAction" => 0, "IO::Socket::Multicast" => 0 # opt ); my %SCRIPTS = (); # Ask for various installation options: print < 0 # opt ); add_script("scripts/jmx4perl" => 1); } my $msg = < "0.37", # req "Text::ParseWords" => 0, # req "Time::HiRes" => 0, # req "Config::General" => "2.34",# req "Pod::Usage" => 0, # opt "Crypt::Blowfish_PP" => 0 # opt ); add_script("scripts/check_jmx4perl" => 1); } $msg = < "0.37", # req "Text::ParseWords" => 0, # req "Config::General" => "2.34",# req "Pod::Usage" => 0, # opt "Crypt::Blowfish_PP" => 0 # opt ); add_script("scripts/cacti_jmx4perl" => 1); } $msg = < 0, # req, GetOptionsFromArray must be exported "Term::ShellUI" => 0, # req "Term::Clui" => 0, # req "Term::Size" => "0.207", # opt "Config::General" => "2.34",# opt "File::SearchPath" => 0, # opt "Crypt::Blowfish_PP" => 0 # opt ); add_script("scripts/j4psh" => 1); # check for Term::ReadLine::Gnu my $has_gnu_readline = eval "require Term::ReadLine; require Term::ReadLine::Gnu; 1"; my $has_perl_readline = eval "require Term::ReadLine::Perl; 1"; if (!$has_gnu_readline) { $msg = < 0); } elsif (!$has_perl_readline) { add_reqs("Term::ReadLine::Perl" => 0, "Term::ReadKey" => 0); } } } $msg = < 0, # req "XML::LibXML" => 0, # req "File::Temp" => 0, # req "Digest::MD5" => 0, # opt "Digest::SHA1" => 0, # opt "XML::Twig" => 0, # opt "Term::ProgressBar" => 0 # opt ); add_script("scripts/jolokia" => 1); my $has_openpgp = eval "require Crypt::OpenPGP; 1"; if (!$has_openpgp) { my $check = `gpg --version`; if ($?) { $check = `gpg2 --version`; if ($?) { $msg = < 0); } } } } } # Add extra requirements sub add_reqs { my %to_add = @_; for my $k (keys %to_add) { $REQS{$k} = $to_add{$k}; } } sub add_script { my $script = shift; $SCRIPTS{$script} = 1; } sub y_n { Module::Build->y_n(@_); } # ================================================================================ my $build = Module::Build->new ( dist_name => "jmx4perl", dist_version_from => "lib/JMX/Jmx4Perl.pm", dist_author => 'Roland Huss (roland@cpan.org)', dist_abstract => 'Easy JMX access to Java EE applications', #sign => 1, installdirs => 'site', license => 'gpl', requires => \%REQS, script_files => \%SCRIPTS, build_requires => { "Module::Build" => "0.34", "Test::More" => "0", }, configure_requires => { 'Module::Build' => 0.34 }, keywords => [ "JMX", "JEE", "Management", "Nagios", "Java", "Jolokia", "OSGi", "Mule" ], ); $build->create_build_script; # ===================================================================================