Hi Steffen,

Roderich, you showed me a proof-of-concept reimplementation using self
extracting libzip. Would you think you could modify the parl building
process to use libzip instead of the corresponding Perl XS modules? Or

I certainly would like to expand on my proof-of-concept, at least to
the point that others can toy with it. But I definitely won't have time to do so
for at least three weeks. For those who like to comment, I've outlined the idea below.

Creating an executable foo.exe from foo.pl would go like this:

(1) create foo.par as we do now with

     pp -B -p -a "/usr/bin/perl;bin/perl" -o foo.par foo.pl

i.e also add the perl executable (as bin/perl) (and perl shared library if necessary);
   of course, script/main.pl (that gets implicitly
   generated by pp, packed into foo.par and finally executed)
   would have to be different, see below

(2) create a self extracting zip archive with a hacked version of unzipsfx.exe
   (get it from www.info-zip.org) with simply

   cat hacked_unzipsfx.exe foo.par > foo.exe

The hacked unzipsfx.exe would need to do the following
(the unmodified unzipsfx.exe is actually a stripped down version of unzip):

(0) keep original @argv and dont't process it (unmodified unzipsfx.exe
    accepts "-d dir" to extract into dir instead of cwd, etc)
(1) determine name of cache directory (PAR_TEMP); if it already exists, continue with (4)
(2) create cache directory and set it as the directory to extract the archive 
into
(3) run the unmodified main part of unzipsfx.exe which extracts _everything_
   in foo.par into PAR_TEMP
(4) set up some environment variables (e.g PAR_TEMP, LD_LIBRARY_PATH)
(5) finally exec($PAR_TEMP/bin/perl, $PAR_TEMP/script/main.pl, @argv)

script/main.pl would look like:

BEGIN { @INC = ("$ENV{PAR_TEMP}/lib"); }
do "$ENV{PAR_TEMP}/script/foo.pl";

This doesn't even need PAR.pm (and modules it depends on) at runtime,
because we extract everything. A possible refinement would only extract
perl.exe and the core modules needed to get PAR.pm going, the rest of the
modules would then be loaded via PAR from the executable (which is also a PAR).

Cheers, Roderich

Reply via email to