develooper Front page | perl.perl5.porters | Postings from March 2007

single file relocatable perl distribution

Thread Next
From:
Nicholas Clark
Date:
March 4, 2007 15:13
Subject:
single file relocatable perl distribution
Message ID:
20070304231335.GA5748@plum.flirble.org
I'm experimenting with making single file perl distributions

$ ls -l perl
-rwxr-xr-x  1 nick  nick  21577960 Mar  4 23:03 perl
$ ldd perl
perl:
        libz.so.3 => /lib/libz.so.3 (0x286e6000)
        libm.so.4 => /lib/libm.so.4 (0x286f7000)
        libcrypt.so.3 => /lib/libcrypt.so.3 (0x2870d000)
        libutil.so.5 => /lib/libutil.so.5 (0x28726000)
        libc.so.6 => /lib/libc.so.6 (0x28733000)
$ file perl
perl: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), not stripped

Note, this is a single file with all libraries staticly linked in, with
a zip file of all of the libraries appended. It doesn't create or need any
temporary files.

If you have x86 FreeBSD and want to play you can get it here:

http://www.ccl4.org/~nick/P/perl


I had to tweak CPAN.pm slightly:

--- CPAN.pm~	Sun Mar  4 22:25:23 2007
+++ CPAN.pm	Sun Mar  4 23:02:24 2007
@@ -34,7 +34,7 @@
 BEGIN {
     if (File::Spec->can("rel2abs")) {
         for my $inc (@INC) {
-            $inc = File::Spec->rel2abs($inc);
+            $inc = File::Spec->rel2abs($inc) unless ref $inc;
         }
     }
 }


Unfortunately even with that it won't build modules, because
ExtUtils::MakeMaker writes Makefiles that have a dependency on Config.pm:

make: don't know how to make /export/home/nwc10/lib/perl5/5.9.5/i386-freebsd/Config.pm. Stop
  NWCLARK/Acme-Meta-0.02.tar.gz
  /usr/bin/make -- NOT OK



I'm not sure what to do about that. But yes, it does run the CPAN shell.

Enjoy.

(hence the question about xsinit, as ex::lib::zip needs to fiddle with @INC
before perl_run)

Nicholas Clark

Thread Next


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