develooper Front page | perl.dist | Postings from May 2002

Making perl location-independent.

From:
Alan Burlison
Date:
May 14, 2002 07:47
Subject:
Making perl location-independent.
Message ID:
3CE12318.3D28D791@sun.com
Another thing that has always bugged me is not being able to relocate perl
without rebuilding it, even if the package that perl itself is delivered
in is relocatable.

As far as I can remember the things that would have to be fixed are:

1. Fixing up Config.pm if perl is moved.
2. locating libperl.so if perl is moved.
3. Fixing up @INC if perl is moved.

Are there any other issues?

#2 can be done on Solaris by specifying the location of libperl relative
to the executable, using the $ORIGIN linker magic, eg assuming perl is in
..../bin and libperl is in .../lib/sun4-solaris-64int/CORE:
   cc -o perl ... -R '$ORIGIN/../lib/sun4-solaris-64int/CORE' ...
and #3 can be done by using getexecname() and realpath() to locate where
the executable is.  However I'm not sure of how this would translate onto
other platforms.

-- 
Alan Burlison
--
$ head -1 /dev/bollocks
drive out-of-the-box clicks-and-mortar brand recognition



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About