2013-06-22 14:18:43 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Config;
|
|
|
|
use File::Spec;
|
|
|
|
|
|
|
|
my %prereqs = qw(
|
2014-11-26 21:30:25 +00:00
|
|
|
Devel::CheckLib 0
|
2013-10-28 10:14:53 +00:00
|
|
|
ExtUtils::MakeMaker 6.80
|
2013-11-19 14:54:00 +00:00
|
|
|
ExtUtils::ParseXS 3.22
|
2017-11-29 15:57:21 +00:00
|
|
|
ExtUtils::XSpp 0
|
|
|
|
ExtUtils::Typemaps 0
|
2018-05-14 11:44:33 +00:00
|
|
|
ExtUtils::Typemaps::Basic 0
|
2013-06-22 14:18:43 +00:00
|
|
|
File::Basename 0
|
|
|
|
File::Spec 0
|
|
|
|
Getopt::Long 0
|
2013-12-28 15:01:27 +00:00
|
|
|
Module::Build::WithXSpp 0.14
|
2013-09-12 09:09:03 +00:00
|
|
|
Moo 1.003001
|
2014-07-26 15:07:43 +00:00
|
|
|
POSIX 0
|
2013-06-22 14:18:43 +00:00
|
|
|
Scalar::Util 0
|
|
|
|
Test::More 0
|
2014-06-13 21:27:52 +00:00
|
|
|
Thread::Semaphore 0
|
2013-06-22 14:18:43 +00:00
|
|
|
IO::Scalar 0
|
2014-12-12 23:01:24 +00:00
|
|
|
threads 1.96
|
2013-06-22 14:18:43 +00:00
|
|
|
Time::HiRes 0
|
2011-10-02 09:57:47 +00:00
|
|
|
);
|
2013-06-22 14:18:43 +00:00
|
|
|
my %recommends = qw(
|
|
|
|
Class::XSAccessor 0
|
2015-01-09 13:02:49 +00:00
|
|
|
Test::Harness 0
|
2013-06-23 09:20:03 +00:00
|
|
|
);
|
2013-09-17 19:52:10 +00:00
|
|
|
|
2014-04-10 13:43:31 +00:00
|
|
|
my $sudo = grep { $_ eq '--sudo' } @ARGV;
|
2014-01-11 20:46:22 +00:00
|
|
|
my $gui = grep { $_ eq '--gui' } @ARGV;
|
2017-08-30 08:03:32 +00:00
|
|
|
my $nolocal = grep { $_ eq '--nolocal' } @ARGV;
|
2013-09-17 19:52:10 +00:00
|
|
|
if ($gui) {
|
2013-07-06 09:37:24 +00:00
|
|
|
%prereqs = qw(
|
2014-10-28 22:39:11 +00:00
|
|
|
Class::Accessor 0
|
2017-08-28 13:59:26 +00:00
|
|
|
Wx 0.9918
|
2013-07-06 09:37:24 +00:00
|
|
|
);
|
|
|
|
%recommends = qw(
|
2013-07-06 00:44:32 +00:00
|
|
|
Wx::GLCanvas 0
|
2013-07-06 09:37:24 +00:00
|
|
|
);
|
2015-01-04 22:53:59 +00:00
|
|
|
if ($^O eq 'MSWin32') {
|
2015-01-08 21:51:21 +00:00
|
|
|
$recommends{"Win32::TieRegistry"} = 0;
|
2015-01-18 15:52:55 +00:00
|
|
|
# we need an up-to-date Win32::API because older aren't thread-safe (GH #2517)
|
|
|
|
$prereqs{'Win32::API'} = 0.79;
|
2015-01-04 22:53:59 +00:00
|
|
|
}
|
2013-07-06 00:44:32 +00:00
|
|
|
}
|
2013-06-23 09:20:03 +00:00
|
|
|
|
2013-11-10 13:31:51 +00:00
|
|
|
my @missing_prereqs = ();
|
2013-06-24 14:32:03 +00:00
|
|
|
if ($ENV{SLIC3R_NO_AUTO}) {
|
|
|
|
foreach my $module (sort keys %prereqs) {
|
|
|
|
my $version = $prereqs{$module};
|
|
|
|
next if eval "use $module $version; 1";
|
2013-11-10 13:32:55 +00:00
|
|
|
push @missing_prereqs, $module if exists $prereqs{$module};
|
2013-06-24 14:32:03 +00:00
|
|
|
print "Missing prerequisite $module $version\n";
|
2013-06-23 09:20:03 +00:00
|
|
|
}
|
2013-06-24 14:32:03 +00:00
|
|
|
foreach my $module (sort keys %recommends) {
|
|
|
|
my $version = $recommends{$module};
|
|
|
|
next if eval "use $module $version; 1";
|
|
|
|
print "Missing optional $module $version\n";
|
2013-06-23 09:20:03 +00:00
|
|
|
}
|
2013-06-24 14:39:31 +00:00
|
|
|
} else {
|
|
|
|
my @try = (
|
|
|
|
$ENV{CPANM} // (),
|
|
|
|
File::Spec->catfile($Config{sitebin}, 'cpanm'),
|
|
|
|
File::Spec->catfile($Config{installscript}, 'cpanm'),
|
|
|
|
);
|
|
|
|
|
|
|
|
my $cpanm;
|
|
|
|
foreach my $path (@try) {
|
|
|
|
if (-e $path) { # don't use -x because it fails on Windows
|
|
|
|
$cpanm = $path;
|
|
|
|
last;
|
|
|
|
}
|
2013-06-23 09:20:03 +00:00
|
|
|
}
|
2013-06-24 14:39:31 +00:00
|
|
|
if (!$cpanm) {
|
|
|
|
if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
|
|
|
|
$cpanm = 'cpanm';
|
|
|
|
}
|
2013-06-23 09:20:03 +00:00
|
|
|
}
|
2013-06-24 14:39:31 +00:00
|
|
|
die <<'EOF'
|
2013-06-22 14:18:43 +00:00
|
|
|
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
|
2013-06-24 14:39:31 +00:00
|
|
|
if !$cpanm;
|
2014-04-10 13:43:31 +00:00
|
|
|
my @cpanm_args = ();
|
|
|
|
push @cpanm_args, "--sudo" if $sudo;
|
|
|
|
|
2017-08-18 07:58:50 +00:00
|
|
|
# install local::lib without --local-lib otherwise it's not usable afterwards
|
|
|
|
if (!eval "use local::lib qw(local-lib); 1") {
|
|
|
|
my $res = system $cpanm, @cpanm_args, 'local::lib';
|
|
|
|
warn "Warning: local::lib is required. You might need to run the `cpanm --sudo local::lib` command in order to install it.\n"
|
|
|
|
if $res != 0;
|
|
|
|
}
|
|
|
|
|
2017-08-30 08:03:32 +00:00
|
|
|
push @cpanm_args, ('--local-lib', 'local-lib') if ! $nolocal;
|
2017-08-18 07:58:50 +00:00
|
|
|
|
2013-07-06 00:44:32 +00:00
|
|
|
# make sure our cpanm is updated (old ones don't support the ~ syntax)
|
2014-04-10 13:43:31 +00:00
|
|
|
system $cpanm, @cpanm_args, 'App::cpanminus';
|
2013-07-06 00:44:32 +00:00
|
|
|
|
2013-06-24 14:39:31 +00:00
|
|
|
my %modules = (%prereqs, %recommends);
|
|
|
|
foreach my $module (sort keys %modules) {
|
|
|
|
my $version = $modules{$module};
|
2014-12-29 00:10:34 +00:00
|
|
|
my @cmd = ($cpanm, @cpanm_args);
|
2015-06-20 13:56:54 +00:00
|
|
|
|
|
|
|
# temporary workaround for upstream bug in test
|
|
|
|
push @cmd, '--notest'
|
2017-02-15 18:31:20 +00:00
|
|
|
if $module =~ /^(?:OpenGL|Test::Harness)$/;
|
2015-06-20 13:56:54 +00:00
|
|
|
|
2014-12-29 00:10:34 +00:00
|
|
|
push @cmd, "$module~$version";
|
2017-02-26 23:38:30 +00:00
|
|
|
|
2013-11-12 12:35:36 +00:00
|
|
|
my $res = system @cmd;
|
2013-08-24 10:12:46 +00:00
|
|
|
if ($res != 0) {
|
|
|
|
if (exists $prereqs{$module}) {
|
2013-11-10 13:31:51 +00:00
|
|
|
push @missing_prereqs, $module;
|
2013-08-24 10:12:46 +00:00
|
|
|
} else {
|
|
|
|
printf "Don't worry, this module is optional.\n";
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 19:14:55 +00:00
|
|
|
}
|
2013-06-22 14:18:43 +00:00
|
|
|
}
|
2012-05-17 14:40:12 +00:00
|
|
|
|
2017-08-30 08:03:32 +00:00
|
|
|
print "\n";
|
|
|
|
if ($gui) {
|
|
|
|
print "Perl dependencies for the Slic3r GUI were installed.\n";
|
|
|
|
} else {
|
|
|
|
print "Perl dependencies for Slic3r were installed.\n";
|
|
|
|
print "If you also want to use the GUI you can now run `perl Build.PL --gui` to install the required modules.\n";
|
2012-05-17 14:40:12 +00:00
|
|
|
}
|
2017-08-30 08:03:32 +00:00
|
|
|
print "\n";
|
|
|
|
print "In the next step, you need to build the Slic3r C++ library.\n";
|
|
|
|
print "1) Create a build directory and change to it\n";
|
|
|
|
print "2) run cmake .. -DCMAKE_BUILD_TYPE=Release\n";
|
|
|
|
print "3) run make\n";
|
|
|
|
print "4) to execute the automatic tests, run ctest --verbose\n";
|
2013-06-22 14:18:43 +00:00
|
|
|
__END__
|