From 401059066eeb8de3a3a8576ba532cd9150710423 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 18 Aug 2017 09:58:50 +0200 Subject: [PATCH] Switched to Perl local::lib for local compilation. Taken from upstream Slic3r, thanks @alexrj. --- .gitignore | 3 ++- Build.PL | 9 +++++++++ slic3r.pl | 1 + t/angles.t | 1 + t/avoid_crossing_perimeters.t | 1 + t/bridges.t | 1 + t/clean_polylines.t | 1 + t/clipper.t | 1 + t/collinear.t | 1 + t/combineinfill.t | 1 + t/config.t | 1 + t/cooling.t | 1 + t/custom_gcode.t | 1 + t/dynamic.t | 1 + t/fill.t | 1 + t/flow.t | 1 + t/gaps.t | 1 + t/gcode.t | 1 + t/geometry.t | 1 + t/layers.t | 1 + t/loops.t | 1 + t/multi.t | 1 + t/perimeters.t | 1 + t/polyclip.t | 1 + t/print.t | 1 + t/retraction.t | 1 + t/shells.t | 1 + t/skirt_brim.t | 1 + t/slice.t | 1 + t/support.t | 1 + t/svg.t | 1 + t/thin.t | 1 + t/threads.t | 1 + utils/amf-to-stl.pl | 1 + utils/config-bundle-to-config.pl | 1 + utils/dump-stl.pl | 1 + utils/gcode_sectioncut.pl | 1 + utils/pdf-slices.pl | 1 + utils/send-gcode.pl | 1 + utils/split_stl.pl | 1 + utils/stl-to-amf.pl | 1 + utils/view-mesh.pl | 1 + utils/view-toolpaths.pl | 1 + utils/wireframe.pl | 1 + 44 files changed, 53 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 62e52ce4e..7d66cacd7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ xs/buildtmp MANIFEST.bak xs/MANIFEST.bak xs/assertlib* -.init_bundle.ini \ No newline at end of file +.init_bundle.ini +local-lib \ No newline at end of file diff --git a/Build.PL b/Build.PL index 0e5113456..20844c2de 100644 --- a/Build.PL +++ b/Build.PL @@ -103,6 +103,15 @@ EOF my @cpanm_args = (); push @cpanm_args, "--sudo" if $sudo; + # 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; + } + + push @cpanm_args, ('--local-lib', 'local-lib'); + # make sure our cpanm is updated (old ones don't support the ~ syntax) system $cpanm, @cpanm_args, 'App::cpanminus'; diff --git a/slic3r.pl b/slic3r.pl index 1d3807a6c..4b6e43e42 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -6,6 +6,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/lib"; + use local::lib '--no-create', "$FindBin::Bin/local-lib"; } use File::Basename qw(basename); diff --git a/t/angles.t b/t/angles.t index 1e1a6c9c5..9dc690dea 100644 --- a/t/angles.t +++ b/t/angles.t @@ -7,6 +7,7 @@ plan tests => 34; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/avoid_crossing_perimeters.t b/t/avoid_crossing_perimeters.t index dd6c3e7b6..60442f47f 100644 --- a/t/avoid_crossing_perimeters.t +++ b/t/avoid_crossing_perimeters.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first sum); diff --git a/t/bridges.t b/t/bridges.t index cee3d3caa..e3c89faa7 100644 --- a/t/bridges.t +++ b/t/bridges.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first sum); diff --git a/t/clean_polylines.t b/t/clean_polylines.t index 4526bd60c..50c6f5bbd 100644 --- a/t/clean_polylines.t +++ b/t/clean_polylines.t @@ -7,6 +7,7 @@ plan tests => 6; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/clipper.t b/t/clipper.t index a898a53f6..3c9838143 100644 --- a/t/clipper.t +++ b/t/clipper.t @@ -7,6 +7,7 @@ plan tests => 6; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(sum); diff --git a/t/collinear.t b/t/collinear.t index 9dee77700..b28a3602c 100644 --- a/t/collinear.t +++ b/t/collinear.t @@ -7,6 +7,7 @@ plan tests => 11; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/combineinfill.t b/t/combineinfill.t index 6661cdd6c..66e461d45 100644 --- a/t/combineinfill.t +++ b/t/combineinfill.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/config.t b/t/config.t index 7f85dae84..829ef5f39 100644 --- a/t/config.t +++ b/t/config.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/cooling.t b/t/cooling.t index 1317f1dce..87a557a04 100644 --- a/t/cooling.t +++ b/t/cooling.t @@ -7,6 +7,7 @@ plan tests => 15; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(none all); diff --git a/t/custom_gcode.t b/t/custom_gcode.t index f6bfd366f..653bb26ae 100644 --- a/t/custom_gcode.t +++ b/t/custom_gcode.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/dynamic.t b/t/dynamic.t index beae06ad0..5d4d3ceb4 100644 --- a/t/dynamic.t +++ b/t/dynamic.t @@ -8,6 +8,7 @@ plan tests => 20; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/fill.t b/t/fill.t index 3c434ea52..15b1a2e04 100644 --- a/t/fill.t +++ b/t/fill.t @@ -9,6 +9,7 @@ plan tests => 19; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first sum); diff --git a/t/flow.t b/t/flow.t index 659a1171e..a0d445ce5 100644 --- a/t/flow.t +++ b/t/flow.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first sum); diff --git a/t/gaps.t b/t/gaps.t index 23acf9fd0..70e605a4b 100644 --- a/t/gaps.t +++ b/t/gaps.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/gcode.t b/t/gcode.t index 9e7bd354a..956c579d4 100644 --- a/t/gcode.t +++ b/t/gcode.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/geometry.t b/t/geometry.t index 4529e6b1c..0f37c0aa3 100644 --- a/t/geometry.t +++ b/t/geometry.t @@ -7,6 +7,7 @@ plan tests => 42; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/layers.t b/t/layers.t index 57fd25760..a85998077 100644 --- a/t/layers.t +++ b/t/layers.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/loops.t b/t/loops.t index 6293a4be7..e662469ca 100644 --- a/t/loops.t +++ b/t/loops.t @@ -8,6 +8,7 @@ plan tests => 4; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/multi.t b/t/multi.t index f709f14ed..caedb982e 100644 --- a/t/multi.t +++ b/t/multi.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/perimeters.t b/t/perimeters.t index c50ae79c8..2c190fd69 100644 --- a/t/perimeters.t +++ b/t/perimeters.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r::ExtrusionLoop ':roles'; diff --git a/t/polyclip.t b/t/polyclip.t index 1292d3216..0808c7be9 100644 --- a/t/polyclip.t +++ b/t/polyclip.t @@ -7,6 +7,7 @@ plan tests => 18; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/print.t b/t/print.t index 19f416357..29ad7cbaa 100644 --- a/t/print.t +++ b/t/print.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/retraction.t b/t/retraction.t index ca83a2b87..a0631f31a 100644 --- a/t/retraction.t +++ b/t/retraction.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(any); diff --git a/t/shells.t b/t/shells.t index eeec94ce2..03bc5665c 100644 --- a/t/shells.t +++ b/t/shells.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first sum); diff --git a/t/skirt_brim.t b/t/skirt_brim.t index 7a4507942..4d0155eba 100644 --- a/t/skirt_brim.t +++ b/t/skirt_brim.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/slice.t b/t/slice.t index 6d1daff97..2f193aae3 100644 --- a/t/slice.t +++ b/t/slice.t @@ -8,6 +8,7 @@ plan tests => 16; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } # temporarily disable compilation errors due to constant not being exported anymore diff --git a/t/support.t b/t/support.t index e024b7cbe..ed68c276e 100644 --- a/t/support.t +++ b/t/support.t @@ -8,6 +8,7 @@ plan tests => 27; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/t/svg.t b/t/svg.t index 9299eeefa..6092efe24 100644 --- a/t/svg.t +++ b/t/svg.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/thin.t b/t/thin.t index 514614802..2d256d286 100644 --- a/t/thin.t +++ b/t/thin.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/t/threads.t b/t/threads.t index 106a68af5..7fcd86f0e 100644 --- a/t/threads.t +++ b/t/threads.t @@ -5,6 +5,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use List::Util qw(first); diff --git a/utils/amf-to-stl.pl b/utils/amf-to-stl.pl index 2648ba25d..802fd9a53 100755 --- a/utils/amf-to-stl.pl +++ b/utils/amf-to-stl.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use File::Basename qw(basename); diff --git a/utils/config-bundle-to-config.pl b/utils/config-bundle-to-config.pl index beecd666f..e1d7f6143 100755 --- a/utils/config-bundle-to-config.pl +++ b/utils/config-bundle-to-config.pl @@ -9,6 +9,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev); diff --git a/utils/dump-stl.pl b/utils/dump-stl.pl index 0f459ffb1..eee3c73dc 100644 --- a/utils/dump-stl.pl +++ b/utils/dump-stl.pl @@ -8,6 +8,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/utils/gcode_sectioncut.pl b/utils/gcode_sectioncut.pl index a495698de..afc011ce8 100644 --- a/utils/gcode_sectioncut.pl +++ b/utils/gcode_sectioncut.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev); diff --git a/utils/pdf-slices.pl b/utils/pdf-slices.pl index 670a17171..ca61da08e 100755 --- a/utils/pdf-slices.pl +++ b/utils/pdf-slices.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev); diff --git a/utils/send-gcode.pl b/utils/send-gcode.pl index 989b17872..0b803baa6 100644 --- a/utils/send-gcode.pl +++ b/utils/send-gcode.pl @@ -6,6 +6,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Slic3r; diff --git a/utils/split_stl.pl b/utils/split_stl.pl index fffc57665..56217de4b 100755 --- a/utils/split_stl.pl +++ b/utils/split_stl.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use File::Basename qw(basename); diff --git a/utils/stl-to-amf.pl b/utils/stl-to-amf.pl index f0d537b04..bb88b2161 100755 --- a/utils/stl-to-amf.pl +++ b/utils/stl-to-amf.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use File::Basename qw(basename); diff --git a/utils/view-mesh.pl b/utils/view-mesh.pl index 66f1f3ead..03153ab3f 100644 --- a/utils/view-mesh.pl +++ b/utils/view-mesh.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev); diff --git a/utils/view-toolpaths.pl b/utils/view-toolpaths.pl index 4bbbaab4c..d4c47f072 100755 --- a/utils/view-toolpaths.pl +++ b/utils/view-toolpaths.pl @@ -7,6 +7,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev); diff --git a/utils/wireframe.pl b/utils/wireframe.pl index 53ac69a8a..5399f31ac 100644 --- a/utils/wireframe.pl +++ b/utils/wireframe.pl @@ -8,6 +8,7 @@ use warnings; BEGIN { use FindBin; use lib "$FindBin::Bin/../lib"; + use local::lib "$FindBin::Bin/../local-lib"; } use Getopt::Long qw(:config no_auto_abbrev);