1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | staticperl - perl, libc, 100 modules, all in one 500kb file |
3 | staticperl - perl, libc, 100 modules, all in one standalone 500kb file |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | staticperl help # print the embedded documentation |
7 | staticperl help # print the embedded documentation |
8 | staticperl fetch # fetch and unpack perl sources |
8 | staticperl fetch # fetch and unpack perl sources |
… | |
… | |
11 | staticperl install # build and then install perl |
11 | staticperl install # build and then install perl |
12 | staticperl clean # clean most intermediate files (restart at configure) |
12 | staticperl clean # clean most intermediate files (restart at configure) |
13 | staticperl distclean # delete everything installed by this script |
13 | staticperl distclean # delete everything installed by this script |
14 | staticperl perl ... # invoke the perlinterpreter |
14 | staticperl perl ... # invoke the perlinterpreter |
15 | staticperl cpan # invoke CPAN shell |
15 | staticperl cpan # invoke CPAN shell |
16 | staticperl instmod path... # install unpacked modules |
16 | staticperl instsrc path... # install unpacked modules |
17 | staticperl instcpan modulename... # install modules from CPAN |
17 | staticperl instcpan modulename... # install modules from CPAN |
18 | staticperl mkbundle <bundle-args...> # see documentation |
18 | staticperl mkbundle <bundle-args...> # see documentation |
19 | staticperl mkperl <bundle-args...> # see documentation |
19 | staticperl mkperl <bundle-args...> # see documentation |
20 | staticperl mkapp appname <bundle-args...> # see documentation |
20 | staticperl mkapp appname <bundle-args...> # see documentation |
21 | |
21 | |
… | |
… | |
348 | add eg/httpd httpd.pm |
348 | add eg/httpd httpd.pm |
349 | |
349 | |
350 | All options that specify modules or files to be added are processed in the |
350 | All options that specify modules or files to be added are processed in the |
351 | order given on the command line. |
351 | order given on the command line. |
352 | |
352 | |
353 | =head3 BUNDLE CREATION WORKFLOW / STATICPELR MKBUNDLE OPTIONS |
353 | =head3 BUNDLE CREATION WORKFLOW / STATICPERL MKBUNDLE OPTIONS |
354 | |
354 | |
355 | F<staticperl mkbundle> works by first assembling a list of candidate |
355 | F<staticperl mkbundle> works by first assembling a list of candidate |
356 | files and modules to include, then filtering them by include/exclude |
356 | files and modules to include, then filtering them by include/exclude |
357 | patterns. The remaining modules (together with their direct dependencies, |
357 | patterns. The remaining modules (together with their direct dependencies, |
358 | such as link libraries and L<AutoLoader> files) are then converted into |
358 | such as link libraries and L<AutoLoader> files) are then converted into |
… | |
… | |
553 | |
553 | |
554 | If you specify an alias you should probably add a C</> prefix to avoid |
554 | If you specify an alias you should probably add a C</> prefix to avoid |
555 | clashing with embedded perl files (whose paths never start with C</>), |
555 | clashing with embedded perl files (whose paths never start with C</>), |
556 | and/or use a special directory prefix, such as C</res/name>. |
556 | and/or use a special directory prefix, such as C</res/name>. |
557 | |
557 | |
558 | You can later get a copy of these files by calling C<staticperl::find |
558 | You can later get a copy of these files by calling C<static::find |
559 | "alias">. |
559 | "alias">. |
560 | |
560 | |
561 | An alternative way to embed binary files is to convert them to perl and |
561 | An alternative way to embed binary files is to convert them to perl and |
562 | use C<do> to get the contents - this method is a bit cumbersome, but works |
562 | use C<do> to get the contents - this method is a bit cumbersome, but works |
563 | both inside and outside of a staticperl bundle, without extra ado: |
563 | both inside and outside of a staticperl bundle, without extra ado: |
… | |
… | |
752 | standalone applications, and this option removes those known to cause |
752 | standalone applications, and this option removes those known to cause |
753 | trouble. |
753 | trouble. |
754 | |
754 | |
755 | Specifically, these are removed: |
755 | Specifically, these are removed: |
756 | |
756 | |
757 | C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause underaible |
757 | C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause undesirable |
758 | output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and |
758 | output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and |
759 | C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>, |
759 | C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>, |
760 | C<PERLIO_DEBUG> and C<PERLIO> can affect input and output. |
760 | C<PERLIO_DEBUG> and C<PERLIO> can affect input and output. |
761 | |
761 | |
762 | The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the |
762 | The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the |
… | |
… | |
949 | F<~/.staticperlrc> to override them. |
949 | F<~/.staticperlrc> to override them. |
950 | |
950 | |
951 | Most of the variables override (or modify) the corresponding F<Configure> |
951 | Most of the variables override (or modify) the corresponding F<Configure> |
952 | variable, except C<PERL_CCFLAGS>, which gets appended. |
952 | variable, except C<PERL_CCFLAGS>, which gets appended. |
953 | |
953 | |
954 | You should have a look near the beginning of the F<staticperl> script - |
954 | The default for C<PERL_OPTIMIZE> is C<-Os> (assuming gcc), and for |
955 | staticperl tries to default C<PERL_OPTIMIZE> to some psace-saving options |
955 | C<PERL_LIBS> is C<-lm -lcrypt>, which should be good for most (but not |
956 | suitable for newer gcc versions. For other compilers or older versions you |
956 | all) systems. |
|
|
957 | |
|
|
958 | For other compilers or more customised optimisation settings, you need to |
957 | need to adjust these, for example, in your F<~/.staticperlrc>. |
959 | adjust these, e.g. in your F<~/.staticperlrc>. |
|
|
960 | |
|
|
961 | With gcc on x86 and amd64, you can get more space-savings by using: |
|
|
962 | |
|
|
963 | -Os -ffunction-sections -fdata-sections -finline-limit=8 -mpush-args |
|
|
964 | -mno-inline-stringops-dynamically -mno-align-stringops |
|
|
965 | |
|
|
966 | And on x86 and pentium3 and newer (basically everything you might ever |
|
|
967 | want to run on), adding these is even better for space-savings (use |
|
|
968 | -mtune=core2 or something newer for much faster code, too): |
|
|
969 | |
|
|
970 | -fomit-frame-pointer -march=pentium3 -mtune=i386 |
958 | |
971 | |
959 | =back |
972 | =back |
960 | |
973 | |
961 | =head4 Variables you probably I<do not want> to override |
974 | =head4 Variables you probably I<do not want> to override |
962 | |
975 | |
… | |
… | |
1197 | |
1210 | |
1198 | =head3 FUNCTIONS |
1211 | =head3 FUNCTIONS |
1199 | |
1212 | |
1200 | =over 4 |
1213 | =over 4 |
1201 | |
1214 | |
1202 | =item $file = staticperl::find $path |
1215 | =item $file = static::find $path |
1203 | |
1216 | |
1204 | Returns the data associated with the given C<$path> |
1217 | Returns the data associated with the given C<$path> |
1205 | (e.g. C<Digest/MD5.pm>, C<auto/POSIX/autosplit.ix>). |
1218 | (e.g. C<Digest/MD5.pm>, C<auto/POSIX/autosplit.ix>). |
1206 | |
1219 | |
1207 | Returns C<undef> if the file isn't embedded. |
1220 | Returns C<undef> if the file isn't embedded. |
1208 | |
1221 | |
1209 | =item @paths = staticperl::list |
1222 | =item @paths = static::list |
1210 | |
1223 | |
1211 | Returns the list of all paths embedded in this binary. |
1224 | Returns the list of all paths embedded in this binary. |
1212 | |
1225 | |
1213 | =back |
1226 | =back |
1214 | |
1227 | |