From 1378562e63c93e4e5b63eedc8f21a4970eb5735e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci <aar@cpan.org> Date: Thu, 19 Nov 2015 15:30:27 +0100 Subject: [PATCH] Further improvements for compilation (Ubuntu) --- .travis.yml | 3 ++- xs/Build.PL | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 33a282d81..3b8f049d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,6 @@ branches: - master - stable before_script: + - sudo add-apt-repository ppa:boost-latest/ppa - sudo apt-get update -qq - - sudo apt-get install libboost-thread-dev libboost-system-dev + - sudo apt-get install libboost-thread1.55-dev libboost-system1.55-dev diff --git a/xs/Build.PL b/xs/Build.PL index 8b88ce88a..44066c28d 100644 --- a/xs/Build.PL +++ b/xs/Build.PL @@ -43,25 +43,36 @@ if (defined $ENV{BOOST_DIR}) { # In order to generate the -l switches we need to know how Boost libraries are named my $have_boost = 0; -foreach my $path (@boost_libs) { - my @files = glob "$path/libboost_system*"; - next if !@files; + +# check without explicit lib path (works on Linux) +$have_boost = 1 + if check_lib( + lib => "boost_system", + INC => join(' ', map "-I$_", @INC, @boost_include), + LIBS => join(' ', map "-L$_", @INC, @boost_libs), + ); + +if (!$have_boost) { + foreach my $path (@boost_libs) { + my @files = glob "$path/libboost_system*"; + next if !@files; - if ($files[0] =~ /libboost_system([^.]+)/) { - my $suffix = $1; - check_lib( - lib => "boost_system$suffix", - INC => join(' ', map "-I$_", @INC, @boost_include), - LIBS => "-L$path", - ) or next; + if ($files[0] =~ /libboost_system([^.]+)/) { + my $suffix = $1; + check_lib( + lib => "boost_system$suffix", + INC => join(' ', map "-I$_", @INC, @boost_include), + LIBS => "-L$path", + ) or next; - push @INC, (map " -I$_", @boost_include); # TODO: only use the one related to the chosen lib path - push @LIBS, " -L$path", (map " -lboost_$_$suffix", qw(thread system)); # we need these - push @cflags, '-DBOOST_LIBS'; - $have_boost = 1; - last; + push @INC, (map " -I$_", @boost_include); # TODO: only use the one related to the chosen lib path + push @LIBS, " -L$path", (map " -lboost_$_$suffix", qw(thread system)); # we need these + $have_boost = 1; + last; + } } } +push @cflags, '-DBOOST_LIBS' if $have_boost; die <<'EOF' if !$have_boost; Slic3r requires the Boost libraries. Please make sure they are installed.