Replace Build.PL with a custom script based off cpanm
This commit is contained in:
parent
4774b0e910
commit
c88d8a5842
101
Build.PL
101
Build.PL
@ -1,44 +1,67 @@
|
|||||||
use Module::Build;
|
#!/usr/bin/perl
|
||||||
|
|
||||||
my $build = Module::Build->new(
|
use strict;
|
||||||
module_name => 'Slic3r',
|
use warnings;
|
||||||
dist_abstract => 'G-code generator for 3D printers',
|
|
||||||
dist_author => 'Alessandro Ranellucci <aar@cpan.org>',
|
use Config;
|
||||||
dist_version => '0.1',
|
use File::Spec;
|
||||||
license => 'perl',
|
|
||||||
requires => {
|
my %prereqs = qw(
|
||||||
'Boost::Geometry::Utils' => '0.15',
|
Boost::Geometry::Utils 0.15
|
||||||
'Encode::Locale' => '0',
|
Encode::Locale 0
|
||||||
'File::Basename' => '0',
|
File::Basename 0
|
||||||
'File::Spec' => '0',
|
File::Spec 0
|
||||||
'Getopt::Long' => '0',
|
Getopt::Long 0
|
||||||
'Math::Clipper' => '1.22',
|
Math::Clipper 1.22
|
||||||
'Math::ConvexHull::MonotoneChain' => '0.01',
|
Math::ConvexHull::MonotoneChain 0.01
|
||||||
'Math::Geometry::Voronoi' => '1.3',
|
Math::Geometry::Voronoi 1.3
|
||||||
'Math::PlanePath' => '53',
|
Math::PlanePath 53
|
||||||
'Moo' => '0.091009',
|
Moo 0.091009
|
||||||
'perl' => '5.10.0',
|
Scalar::Util 0
|
||||||
'Scalar::Util' => '0',
|
Storable 0
|
||||||
'Storable' => '0',
|
Test::More 0
|
||||||
'Time::HiRes' => '0',
|
IO::Scalar 0
|
||||||
},
|
Time::HiRes 0
|
||||||
build_requires => {
|
);
|
||||||
'Test::More' => '0.10',
|
my %recommends = qw(
|
||||||
'IO::Scalar' => '0.10',
|
Class::XSAccessor 0
|
||||||
},
|
Growl::GNTP 0.15
|
||||||
recommends => {
|
XML::SAX::ExpatXS 0
|
||||||
'Class::XSAccessor' => '0',
|
Wx 0.9901
|
||||||
'Growl::GNTP' => '0.15',
|
|
||||||
'XML::SAX::ExpatXS' => '0',
|
|
||||||
'Wx' => '0.9901',
|
|
||||||
},
|
|
||||||
script_files => ['slic3r.pl'],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (not $ENV{SLIC3R_NO_AUTO})
|
my $cpanm;
|
||||||
{
|
if (defined $ENV{CPANM} && -x $ENV{CPANM}) {
|
||||||
$build->dispatch('installdeps');
|
$cpanm = $ENV{CPANM};
|
||||||
$build->dispatch('test', verbose => 0);
|
} elsif (-x (my $c = File::Spec->catfile($Config{installscript}, 'cpanm'))) {
|
||||||
|
$cpanm = $c;
|
||||||
|
} elsif ($^O = /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
|
||||||
|
$cpanm = 'cpanm';
|
||||||
|
}
|
||||||
|
die <<'EOF'
|
||||||
|
cpanm was not found. Please install it before running this script.
|
||||||
|
|
||||||
|
There are several ways to install cpanm, try one of these:
|
||||||
|
|
||||||
|
apt-get install cpanminus
|
||||||
|
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
|
||||||
|
cpan App::cpanminus
|
||||||
|
|
||||||
|
If it is installed in a non-standard location you can do:
|
||||||
|
|
||||||
|
CPANM=/path/to/cpanm perl Build.PL
|
||||||
|
|
||||||
|
EOF
|
||||||
|
if !$cpanm;
|
||||||
|
|
||||||
|
my %modules = (%prereqs, %recommends);
|
||||||
|
foreach my $module (sort keys %modules) {
|
||||||
|
my $version = $modules{$module};
|
||||||
|
system $cpanm, '--sudo', "$module~$version";
|
||||||
}
|
}
|
||||||
|
|
||||||
$build->create_build_script;
|
if (eval "use App::Prove; 1") {
|
||||||
|
App::Prove->new->run;
|
||||||
|
}
|
||||||
|
|
||||||
|
__END__
|
||||||
|
Loading…
Reference in New Issue
Block a user