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 |
… | |
… | |
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 |
… | |
… | |
543 | # then later, in perl, use |
543 | # then later, in perl, use |
544 | use myfiles::file1; |
544 | use myfiles::file1; |
545 | require myfiles::file2; |
545 | require myfiles::file2; |
546 | my $res = do "myfiles/file3.pl"; |
546 | my $res = do "myfiles/file3.pl"; |
547 | |
547 | |
548 | =item C<--binadd> F<file> | C<--add> "F<file> alias" |
548 | =item C<--binadd> F<file> | C<--binadd> "F<file> alias" |
549 | |
549 | |
550 | Just like C<--add>, except that it treats the file as binary and adds it |
550 | Just like C<--add>, except that it treats the file as binary and adds it |
551 | without any postprocessing (perl files might get stripped to reduce their |
551 | without any postprocessing (perl files might get stripped to reduce their |
552 | size). |
552 | size). |
553 | |
553 | |
… | |
… | |
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 |
… | |
… | |
922 | - some modules (such as L<Coro> or L<EV>) use environment variables for |
922 | - some modules (such as L<Coro> or L<EV>) use environment variables for |
923 | further tweaking. |
923 | further tweaking. |
924 | |
924 | |
925 | =item C<PERL_PREFIX> |
925 | =item C<PERL_PREFIX> |
926 | |
926 | |
927 | The prefix where perl gets installed (default: F<$STATICPERL/perl>), |
927 | The directory where perl gets installed (default: F<$STATICPERL/perl>), |
928 | i.e. where the F<bin> and F<lib> subdirectories will end up. |
928 | i.e. where the F<bin> and F<lib> subdirectories will end up. Previous |
|
|
929 | contents will be removed on installation. |
929 | |
930 | |
930 | =item C<PERL_CONFIGURE> |
931 | =item C<PERL_CONFIGURE> |
931 | |
932 | |
932 | Additional Configure options - these are simply passed to the perl |
933 | Additional Configure options - these are simply passed to the perl |
933 | Configure script. For example, if you wanted to enable dynamic loading, |
934 | Configure script. For example, if you wanted to enable dynamic loading, |
… | |
… | |
949 | F<~/.staticperlrc> to override them. |
950 | F<~/.staticperlrc> to override them. |
950 | |
951 | |
951 | Most of the variables override (or modify) the corresponding F<Configure> |
952 | Most of the variables override (or modify) the corresponding F<Configure> |
952 | variable, except C<PERL_CCFLAGS>, which gets appended. |
953 | variable, except C<PERL_CCFLAGS>, which gets appended. |
953 | |
954 | |
954 | You should have a look near the beginning of the F<staticperl> script - |
955 | 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 |
956 | 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 |
957 | all) systems. |
|
|
958 | |
|
|
959 | For other compilers or more customised optimisation settings, you need to |
957 | need to adjust these, for example, in your F<~/.staticperlrc>. |
960 | adjust these, e.g. in your F<~/.staticperlrc>. |
|
|
961 | |
|
|
962 | With gcc on x86 and amd64, you can get more space-savings by using: |
|
|
963 | |
|
|
964 | -Os -ffunction-sections -fdata-sections -finline-limit=8 -mpush-args |
|
|
965 | -mno-inline-stringops-dynamically -mno-align-stringops |
|
|
966 | |
|
|
967 | And on x86 and pentium3 and newer (basically everything you might ever |
|
|
968 | want to run on), adding these is even better for space-savings (use |
|
|
969 | -mtune=core2 or something newer for much faster code, too): |
|
|
970 | |
|
|
971 | -fomit-frame-pointer -march=pentium3 -mtune=i386 |
958 | |
972 | |
959 | =back |
973 | =back |
960 | |
974 | |
961 | =head4 Variables you probably I<do not want> to override |
975 | =head4 Variables you probably I<do not want> to override |
962 | |
976 | |
… | |
… | |
1340 | C<MAN3PODS> to be empty via the C<PERL_MM_OPT> environment variable. |
1354 | C<MAN3PODS> to be empty via the C<PERL_MM_OPT> environment variable. |
1341 | |
1355 | |
1342 | =item Gtk2 |
1356 | =item Gtk2 |
1343 | |
1357 | |
1344 | See Pango, same problems, same solution. |
1358 | See Pango, same problems, same solution. |
|
|
1359 | |
|
|
1360 | =item Net::SSLeay |
|
|
1361 | |
|
|
1362 | This module hasn't been significantly updated since OpenSSL is called |
|
|
1363 | OpenSSL, and fails to properly link against dependent libraries, most |
|
|
1364 | commonly, it forgets to specify -ldl when linking. |
|
|
1365 | |
|
|
1366 | On GNU/Linux systems this usually goes undetected, as perl usually links |
|
|
1367 | against -ldl itself and OpenSSL just happens to pick it up that way, by |
|
|
1368 | chance. |
|
|
1369 | |
|
|
1370 | For static builds, you either have to configure -ldl manually, or you |
|
|
1371 | cna use the following snippet in your C<postinstall> hook which patches |
|
|
1372 | Net::SSLeay after installation, which happens to work most of the time: |
|
|
1373 | |
|
|
1374 | postinstall() { |
|
|
1375 | # first install it |
|
|
1376 | instcpan Net::SSLeay |
|
|
1377 | # then add -ldl for future linking |
|
|
1378 | chmod u+w "$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld |
|
|
1379 | echo " -ldl" >>"$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld |
|
|
1380 | } |
1345 | |
1381 | |
1346 | =item Pango |
1382 | =item Pango |
1347 | |
1383 | |
1348 | In addition to the C<MAN3PODS> problem in Glib, Pango also routes around |
1384 | In addition to the C<MAN3PODS> problem in Glib, Pango also routes around |
1349 | L<ExtUtils::MakeMaker> by compiling its files on its own. F<staticperl> |
1385 | L<ExtUtils::MakeMaker> by compiling its files on its own. F<staticperl> |