ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/staticperl.pod
(Generate patch)

Comparing App-Staticperl/staticperl.pod (file contents):
Revision 1.37 by root, Thu Feb 24 07:01:46 2011 UTC vs.
Revision 1.65 by root, Mon Jul 31 21:04:06 2023 UTC

1=head1 NAME 1=head1 NAME
2 2
3staticperl - perl, libc, 100 modules, all in one 500kb file 3staticperl - 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
9 staticperl configure # fetch and then configure perl 9 staticperl configure # fetch and then configure perl
10 staticperl build # configure and then build perl 10 staticperl build # configure and then build perl
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 cpan # invoke CPAN shell 15 staticperl cpan # invoke CPAN shell
15 staticperl instmod path... # install unpacked modules 16 staticperl instsrc path... # install unpacked modules
16 staticperl instcpan modulename... # install modules from CPAN 17 staticperl instcpan modulename... # install modules from CPAN
17 staticperl mkbundle <bundle-args...> # see documentation 18 staticperl mkbundle <bundle-args...> # see documentation
18 staticperl mkperl <bundle-args...> # see documentation 19 staticperl mkperl <bundle-args...> # see documentation
19 staticperl mkapp appname <bundle-args...> # see documentation 20 staticperl mkapp appname <bundle-args...> # see documentation
20 21
38file that contains perl interpreter, libc, all the modules you need, all 39file that contains perl interpreter, libc, all the modules you need, all
39the libraries you need and of course your actual program. 40the libraries you need and of course your actual program.
40 41
41With F<uClibc> and F<upx> on x86, you can create a single 500kb binary 42With F<uClibc> and F<upx> on x86, you can create a single 500kb binary
42that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO, 43that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO,
43Coro and so on. Or any other choice of modules. 44Coro and so on. Or any other choice of modules (and some other size :).
44 45
45To see how this turns out, you can try out smallperl and bigperl, two 46To see how this turns out, you can try out smallperl and bigperl, two
46pre-built static and compressed perl binaries with many and even more 47pre-built static and compressed perl binaries with many and even more
47modules: just follow the links at L<http://staticperl.schmorp.de/>. 48modules: just follow the links at L<http://staticperl.schmorp.de/>.
48 49
83With F<staticperl>, the burden is mostly with the developer - only direct 84With F<staticperl>, the burden is mostly with the developer - only direct
84compile-time dependencies and L<AutoLoader> are handled automatically. 85compile-time dependencies and L<AutoLoader> are handled automatically.
85This means the modules to include often need to be tweaked manually. 86This means the modules to include often need to be tweaked manually.
86 87
87All this does not preclude more permissive modes to be implemented in 88All this does not preclude more permissive modes to be implemented in
88the future, but right now, you have to resolve state hidden dependencies 89the future, but right now, you have to resolve hidden dependencies
89manually. 90manually.
90 91
91=item * PAR works out of the box, F<staticperl> does not. 92=item * PAR works out of the box, F<staticperl> does not.
92 93
93Maintaining your own custom perl build can be a pain in the ass, and while 94Maintaining your own custom perl build can be a pain in the ass, and while
186=item F<staticperl install> 187=item F<staticperl install>
187 188
188Wipes the perl installation directory (usually F<~/.staticperl/perl>) and 189Wipes the perl installation directory (usually F<~/.staticperl/perl>) and
189installs the perl distribution, potentially after building it first. 190installs the perl distribution, potentially after building it first.
190 191
192=item F<staticperl perl> [args...]
193
194Invokes the compiled perl interpreter with the given args. Basically the
195same as starting perl directly (usually via F<~/.staticperl/bin/perl>),
196but beats typing the path sometimes.
197
198Example: check that the Gtk2 module is installed and loadable.
199
200 staticperl perl -MGtk2 -e0
201
191=item F<staticperl cpan> [args...] 202=item F<staticperl cpan> [args...]
192 203
193Starts an interactive CPAN shell that you can use to install further 204Starts an interactive CPAN shell that you can use to install further
194modules. Installs the perl first if necessary, but apart from that, 205modules. Installs the perl first if necessary, but apart from that,
195no magic is involved: you could just as well run it manually via 206no magic is involved: you could just as well run it manually via
196F<~/.staticperl/perl/bin/cpan>. 207F<~/.staticperl/perl/bin/cpan>, except that F<staticperl> additionally
208sets the environment variable C<$PERL> to the path of the perl
209interpreter, which is handy in subshells.
197 210
198Any additional arguments are simply passed to the F<cpan> command. 211Any additional arguments are simply passed to the F<cpan> command.
199 212
200=item F<staticperl instcpan> module... 213=item F<staticperl instcpan> module...
201 214
335 add eg/httpd httpd.pm 348 add eg/httpd httpd.pm
336 349
337All options that specify modules or files to be added are processed in the 350All options that specify modules or files to be added are processed in the
338order given on the command line. 351order given on the command line.
339 352
340=head3 BUNDLE CREATION WORKFLOW / STATICPELR MKBUNDLE OPTIONS 353=head3 BUNDLE CREATION WORKFLOW / STATICPERL MKBUNDLE OPTIONS
341 354
342F<staticperl mkbundle> works by first assembling a list of candidate 355F<staticperl mkbundle> works by first assembling a list of candidate
343files and modules to include, then filtering them by include/exclude 356files and modules to include, then filtering them by include/exclude
344patterns. The remaining modules (together with their direct dependencies, 357patterns. The remaining modules (together with their direct dependencies,
345such as link libraries and L<AutoLoader> files) are then converted into 358such as link libraries and L<AutoLoader> files) are then converted into
530 # then later, in perl, use 543 # then later, in perl, use
531 use myfiles::file1; 544 use myfiles::file1;
532 require myfiles::file2; 545 require myfiles::file2;
533 my $res = do "myfiles/file3.pl"; 546 my $res = do "myfiles/file3.pl";
534 547
535=item C<--binadd> F<file> | C<--add> "F<file> alias" 548=item C<--addbin> F<file> | C<--addbin> "F<file> alias"
536 549
537Just like C<--add>, except that it treats the file as binary and adds it 550Just like C<--add>, except that it treats the file as binary and adds it
538without any postprocessing (perl files might get stripped to reduce their 551without any postprocessing (perl files might get stripped to reduce their
539size). 552size).
540 553
541If you specify an alias you should probably add a C<&> prefix to avoid 554If you specify an alias you should probably add a C</> prefix to avoid
542clashing with embedded perl files (whose paths never start with C<&>), 555clashing with embedded perl files (whose paths never start with C</>),
543and/or use a special directory prefix, such as C<&res/name>. 556and/or use a special directory prefix, such as C</res/name>.
544 557
545You can later get a copy of these files by calling C<staticperl::find 558You can later get a copy of these files by calling C<static::find
546"alias">. 559"alias">.
547 560
548An alternative way to embed binary files is to convert them to perl and 561An alternative way to embed binary files is to convert them to perl and
549use C<do> to get the contents - this method is a bit cumbersome, but works 562use C<do> to get the contents - this method is a bit cumbersome, but works
550both inside and outside of a staticperl bundle: 563both inside and outside of a staticperl bundle, without extra ado:
551 564
552 # a "binary" file, call it "bindata.pl" 565 # a "binary" file, call it "bindata.pl"
553 <<'SOME_MARKER' 566 <<'SOME_MARKER'
554 binary data NOT containing SOME_MARKER 567 binary data NOT containing SOME_MARKER
555 SOME_MARKER 568 SOME_MARKER
556 569
557 # load the binary 570 # load the binary
558 chomp (my $data = do "bindata.pl"); 571 chomp (my $data = do "bindata.pl");
572
573=item C<--allow-dynamic>
574
575By default, when F<mkbundle> hits a dynamic perl extension (e.g. a F<.so>
576or F<.dll> file), it will stop with a fatal error.
577
578When this option is enabled, F<mkbundle> packages the shared
579object into the bundle instead, with a prefix of F<!>
580(e.g. F<!auto/List/Util/Util.so>). What you do with that is currently up
581to you, F<staticperl> has no special support for this at the moment, apart
582from working around the lack of availability of F<PerlIO::scalar> while
583bootstrapping, at a speed cost.
584
585One way to deal with this is to write all files starting with F<!> into
586some directory and then C<unshift> that path onto C<@INC>.
587
588#TODO: example
559 589
560=back 590=back
561 591
562=item Step 2: filter all files using C<--include> and C<--exclude> options. 592=item Step 2: filter all files using C<--include> and C<--exclude> options.
563 593
722standalone applications, and this option removes those known to cause 752standalone applications, and this option removes those known to cause
723trouble. 753trouble.
724 754
725Specifically, these are removed: 755Specifically, these are removed:
726 756
727C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause underaible 757C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause undesirable
728output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and 758output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and
729C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>, 759C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>,
730C<PERLIO_DEBUG> and C<PERLIO> can affect input and output. 760C<PERLIO_DEBUG> and C<PERLIO> can affect input and output.
731 761
732The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the 762The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the
770 staticperl mkperl -MIO::AIO --staticlib crypt 800 staticperl mkperl -MIO::AIO --staticlib crypt
771 801
772 # ldopts might now contain: 802 # ldopts might now contain:
773 # -lm -Wl,-Bstatic -lcrypt -Wl,-Bdynamic -lpthread 803 # -lm -Wl,-Bstatic -lcrypt -Wl,-Bdynamic -lpthread
774 804
805=item C<--extra-cflags> string
806
807Specifies extra compiler flags, used when compiling the bundle file. The
808flags are appended to all the existing flags, so can be sued to override
809settings.
810
811=item C<--extra-ldflags> string
812
813Specifies extra linker flags, used when linking the bundle.
814
815=item C<--extra-libs> string
816
817Extra linker flags, appended at the end when linking. The difference to
818C<--extra-ldflags> is that the ldflags are appended to the flags, before
819the objects and libraries, and the extra libs are added at the end.
820
775=back 821=back
776 822
777=back 823=back
778 824
779=head3 EXTENDED GLOB PATTERNS 825=head3 EXTENDED GLOB PATTERNS
871=item C<STATICPERL> 917=item C<STATICPERL>
872 918
873The directory where staticperl stores all its files 919The directory where staticperl stores all its files
874(default: F<~/.staticperl>). 920(default: F<~/.staticperl>).
875 921
922=item C<DLCACHE>
923
924The path to a directory (will be created if it doesn't exist) where
925downloaded perl sources are being cached, to avoid downloading them
926again. The default is empty, which means there is no cache.
927
928=item C<PERL_VERSION>
929
930The perl version to install - C<5.12.5> is a good choice for small builds,
931but C<5.8.9> is also a good choice (5.8.9 is much smaller than 5.12.5), if
932it builds on your system.
933
934You can also set this variable to the absolute URL of a tarball (F<.tar>,
935F<.tar.gz>, F<.tar.bz2>, F<.tar.lzma> or F<.tar.xz>), or to the absolute
936path of an unpacked perl source tree, which will be copied.
937
938The default is currently
939F<http://stableperl.schmorp.de/dist/latest.tar.gz>, i.e. the latest
940stableperl release.
941
876=item C<PERL_MM_USE_DEFAULT>, C<EV_EXTRA_DEFS>, ... 942=item C<PERL_MM_USE_DEFAULT>, C<EV_EXTRA_DEFS>, ...
877 943
878Usually set to C<1> to make modules "less inquisitive" during their 944Usually set to C<1> to make modules "less inquisitive" during their
879installation, you can set any environment variable you want - some modules 945installation. You can set (and export!) any environment variable you want
880(such as L<Coro> or L<EV>) use environment variables for further tweaking. 946- some modules (such as L<Coro> or L<EV>) use environment variables for
881 947further tweaking.
882=item C<PERL_VERSION>
883
884The perl version to install - default is currently C<5.12.3>, but C<5.8.9>
885is also a good choice (5.8.9 is much smaller than 5.12.3, while 5.10.1 is
886about as big as 5.12.3).
887 948
888=item C<PERL_PREFIX> 949=item C<PERL_PREFIX>
889 950
890The prefix where perl gets installed (default: F<$STATICPERL/perl>), 951The directory where perl gets installed (default: F<$STATICPERL/perl>),
891i.e. where the F<bin> and F<lib> subdirectories will end up. 952i.e. where the F<bin> and F<lib> subdirectories will end up. Previous
953contents will be removed on installation.
892 954
893=item C<PERL_CONFIGURE> 955=item C<PERL_CONFIGURE>
894 956
895Additional Configure options - these are simply passed to the perl 957Additional Configure options - these are simply passed to the perl
896Configure script. For example, if you wanted to enable dynamic loading, 958Configure script. For example, if you wanted to enable dynamic loading,
912F<~/.staticperlrc> to override them. 974F<~/.staticperlrc> to override them.
913 975
914Most of the variables override (or modify) the corresponding F<Configure> 976Most of the variables override (or modify) the corresponding F<Configure>
915variable, except C<PERL_CCFLAGS>, which gets appended. 977variable, except C<PERL_CCFLAGS>, which gets appended.
916 978
979The default for C<PERL_OPTIMIZE> is C<-Os> (assuming gcc), and for
980C<PERL_LIBS> is C<-lm -lcrypt>, which should be good for most (but not
981all) systems.
982
983For other compilers or more customised optimisation settings, you need to
984adjust these, e.g. in your F<~/.staticperlrc>.
985
986With gcc on x86 and amd64, you can get more space-savings by using:
987
988 -Os -ffunction-sections -fdata-sections -finline-limit=8 -mpush-args
989 -mno-inline-stringops-dynamically -mno-align-stringops
990
991And on x86 and pentium3 and newer (basically everything you might ever
992want to run on), adding these is even better for space-savings (use
993-mtune=core2 or something newer for much faster code, too):
994
995 -fomit-frame-pointer -march=pentium3 -mtune=i386
996
917=back 997=back
918 998
919=head4 Variables you probably I<do not want> to override 999=head4 Variables you probably I<do not want> to override
920 1000
921=over 4 1001=over 4
939=head3 OVERRIDABLE HOOKS 1019=head3 OVERRIDABLE HOOKS
940 1020
941In addition to environment variables, it is possible to provide some 1021In addition to environment variables, it is possible to provide some
942shell functions that are called at specific times. To provide your own 1022shell functions that are called at specific times. To provide your own
943commands, just define the corresponding function. 1023commands, just define the corresponding function.
1024
1025The actual order in which hooks are invoked during a full install
1026from scratch is C<preconfigure>, C<patchconfig>, C<postconfigure>,
1027C<postbuild>, C<postinstall>.
944 1028
945Example: install extra modules from CPAN and from some directories 1029Example: install extra modules from CPAN and from some directories
946at F<staticperl install> time. 1030at F<staticperl install> time.
947 1031
948 postinstall() { 1032 postinstall() {
955 1039
956=over 4 1040=over 4
957 1041
958=item preconfigure 1042=item preconfigure
959 1043
960Called just before running F<./Configur> in the perl source 1044Called just before running F<./Configure> in the perl source
961directory. Current working directory is the perl source directory. 1045directory. Current working directory is the perl source directory.
962 1046
963This can be used to set any C<PERL_xxx> variables, which might be costly 1047This can be used to set any C<PERL_xxx> variables, which might be costly
964to compute. 1048to compute.
965 1049
1050=item patchconfig
1051
1052Called after running F<./Configure> in the perl source directory to create
1053F<./config.sh>, but before running F<./Configure -S> to actually apply the
1054config. Current working directory is the perl source directory.
1055
1056Can be used to tailor/patch F<config.sh> or do any other modifications.
1057
966=item postconfigure 1058=item postconfigure
967 1059
968Called after configuring, but before building perl. Current working 1060Called after configuring, but before building perl. Current working
969directory is the perl source directory. 1061directory is the perl source directory.
970 1062
971Could be used to tailor/patch config.sh (followed by F<sh Configure -S>)
972or do any other modifications.
973
974=item postbuild 1063=item postbuild
975 1064
976Called after building, but before installing perl. Current working 1065Called after building, but before installing perl. Current working
977directory is the perl source directory. 1066directory is the perl source directory.
978 1067
979I have no clue what this could be used for - tell me. 1068I have no clue what this could be used for - tell me.
1069
1070=item postcpanconfig
1071
1072Called just after CPAN has been configured, but before it has been used to
1073install anything. You can further change the configuration like this:
1074
1075 "$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
1076 CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
1077 ' || fatal "error while initialising CPAN in postcpanconfig"
980 1078
981=item postinstall 1079=item postinstall
982 1080
983Called after perl and any extra modules have been installed in C<$PREFIX>, 1081Called after perl and any extra modules have been installed in C<$PREFIX>,
984but before setting the "installation O.K." flag. 1082but before setting the "installation O.K." flag.
1090 1188
1091=back 1189=back
1092 1190
1093=head1 RUNTIME FUNCTIONALITY 1191=head1 RUNTIME FUNCTIONALITY
1094 1192
1095Binaries created with C<mkbundle>/C<mkperl> contain extra functions, which 1193Binaries created with C<mkbundle>/C<mkperl> contain extra functionality,
1096are required to access the bundled perl sources, but might be useful for 1194mostly related to the extra files bundled in the binary (the virtual
1097other purposes. 1195filesystem). All of this data is statically compiled into the binary, and
1196accessing means copying it from a read-only section of your binary. Data
1197pages in this way are usually freed by the operating system, as they aren't
1198used more then once.
1199
1200=head2 VIRTUAL FILESYSTEM
1201
1202Every bundle has a virtual filesystem. The only information stored in it
1203is the path and contents of each file that was bundled.
1204
1205=head3 LAYOUT
1206
1207Any paths starting with an ampersand (F<&>) or exclamation mark (F<!>) are
1208reserved by F<staticperl>. They must only be used as described in this
1209section.
1210
1211=over 4
1212
1213=item !
1214
1215All files that typically cannot be loaded from memory (such as dynamic
1216objects or shared libraries), but have to reside in the filesystem, are
1217prefixed with F<!>. Typically these files get written out to some
1218(semi-)temporary directory shortly after program startup, or before being
1219used.
1220
1221=item !boot
1222
1223The bootstrap file, if specified during bundling.
1224
1225=item !auto/
1226
1227Shared objects or dlls corresponding to dynamically-linked perl extensions
1228are stored with an F<!auto/> prefix.
1229
1230=item !lib/
1231
1232External shared libraries are stored in this directory.
1233
1234=item any letter
1235
1236Any path starting with a letter is a perl library file. For example,
1237F<Coro/AIO.pm> corresponds to the file loaded by C<use Coro::AIO>, and
1238F<Coro/jit.pl> corresponds to C<require "Coro/jit.pl">.
1239
1240Obviously, module names shouldn't start with any other characters than
1241letters :)
1242
1243=back
1244
1245=head3 FUNCTIONS
1246
1247=over 4
1248
1249=item $file = static::find $path
1250
1251Returns the data associated with the given C<$path>
1252(e.g. C<Digest/MD5.pm>, C<auto/POSIX/autosplit.ix>).
1253
1254Returns C<undef> if the file isn't embedded.
1255
1256=item @paths = static::list
1257
1258Returns the list of all paths embedded in this binary.
1259
1260=back
1261
1262=head2 EXTRA FEATURES
1098 1263
1099In addition, for the embedded loading of perl files to work, F<staticperl> 1264In addition, for the embedded loading of perl files to work, F<staticperl>
1100overrides the C<@INC> array. 1265overrides the C<@INC> array.
1101 1266
1102=over 4 1267=head1 FULLY STATIC BINARIES - ALPINE LINUX
1103 1268
1104=item $file = staticperl::find $path 1269This section once contained a way to build fully static (including
1270uClibc) binaries with buildroot. Unfortunately, buildroot no longer
1271supports a compiler, so I recommend using alpine linux instead
1272(L<http://alpinelinux.org/>). Get yourself a VM (e.g. with qemu), run an
1273older alpine linux verison in it (e.g. 2.4), copy staticperl inside and
1274use it.
1105 1275
1106Returns the data associated with the given C<$path> 1276The reason you might want an older alpine linux is that uClibc can be
1107(e.g. C<Digest/MD5.pm>, C<auto/POSIX/autosplit.ix>), which is basically 1277quite dependent on kernel versions, so the newest version of alpine linux
1108the UNIX path relative to the perl library directory. 1278might need a newer kernel then you might want for, if you plan to run your
1109 1279binaries on on other kernels.
1110Returns C<undef> if the file isn't embedded.
1111
1112=item @paths = staticperl::list
1113
1114Returns the list of all paths embedded in this binary.
1115
1116=back
1117
1118=head1 FULLY STATIC BINARIES - UCLIBC AND BUILDROOT
1119
1120To make truly static (Linux-) libraries, you might want to have a look at
1121buildroot (L<http://buildroot.uclibc.org/>).
1122
1123Buildroot is primarily meant to set up a cross-compile environment (which
1124is not so useful as perl doesn't quite like cross compiles), but it can also compile
1125a chroot environment where you can use F<staticperl>.
1126
1127To do so, download buildroot, and enable "Build options => development
1128files in target filesystem" and optionally "Build options => gcc
1129optimization level (optimize for size)". At the time of writing, I had
1130good experiences with GCC 4.4.x but not GCC 4.5.
1131
1132To minimise code size, I used C<-pipe -ffunction-sections -fdata-sections
1133-finline-limit=8 -fno-builtin-strlen -mtune=i386>. The C<-mtune=i386>
1134doesn't decrease codesize much, but it makes the file much more
1135compressible.
1136
1137If you don't need Coro or threads, you can go with "linuxthreads.old" (or
1138no thread support). For Coro, it is highly recommended to switch to a
1139uClibc newer than 0.9.31 (at the time of this writing, I used the 20101201
1140snapshot) and enable NPTL, otherwise Coro needs to be configured with the
1141ultra-slow pthreads backend to work around linuxthreads bugs (it also uses
1142twice the address space needed for stacks).
1143
1144If you use C<linuxthreads.old>, then you should also be aware that
1145uClibc shares C<errno> between all threads when statically linking. See
1146L<http://lists.uclibc.org/pipermail/uclibc/2010-June/044157.html> for a
1147workaround (And L<https://bugs.uclibc.org/2089> for discussion).
1148
1149C<ccache> support is also recommended, especially if you want
1150to play around with buildroot options. Enabling the C<miniperl>
1151package will probably enable all options required for a successful
1152perl build. F<staticperl> itself additionally needs either C<wget>
1153(recommended, for CPAN) or C<curl>.
1154
1155As for shells, busybox should provide all that is needed, but the default
1156busybox configuration doesn't include F<comm> which is needed by perl -
1157either make a custom busybox config, or compile coreutils.
1158
1159For the latter route, you might find that bash has some bugs that keep
1160it from working properly in a chroot - either use dash (and link it to
1161F</bin/sh> inside the chroot) or link busybox to F</bin/sh>, using it's
1162built-in ash shell.
1163
1164Finally, you need F</dev/null> inside the chroot for many scripts to work
1165- F<cp /dev/null output/target/dev> or bind-mounting your F</dev> will
1166both provide this.
1167
1168After you have compiled and set up your buildroot target, you can copy
1169F<staticperl> from the C<App::Staticperl> distribution or from your
1170perl f<bin> directory (if you installed it) into the F<output/target>
1171filesystem, chroot inside and run it.
1172 1280
1173=head1 RECIPES / SPECIFIC MODULES 1281=head1 RECIPES / SPECIFIC MODULES
1174 1282
1175This section contains some common(?) recipes and information about 1283This section contains some common(?) recipes and information about
1176problems with some common modules or perl constructs that require extra 1284problems with some common modules or perl constructs that require extra
1190 1298
1191Many Unicode properties in turn are defined in separate modules, 1299Many Unicode properties in turn are defined in separate modules,
1192such as C<"unicore/Heavy.pl"> and more specific data tables such as 1300such as C<"unicore/Heavy.pl"> and more specific data tables such as
1193C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables 1301C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables
1194are big (7MB uncompressed, although F<staticperl> contains special 1302are big (7MB uncompressed, although F<staticperl> contains special
1195handling for those files), so including them on demand by your application 1303handling for those files), so including them only on demand in your
1196only might pay off. 1304application might pay off.
1197 1305
1198To simply include the whole unicode database, use: 1306To simply include the whole unicode database, use:
1199 1307
1200 --incglob '/unicore/**.pl' 1308 --incglob '/unicore/**.pl'
1201 1309
1213C<"AnyEvent/Util/uts46data.pl">. 1321C<"AnyEvent/Util/uts46data.pl">.
1214 1322
1215Or you can use C<--usepacklists> and specify C<-MAnyEvent> to include 1323Or you can use C<--usepacklists> and specify C<-MAnyEvent> to include
1216everything. 1324everything.
1217 1325
1326=item Cairo
1327
1328See Glib, same problem, same solution.
1329
1218=item Carp 1330=item Carp
1219 1331
1220Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of 1332Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of
1221perl 5.12.2 (maybe earlier), this dependency no longer exists. 1333perl 5.12.2 (maybe earlier), this dependency no longer exists.
1222 1334
1223=item Config 1335=item Config
1224 1336
1225The F<perl -V> switch (as well as many modules) needs L<Config>, which in 1337The F<perl -V> switch (as well as many modules) needs L<Config>, which in
1226turn might need L<"Config_heavy.pl">. Including the latter gives you 1338turn might need L<"Config_heavy.pl">. Including the latter gives you
1227both. 1339both.
1340
1341=item Glib
1342
1343Glib literally requires Glib to be installed already to build - it tries
1344to fake this by running Glib out of the build directory before being
1345built. F<staticperl> tries to work around this by forcing C<MAN1PODS> and
1346C<MAN3PODS> to be empty via the C<PERL_MM_OPT> environment variable.
1347
1348=item Gtk2
1349
1350See Pango, same problems, same solution.
1351
1352=item Net::SSLeay
1353
1354This module hasn't been significantly updated since OpenSSL is called
1355OpenSSL, and fails to properly link against dependent libraries, most
1356commonly, it forgets to specify -ldl when linking.
1357
1358On GNU/Linux systems this usually goes undetected, as perl usually links
1359against -ldl itself and OpenSSL just happens to pick it up that way, by
1360chance.
1361
1362For static builds, you either have to configure -ldl manually, or you
1363cna use the following snippet in your C<postinstall> hook which patches
1364Net::SSLeay after installation, which happens to work most of the time:
1365
1366 postinstall() {
1367 # first install it
1368 instcpan Net::SSLeay
1369 # then add -ldl for future linking
1370 chmod u+w "$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld
1371 echo " -ldl" >>"$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld
1372 }
1373
1374=item Pango
1375
1376In addition to the C<MAN3PODS> problem in Glib, Pango also routes around
1377L<ExtUtils::MakeMaker> by compiling its files on its own. F<staticperl>
1378tries to patch L<ExtUtils::MM_Unix> to route around Pango.
1228 1379
1229=item Term::ReadLine::Perl 1380=item Term::ReadLine::Perl
1230 1381
1231Also needs L<Term::ReadLine::readline>, or C<--usepacklists>. 1382Also needs L<Term::ReadLine::readline>, or C<--usepacklists>.
1232 1383
1294gains little. Why Socket exposes a C function that is in the core already 1445gains little. Why Socket exposes a C function that is in the core already
1295is anybody's guess. 1446is anybody's guess.
1296 1447
1297=back 1448=back
1298 1449
1450=head1 ADDITIONAL RESOURCES
1451
1452Some guy has made a repository on github
1453(L<https://github.com/gh0stwizard/staticperl-modules>) with some modules
1454patched to build with staticperl.
1455
1299=head1 AUTHOR 1456=head1 AUTHOR
1300 1457
1301 Marc Lehmann <schmorp@schmorp.de> 1458 Marc Lehmann <schmorp@schmorp.de>
1302 http://software.schmorp.de/pkg/staticperl.html 1459 http://software.schmorp.de/pkg/staticperl.html
1460

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines