On Tue, Mar 14, 2017 at 12:49 PM, Johan Vromans <jvrom...@squirrel.nl> wrote:
> I have a perl application that consists of pure perl modules only. Are you sure that your pure perl modules don't require (directly or transitively) something platform dependent, e.g. IO.pm (which is an XS module)? Check by pp'ing it into foo.exe and look at its contents with "unzip -l foo.exe". If that's the case, the following might work (haven't actually tried this). For reference, see "man par.pl", "Stand-alone executable format". 1. Get any packed executable (e.g. pp a hello-world one liner) from your target platform. 2. Run the attached script on it (repurposed from contrib/extract-embedded/extract-embedded.pl). This will print something like embedded FILEs start at offset 2119320 zip starts at offset 3143323 size of FILEs section is 1024003 3. Chop off the executable after the start of the zip. 4. Pack your application into a .par file ("pp -p -o my.par ...") 5. Append my.par to the executable stub. 6. Compute the SHA1 of the file so far and append it in hex (40 bytes) 7. Append "\0CACHE" 8. Append pack('N', size of FILEs section + size of my.par) 9. Append "\012PAR.pm\012" 10. Ta-da, new executable for the target platform Cheers, Roderich
analyze-pp.pl
Description: Perl program