--- App-Staticperl/staticperl.pod 2012/03/03 07:39:32 1.54 +++ App-Staticperl/staticperl.pod 2015/07/06 23:33:15 1.59 @@ -545,7 +545,7 @@ require myfiles::file2; my $res = do "myfiles/file3.pl"; -=item C<--binadd> F | C<--add> "F alias" +=item C<--addbin> F | C<--addbin> "F alias" Just like C<--add>, except that it treats the file as binary and adds it without any postprocessing (perl files might get stripped to reduce their @@ -924,8 +924,9 @@ =item C -The prefix where perl gets installed (default: F<$STATICPERL/perl>), -i.e. where the F and F subdirectories will end up. +The directory where perl gets installed (default: F<$STATICPERL/perl>), +i.e. where the F and F subdirectories will end up. Previous +contents will be removed on installation. =item C @@ -1230,60 +1231,19 @@ In addition, for the embedded loading of perl files to work, F overrides the C<@INC> array. -=head1 FULLY STATIC BINARIES - UCLIBC AND BUILDROOT +=head1 FULLY STATIC BINARIES - ALPINE LINUX -To make truly static (Linux-) libraries, you might want to have a look at -buildroot (L). - -Buildroot is primarily meant to set up a cross-compile environment (which -is not so useful as perl doesn't quite like cross compiles), but it can also compile -a chroot environment where you can use F. - -To do so, download buildroot, and enable "Build options => development -files in target filesystem" and optionally "Build options => gcc -optimization level (optimize for size)". At the time of writing, I had -good experiences with GCC 4.4.x but not GCC 4.5. - -To minimise code size, I used C<-pipe -ffunction-sections -fdata-sections --finline-limit=8 -fno-builtin-strlen -mtune=i386>. The C<-mtune=i386> -doesn't decrease codesize much, but it makes the file much more -compressible (and the execution a lot slower...). - -If you don't need Coro or threads, you can go with "linuxthreads.old" (or -no thread support). For Coro, it is highly recommended to switch to a -uClibc newer than 0.9.31 (at the time of this writing, I used the 20101201 -snapshot) and enable NPTL, otherwise Coro needs to be configured with the -ultra-slow pthreads backend to work around linuxthreads bugs (it also uses -twice the address space needed for stacks). - -If you use C, then you should also be aware that -uClibc shares C between all threads when statically linking. See -L for a -workaround (and L for discussion). - -C support is also recommended, especially if you want -to play around with buildroot options. Enabling the C -package will probably enable all options required for a successful -perl build. F itself additionally needs either C -(recommended, for CPAN) or C. - -As for shells, busybox should provide all that is needed, but the default -busybox configuration doesn't include F which is needed by perl - -either make a custom busybox config, or compile coreutils. - -For the latter route, you might find that bash has some bugs that keep -it from working properly in a chroot - either use dash (and link it to -F inside the chroot) or link busybox to F, using it's -built-in ash shell. - -Finally, you need F inside the chroot for many scripts to work -- either F or bind-mounting your F -will provide this. - -After you have compiled and set up your buildroot target, you can copy -F from the C distribution or from your -perl F directory (if you installed it) into the F -filesystem, chroot inside and run it. +This section once contained a way to build fully static (including +uClibc) binaries with buildroot. Unfortunately, buildroot no longer +supports a compiler, so I recommend using alpine linux instead +(L). Get yourself a VM (e.g. with qemu), run an +older alpine linux verison in it (e.g. 2.4), copy staticperl inside and +use it. + +The reason you might want an older alpine linux is that uClibc can be +quite dependent on kernel versions, so the newest version of alpine linux +might need a newer kernel then you might want for, if you plan to run your +binaries on on other kernels. =head1 RECIPES / SPECIFIC MODULES @@ -1356,6 +1316,28 @@ See Pango, same problems, same solution. +=item Net::SSLeay + +This module hasn't been significantly updated since OpenSSL is called +OpenSSL, and fails to properly link against dependent libraries, most +commonly, it forgets to specify -ldl when linking. + +On GNU/Linux systems this usually goes undetected, as perl usually links +against -ldl itself and OpenSSL just happens to pick it up that way, by +chance. + +For static builds, you either have to configure -ldl manually, or you +cna use the following snippet in your C hook which patches +Net::SSLeay after installation, which happens to work most of the time: + + postinstall() { + # first install it + instcpan Net::SSLeay + # then add -ldl for future linking + chmod u+w "$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld + echo " -ldl" >>"$PERL_PREFIX"/lib/auto/Net/SSLeay/extralibs.ld + } + =item Pango In addition to the C problem in Glib, Pango also routes around @@ -1432,7 +1414,14 @@ =back +=head1 ADDITIONAL RESOURCES + +Some guy has made a repository on github +(L) with some modules +patched to build with staticperl. + =head1 AUTHOR Marc Lehmann http://software.schmorp.de/pkg/staticperl.html +