Difference between revisions of "Perlbrew"
(→CPAN) |
|||
Line 19: | Line 19: | ||
===CPAN=== | ===CPAN=== | ||
+ | |||
+ | '''Note:''' I couldn't get this working on dreamhost. | ||
The CPAN install is more involved, but it is also not minified, which should make any necessary debugging easier. | The CPAN install is more involved, but it is also not minified, which should make any necessary debugging easier. |
Revision as of 09:43, 16 April 2014
perlbrew is a manager for sudo-free, user-level perl installations.
Contents
Installation
Directly
cd ~/tmp
wget --no-check-certificate https://raw.github.com/gugod/App-perlbrew/master/perlbrew
perl perlbrew self-install
cat 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bashrc # restart bash for this to take effect
At this point, you should continue to Accessories below, but the commands failed for me because of a certificate issue. This issue can be worked around by patching perlbrew to skip SSL cert checks in wget and curl modes (and not have fetch installed).
perl -i -p -E 's/(--silent --location)/-k $1/g; s/(--quiet -O)/--no-check-certificate $1/g' ~/perl5/perlbrew/bin/perlbrew
CPAN
Note: I couldn't get this working on dreamhost.
The CPAN install is more involved, but it is also not minified, which should make any necessary debugging easier.
Install using the CPAN for the system's main perl, not one of the perlbrew perls.
perlbrew off # If perlbrew is already installed, disable it
cpan App::perlbrew
Accessories
Install patchperl and cpanm.
perlbrew install-patchperl
perlbrew install-cpanm
Add a new perl install
Do this in a screen
session. It is a long-running process that you won't want interrupted by connectivity problems.
perlbrew install -D useshrplib --as $your_install_name stable
- The
--as
switch is optional. Omitting it causes the version to be used instead of a name when managing. -D useshrplib
enables compiling Perl in terms of a shared library, libperl.so. Optional, but don't omit it without a good reason.- Other
-D
,-U
,-A
defines are passed the same way. --thread
,--multi
can also be passed here.
- Other
- The
stable
specifier may be replaced with any version number orblead
.- It can also be replaced with the fully qualified path or URL of a .tar.gz (or .tar.bz2, etc.) archive of a Perl distribution. If the archive is in the current directory, use e.g.
"`pwd`"/perl-x.x.x.tar.gz
rather than./perl-x.x.x.tar.gz
; otherwise, it won't be recognized. - It can also be replaced with the path to a git checkout of the perl code.
- It can also be replaced with the fully qualified path or URL of a .tar.gz (or .tar.bz2, etc.) archive of a Perl distribution. If the archive is in the current directory, use e.g.
- Other options are available.
This is a full perl install process and will take a substantial about of time. You will be given a tail -f
command to follow the log if desired.
I believe it is supposed to work to install the same version twice as long as the names are different. However, there can be only one build directory per version, so don't try to perform the actual installs simultaneously; wait for one to finish before starting the next.
Remove an install
perlbrew uninstall $your_install_name
Simple.
Fixes for build failures
cwd.t linktest
When building 5.18.2, I got this failure:
# Failed test at t/cwd.t line 209.
# '/home/username/perl5/perlbrew/build/perl-5.18.2/dist/Cwd/t/linktest'
# doesn't match '(?^i:\/home\/username\/perl5\/perlbrew\/build\/perl\-5\.18\.2\/dist\/Cwd\/t\/_ptrslt_\/_path_\/_to_\/_a_\/_dir_$)'
A corresponding error reported by someone else said that this manual hack on Cwd.pm got the issue out of the way without forcing the install. Here's my version:
Unpack the perl archive into a temp dir, make the correction, repack it, and install it.
tar xjvf ~/perl5/perlbrew/dists/perl-5.18.2.tar.bz2
vim perl-5.18.2/dist/Cwd/Cwd.pm # and make the edit
tar czvf perl-5.18.2.tar.gz
perlbrew install --as $somename "`pwd`"/perl-5.18.2.tar.gz
The correction is thus (the ADD line):
# Line 579:
unless (opendir(PARENT, $dotdots))
{
# probably a permissions issue. Try the native command.
require File::Spec;
$start = readlink($start) if -l $start; # ADD this line to resolve a symlink
return File::Spec->rel2abs( $start, _backtick_pwd() );
}
This fix seems to have worked.
Image::Magick
One process that is claimed to work for installing Image::Magick is given on perltricks.com.
The given process has a new IM library installed under ~/local. I'm likely to modify it to something like ~/opt/ImageMagick-VERSION-NAME. This should be documented here.
Proposed install script (currently testing):
<syntaxhighlight lang=bash> IM=ImageMagick-6.8.9-0 IM_DOWNLOADS="http://www.imagemagick.org/download" OPT="$HOME/opt" FONT_PATH="$HOME/.fonts" PB_NAME="your perlbrew install name" PB_DIR="$PERLBREW_ROOT/perls/$PB_NAME" PB_PERL="$PB_DIR/bin/perl" PB_CORE="`echo "$PB_DIR"/lib/5.*.*/*/CORE`" PREFIX="$OPT/$IM-$PB_NAME"
WITHOUT_THREADS=`"$PB_PERL" -MConfig -E '$Config{useithreads} or say "--without-threads"'`
CONFIGURE="LDFLAGS=-L'$PB_CORE' \ ./configure $WITHOUT_THREADS \ --prefix '$PREFIX' \ --with-perl='$PB_PERL' \ --enable-shared \ --with-fontpath='$FONT_PATH' \ --with-rsvg"
echo Our configure command looks like: echo "$CONFIGURE" read -p "Press enter if this looks right (especially LDFLAGS and threads)." && wget "$IM_DOWNLOADS/$IM.tar.xz" && tar xJvf "$IM.tar.xz" && cd "$IM" && eval "$CONFIGURE" && read -p "Press enter to make and install." && make install