Last active
May 14, 2019 14:42
-
-
Save rfdrake/bee49eccd96f4c3af7ab to your computer and use it in GitHub Desktop.
This copies a module from the main system into the local ~/perl5 directories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is an absolute hack used to workaround the fact we can't add build-deps | |
# to travis-ci containers. It's better than some alternatives, but most | |
# people might want to stick with "sudo: true" instead of doing this. | |
# Ok, this is worthless because system perls are built with threading and perlbrew isn't. | |
# Error: Can't load '/home/travis/perl5/perlbrew/perls/5.20/lib/5.20.0/x86_64-linux/auto/GD/GD.so' for module GD: /home/travis/perl5/perlbrew/perls/5.20/lib/5.20.0/x86_64-linux/auto/GD/GD.so: undefined symbol: PL_thr_key at /home/travis/perl5/perlbrew/perls/5.20/lib/5.20.0/x86_64-linux/DynaLoader.pm line 193. | |
# need system perl to get the include path right | |
# curl https://....githubstuff.com | /usr/bin/perl - | sh -x | |
use strict; | |
use warnings; | |
use File::Basename; | |
my $lib = $ARGV[0] || "GD.pm"; | |
my $pkg = $ARGV[1] || "libgd-gd2-perl"; | |
my $dest = $ARGV[2] || qx(perl -MConfig -e 'print $Config{archlib}') | |
my ($path) = grep { $_ if ( -f "$_/$lib" ) } @INC; | |
my $files = qx(dpkg -L $pkg); | |
for(split(/\n/, $files)) { | |
next if ($_ !~ /$path/); | |
next if ( -d $_ ); # skip directories | |
my $file = $_; | |
$file =~ s/$path\///; | |
my $dir = dirname $file; | |
print "mkdir $dest/$dir\n"; | |
print "cp $_ $dest/$file\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment