… | |
… | |
40 | |
40 | |
41 | With F<uClibc> and F<upx> on x86, you can create a single 500kb binary |
41 | With F<uClibc> and F<upx> on x86, you can create a single 500kb binary |
42 | that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO, |
42 | that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO, |
43 | Coro and so on. Or any other choice of modules. |
43 | Coro and so on. Or any other choice of modules. |
44 | |
44 | |
|
|
45 | To see how this turns out, you can try out smallperl and bigperl, two |
|
|
46 | pre-built static and compressed perl binaries with many and even more |
|
|
47 | modules: just follow the links at L<http://staticperl.schmorp.de/>. |
|
|
48 | |
45 | The created files do not need write access to the file system (like PAR |
49 | The created files do not need write access to the file system (like PAR |
46 | does). In fact, since this script is in many ways similar to PAR::Packer, |
50 | does). In fact, since this script is in many ways similar to PAR::Packer, |
47 | here are the differences: |
51 | here are the differences: |
48 | |
52 | |
49 | =over 4 |
53 | =over 4 |
… | |
… | |
152 | |
156 | |
153 | To force recompilation or reinstallation, you need to run F<staticperl |
157 | To force recompilation or reinstallation, you need to run F<staticperl |
154 | distclean> first. |
158 | distclean> first. |
155 | |
159 | |
156 | =over 4 |
160 | =over 4 |
|
|
161 | |
|
|
162 | =item F<staticperl version> |
|
|
163 | |
|
|
164 | Prints some info about the version of the F<staticperl> script you are using. |
157 | |
165 | |
158 | =item F<staticperl fetch> |
166 | =item F<staticperl fetch> |
159 | |
167 | |
160 | Runs only the download and unpack phase, unless this has already happened. |
168 | Runs only the download and unpack phase, unless this has already happened. |
161 | |
169 | |
… | |
… | |
311 | |
319 | |
312 | All this step does is potentially reduce the number of files already |
320 | All this step does is potentially reduce the number of files already |
313 | selected or found in phase 1. |
321 | selected or found in phase 1. |
314 | |
322 | |
315 | =item 3. find all modules (== F<.pm> files), gather their static archives |
323 | =item 3. find all modules (== F<.pm> files), gather their static archives |
316 | (F<.a>) and AutoLoader splitfiles (F<.ix> and F<.al> files) and find any |
324 | (F<.a>) and AutoLoader splitfiles (F<.ix> and F<.al> files), find any |
317 | extra libraries they need for linking (F<extralibs.ld>). |
325 | extra libraries they need for linking (F<extralibs.ld>) and optionally |
|
|
326 | evaluate any F<.packlist> files. |
318 | |
327 | |
319 | This step is required to link against XS extensions and also adds files |
328 | This step is required to link against XS extensions and also adds files |
320 | required for L<AutoLoader> to do it's job. |
329 | required for L<AutoLoader> to do it's job. |
321 | |
330 | |
322 | =back |
331 | =back |
… | |
… | |
453 | (using a C<require>) before anything else when the new perl is |
462 | (using a C<require>) before anything else when the new perl is |
454 | initialised. This can be used to modify C<@INC> or anything else before |
463 | initialised. This can be used to modify C<@INC> or anything else before |
455 | the perl interpreter executes scripts given on the command line (or via |
464 | the perl interpreter executes scripts given on the command line (or via |
456 | C<-e>). This works even in an embedded interpreter. |
465 | C<-e>). This works even in an embedded interpreter. |
457 | |
466 | |
|
|
467 | =item --usepacklist |
|
|
468 | |
|
|
469 | Read F<.packlist> files for each distribution that happens to match a |
|
|
470 | module name you specified. Sounds weird, and it is, so expect semantics to |
|
|
471 | change somehow in the future. |
|
|
472 | |
|
|
473 | The idea is that most CPAN distributions have a F<.pm> file that matches |
|
|
474 | the name of the distribution (which is rather reasonable after all). |
|
|
475 | |
|
|
476 | If this switch is enabled, then if any of the F<.pm> files that have been |
|
|
477 | selected match an install distribution, then all F<.pm>, F<.pl>, F<.al> |
|
|
478 | and F<.ix> files installed by this distribution are also included. |
|
|
479 | |
|
|
480 | For example, using this switch, when the L<URI> module is specified, then |
|
|
481 | all L<URI> submodules that have been installed via the CPAN distribution |
|
|
482 | are included as well, so you don't have to manually specify them. |
|
|
483 | |
458 | =item --incglob pattern |
484 | =item --incglob pattern |
459 | |
485 | |
460 | This goes through all library directories and tries to match any F<.pm> |
486 | This goes through all library directories and tries to match any F<.pm> |
461 | and F<.pl> files against the extended glob pattern (see below). If a file |
487 | and F<.pl> files against the extended glob pattern (see below). If a file |
462 | matches, it is added. This switch will automatically detect L<AutoLoader> |
488 | matches, it is added. This switch will automatically detect L<AutoLoader> |
… | |
… | |
589 | |
615 | |
590 | =back |
616 | =back |
591 | |
617 | |
592 | =head2 F<STATICPERL> CONFIGURATION AND HOOKS |
618 | =head2 F<STATICPERL> CONFIGURATION AND HOOKS |
593 | |
619 | |
594 | During (each) startup, F<staticperl> tries to source the following shell |
620 | During (each) startup, F<staticperl> tries to source some shell files to |
|
|
621 | allow you to fine-tune/override configuration settings. |
|
|
622 | |
|
|
623 | In them you can override shell variables, or define shell functions |
|
|
624 | ("hooks") to be called at specific phases during installation. For |
|
|
625 | example, you could define a C<postinstall> hook to install additional |
|
|
626 | modules from CPAN each time you start from scratch. |
|
|
627 | |
|
|
628 | If the env variable C<$STATICPERLRC> is set, then F<staticperl> will try |
|
|
629 | to source the file named with it only. Otherwise, it tries the following |
595 | files in order: |
630 | shell files in order: |
596 | |
631 | |
597 | /etc/staticperlrc |
632 | /etc/staticperlrc |
598 | ~/.staticperlrc |
633 | ~/.staticperlrc |
599 | $STATICPERL/rc |
634 | $STATICPERL/rc |
600 | |
|
|
601 | They can be used to override shell variables, or define functions to be |
|
|
602 | called at specific phases. |
|
|
603 | |
635 | |
604 | Note that the last file is erased during F<staticperl distclean>, so |
636 | Note that the last file is erased during F<staticperl distclean>, so |
605 | generally should not be used. |
637 | generally should not be used. |
606 | |
638 | |
607 | =head3 CONFIGURATION VARIABLES |
639 | =head3 CONFIGURATION VARIABLES |
… | |
… | |
953 | |
985 | |
954 | If you want to handle IRIs or IDNs (L<AnyEvent::Util> punycode and idn |
986 | If you want to handle IRIs or IDNs (L<AnyEvent::Util> punycode and idn |
955 | functions), you also need to include C<"AnyEvent/Util/idna.pl"> and |
987 | functions), you also need to include C<"AnyEvent/Util/idna.pl"> and |
956 | C<"AnyEvent/Util/uts46data.pl">. |
988 | C<"AnyEvent/Util/uts46data.pl">. |
957 | |
989 | |
|
|
990 | Or you can use C<--usepacklist> and specify C<-MAnyEvent> to include |
|
|
991 | everything. |
|
|
992 | |
958 | =item Carp |
993 | =item Carp |
959 | |
994 | |
960 | Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of |
995 | Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of |
961 | perl 5.12.2 (maybe earlier), this dependency no longer exists. |
996 | perl 5.12.2 (maybe earlier), this dependency no longer exists. |
962 | |
997 | |
… | |
… | |
966 | turn might need L<"Config_heavy.pl">. Including the latter gives you |
1001 | turn might need L<"Config_heavy.pl">. Including the latter gives you |
967 | both. |
1002 | both. |
968 | |
1003 | |
969 | =item Term::ReadLine::Perl |
1004 | =item Term::ReadLine::Perl |
970 | |
1005 | |
971 | Also needs L<Term::ReadLine::readline>. |
1006 | Also needs L<Term::ReadLine::readline>, or C<--usepacklist>. |
972 | |
1007 | |
973 | =item URI |
1008 | =item URI |
974 | |
1009 | |
975 | URI implements schemes as separate modules - the generic URL scheme is |
1010 | URI implements schemes as separate modules - the generic URL scheme is |
976 | implemented in L<URI::_generic>, HTTP is implemented in L<URI::http>. If |
1011 | implemented in L<URI::_generic>, HTTP is implemented in L<URI::http>. If |
977 | you need to use any of these schemes, you should include these manually. |
1012 | you need to use any of these schemes, you should include these manually, |
|
|
1013 | or use C<--usepacklist>. |
978 | |
1014 | |
979 | =back |
1015 | =back |
980 | |
1016 | |
981 | =head2 RECIPES |
1017 | =head2 RECIPES |
982 | |
1018 | |