11
ExtUtils::MakeMaker 6.80
12
ExtUtils::ParseXS 3.22
17
Module::Build::WithXSpp 0.14
30
my $sudo = grep { $_ eq '--sudo' } @ARGV;
31
my $gui = grep { $_ eq '--gui' } @ARGV;
32
my $xs_only = grep { $_ eq '--xs' } @ARGV;
43
%prereqs = %recommends = ();
46
my @missing_prereqs = ();
47
if ($ENV{SLIC3R_NO_AUTO}) {
48
foreach my $module (sort keys %prereqs) {
49
my $version = $prereqs{$module};
50
next if eval "use $module $version; 1";
51
push @missing_prereqs, $module if exists $prereqs{$module};
52
print "Missing prerequisite $module $version\n";
54
foreach my $module (sort keys %recommends) {
55
my $version = $recommends{$module};
56
next if eval "use $module $version; 1";
57
print "Missing optional $module $version\n";
62
File::Spec->catfile($Config{sitebin}, 'cpanm'),
63
File::Spec->catfile($Config{installscript}, 'cpanm'),
67
foreach my $path (@try) {
68
if (-e $path) { # don't use -x because it fails on Windows
74
if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
79
cpanm was not found. Please install it before running this script.
81
There are several ways to install cpanm, try one of these:
83
apt-get install cpanminus
84
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
87
If it is installed in a non-standard location you can do:
89
CPANM=/path/to/cpanm perl Build.PL
94
push @cpanm_args, "--sudo" if $sudo;
96
# make sure our cpanm is updated (old ones don't support the ~ syntax)
97
system $cpanm, @cpanm_args, 'App::cpanminus';
99
# install the Windows-compatible Math::Libm
100
if ($^O eq 'MSWin32' && !eval "use Math::Libm; 1") {
101
system $cpanm, @cpanm_args, 'https://github.com/alexrj/Math-Libm/tarball/master';
104
my %modules = (%prereqs, %recommends);
105
foreach my $module (sort keys %modules) {
106
my $version = $modules{$module};
107
my @cmd = ($cpanm, @cpanm_args, "$module~$version");
108
if ($module eq 'XML::SAX::ExpatXS' && $^O eq 'MSWin32') {
109
my $mingw = 'C:\dev\CitrusPerl\mingw64';
110
$mingw = 'C:\dev\CitrusPerl\mingw32' if !-d $mingw;
112
print "Could not find the MinGW directory at $mingw; skipping XML::SAX::ExpatXS (only needed for faster parsing of AMF files)\n";
114
push @cmd, sprintf('--configure-args="EXPATLIBPATH=%s\lib EXPATINCPATH=%s\include"', $mingw, $mingw);
117
my $res = system @cmd;
119
if (exists $prereqs{$module}) {
120
push @missing_prereqs, $module;
122
printf "Don't worry, this module is optional.\n";
128
# clean xs directory before reinstalling, to make sure Build is called
129
# with current perl binary
130
if (-e './xs/Build') {
131
if ($^O eq 'MSWin32') {
132
system '.\xs\Build', 'distclean';
134
system './xs/Build', 'distclean';
137
my $res = system $cpanm, @cpanm_args, '--reinstall', '--verbose', './xs';
139
die "The XS/C++ code failed to compile, aborting\n";
144
if (@missing_prereqs) {
145
printf "The following prerequisites failed to install: %s\n", join(', ', @missing_prereqs);
148
eval "use App::Prove; 1" or die "Failed to load App::Prove";
149
my $res = App::Prove->new->run ? 0 : 1;
151
print "If you also want to use the GUI you can now run `perl Build.PL --gui` to install the required modules.\n";
153
print "Some tests failed. Please report the failure to the author!\n";