App-Staticperl
view release on metacpan or search on metacpan
problems with some common modules or perl constructs that require extra
files to be included.
MODULES
utf8
Some functionality in the utf8 module, such as swash handling (used
for unicode character ranges in regexes) is implemented in the
"utf8_heavy.pl" library:
-Mutf8_heavy.pl
Many Unicode properties in turn are defined in separate modules,
such as "unicore/Heavy.pl" and more specific data tables such as
"unicore/To/Digit.pl" or "unicore/lib/Perl/Word.pl". These tables
are big (7MB uncompressed, although staticperl contains special
handling for those files), so including them only on demand in your
application might pay off.
To simply include the whole unicode database, use:
--incglob '/unicore/**.pl'
AnyEvent
AnyEvent needs a backend implementation that it will load in a
delayed fashion. The AnyEvent::Impl::Perl backend is the default
choice for AnyEvent if it can't find anything else, and is usually a
safe fallback. If you plan to use e.g. EV (POE...), then you need to
include the AnyEvent::Impl::EV (AnyEvent::Impl::POE...) backend as
well.
If you want to handle IRIs or IDNs (AnyEvent::Util punycode and idn
functions), you also need to include "AnyEvent/Util/idna.pl" and
"AnyEvent/Util/uts46data.pl".
Or you can use "--usepacklists" and specify "-MAnyEvent" to include
everything.
Cairo
See Glib, same problem, same solution.
Carp
Carp had (in older versions of perl) a dependency on Carp::Heavy. As
of perl 5.12.2 (maybe earlier), this dependency no longer exists.
Config
The perl -V switch (as well as many modules) needs Config, which in
turn might need "Config_heavy.pl". Including the latter gives you
both.
Glib
Glib literally requires Glib to be installed already to build - it
tries to fake this by running Glib out of the build directory before
being built. staticperl tries to work around this by forcing
"MAN1PODS" and "MAN3PODS" to be empty via the "PERL_MM_OPT"
environment variable.
Gtk2
See Pango, same problems, same solution.
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 "postinstall" 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
}
Pango
In addition to the "MAN3PODS" problem in Glib, Pango also routes
around ExtUtils::MakeMaker by compiling its files on its own.
staticperl tries to patch ExtUtils::MM_Unix to route around Pango.
Term::ReadLine::Perl
Also needs Term::ReadLine::readline, or "--usepacklists".
URI URI implements schemes as separate modules - the generic URL scheme
is implemented in URI::_generic, HTTP is implemented in URI::http.
If you need to use any of these schemes, you should include these
manually, or use "--usepacklists".
RECIPES
Just link everything in
To link just about everything installed in the perl library into a
new perl, try this (the first time this runs it will take a long
time, as a lot of files need to be parsed):
staticperl mkperl -v --strip ppi --incglob '*'
If you don't mind the extra megabytes, this can be a very effective
way of creating bundles without having to worry about forgetting any
modules.
You get even more useful variants of this method by first selecting
everything, and then excluding stuff you are reasonable sure not to
need - bigperl <http://staticperl.schmorp.de/bigperl.html> uses this
approach.
Getting rid of netdb functions
The perl core has lots of netdb functions ("getnetbyname",
"getgrent" and so on) that few applications use. You can avoid
compiling them in by putting the following fragment into a
"preconfigure" hook:
preconfigure() {
for sym in \
d_getgrnam_r d_endgrent d_endgrent_r d_endhent \
d_endhostent_r d_endnent d_endnetent_r d_endpent \
( run in 1.198 second using v1.01-cache-2.11-cpan-39bf76dae61 )