On Mon, 2003-10-20 at 22:03, [EMAIL PROTECTED] wrote:
> On Mon, Oct 20, 2003 at 03:13:22PM +0200, Markus Jansen wrote:
> > >On Fri, 2003-10-17 at 15:31, [EMAIL PROTECTED] wrote:
> > >Actually, executing a PAR-packed exe works like this -
> > >Autrijus correct me if I got this wrong:
> > >
> > >(1) exe creates a temp directory
> > >(2) exe writes to files into this temp directory:
> > >    the shared perl library (e.g. libperl.so) and a small executable
> > >    called par; these files get extracted from C char[] arrays inside
> > >    the executable
> > >(3) exec then sets LD_LIBRARY_PATH to the temp direcctory and execs par
> > >    with one argument: the name of the executable
> > >(4) par is actually a mini-perl (linked against libperl.so), that
> > >    does some stuff in C, then eval's a Perl script contained in par
> > >(5) this script extracts all modules that a required for PAR.pm to work
> > >    from the executable; the script can't use any modules
> > >
> > >The problem is (5) above: PAR.pm uses Archive::Zip which uses
> > >Compress::Zlib which has ashared library Zlib.so that links to
> > >libz.so. Everything is there EXCEPT libz.so.
> 
> <snip> This is entirely correct.  May I re-use it in the documentations?
> :-)
> Maybe the solution would be a Compress::Zlib::Static, which is just like
> Compress::Zlib but is guaranteed to statically link zlib inside, so we
> can safely distribute it to machines without zlib.

Here's another suggestion: Instead of three methods to extract stuff
from the executable:


(1) stuff contained in char[]'s
(2) poking around in the executable file with pure Perl
(3) treat the executable as a zip file with PAR/Archive::Zip

replace (1)+(2) with a hacked up version of the self-extracting 
zip-archive code that comes with the InfoZIP distribution.
Of course, this will only work if this "first-level zip" also
contains libz.so, so PAR (or Module::ScanDeps) needs a new feature:
Pack shared libs that are referenced from a module's shared lib.
Getting this information is of course highly OS specific, but
should at least be easy on systems using the ELF object 
format (Linux, Solaris, *BSD?):
- run ldd on the module shared library and parse its output
- filter out system shared libs, e.g. libc, libm, libdl, on Solaris
  also stuff from /usr/platform/...

Cheers, Roderich

Reply via email to