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.36 by root, Fri Feb 11 01:05:37 2011 UTC vs.
Revision 1.40 by root, Sun May 1 09:29:47 2011 UTC

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 instmod 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
20 21
21Typical Examples: 22Typical Examples:
22 23
23 staticperl install # fetch, configure, build and install perl 24 staticperl install # fetch, configure, build and install perl
24 staticperl cpan # run interactive cpan shell 25 staticperl cpan # run interactive cpan shell
25 staticperl mkperl -M '"Config_heavy.pl"' # build a perl that supports -V 26 staticperl mkperl -MConfig_heavy.pl # build a perl that supports -V
26 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http 27 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
27 # build a perl with the above modules linked in 28 # build a perl with the above modules linked in
28 staticperl mkapp myapp --boot mainprog mymodules 29 staticperl mkapp myapp --boot mainprog mymodules
29 # build a binary "myapp" from mainprog and mymodules 30 # build a binary "myapp" from mainprog and mymodules
30 31
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
252 263
253 # first make sure we have perl and the required modules 264 # first make sure we have perl and the required modules
254 staticperl instcpan AnyEvent::HTTPD 265 staticperl instcpan AnyEvent::HTTPD
255 266
256 # now build the perl 267 # now build the perl
257 staticperl mkperl -M'"Config_heavy.pl"' -MAnyEvent::Impl::Perl \ 268 staticperl mkperl -MConfig_heavy.pl -MAnyEvent::Impl::Perl \
258 -MAnyEvent::HTTPD -MURI::http \ 269 -MAnyEvent::HTTPD -MURI::http \
259 --add 'eg/httpd httpd.pm' 270 --add 'eg/httpd httpd.pm'
260 271
261 # finally, invoke it 272 # finally, invoke it
262 ./perl -Mhttpd 273 ./perl -Mhttpd
381 392
382=over 4 393=over 4
383 394
384=item C<--use> F<module> | C<-M>F<module> 395=item C<--use> F<module> | C<-M>F<module>
385 396
386Include the named module and trace direct dependencies. This is done by 397Include the named module or perl library and trace direct
387C<use>'ing the module from a fresh package in a subprocess and tracing 398dependencies. This is done by loading the module in a subprocess and
388which other modules and files it actually loads. 399tracing which other modules and files it actually loads.
389 400
390Example: include AnyEvent and AnyEvent::Impl::Perl. 401Example: include AnyEvent and AnyEvent::Impl::Perl.
391 402
392 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl 403 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl
393 404
394Sometimes you want to load old-style "perl libraries" (F<.pl> files), 405Sometimes you want to load old-style "perl libraries" (F<.pl> files), or
395or maybe other weirdly named files. To do that, you need to quote 406maybe other weirdly named files. To support this, the C<--use> option
396the name in single or double quotes (this is because F<staticperl> 407actually tries to do what you mean, depending on the string you specify:
397I<literally> just adds the string after the C<require> - which acts 408
398different when confronted with quoted vs. unquoted strings). When given on 409=over 4
399the command line, you probably need to quote once more to avoid your shell 410
400interpreting it. Common cases that need this are F<Config_heavy.pl> and 411=item a possibly valid module name, e.g. F<common::sense>, F<Carp>,
401F<utf8_heavy.pl>. 412F<Coro::Mysql>.
413
414If the string contains no quotes, no F</> and no F<.>, then C<--use>
415assumes that it is a normal module name. It will create a new package and
416evaluate a C<use module> in it, i.e. it will load the package and do a
417default import.
418
419The import step is done because many modules trigger more dependencies
420when something is imported than without.
421
422=item anything that contains F</> or F<.> characters,
423e.g. F<utf8_heavy.pl>, F<Module/private/data.pl>.
424
425The string will be quoted and passed to require, as if you used C<require
426$module>. Nothing will be imported.
427
428=item "path" or 'path', e.g. C<"utf8_heavy.pl">.
429
430If you enclose the name into single or double quotes, then the quotes will
431be removed and the resulting string will be passed to require. This syntax
432is form compatibility with older versions of staticperl and should not be
433used anymore.
434
435=back
436
437Example: C<use> AnyEvent::Socket, once using C<use> (importing the
438symbols), and once via C<require>, not importing any symbols. The first
439form is preferred as many modules load some extra dependencies when asked
440to export symbols.
441
442 staticperl mkbundle -MAnyEvent::Socket # use + import
443 staticperl mkbundle -MAnyEvent/Socket.pm # require only
402 444
403Example: include the required files for F<perl -V> to work in all its 445Example: include the required files for F<perl -V> to work in all its
404glory (F<Config.pm> is included automatically by this). 446glory (F<Config.pm> is included automatically by the dependency tracker).
405 447
406 # bourne shell 448 # shell command
407 staticperl mkbundle --use '"Config_heavy.pl"' 449 staticperl mkbundle -MConfig_heavy.pl
408 450
409 # bundle specification file 451 # bundle specification file
410 use "Config_heavy.pl" 452 use Config_heavy.pl
411 453
412The C<-M>module syntax is included as a convenience that might be easier 454The C<-M>module syntax is included as a convenience that might be easier
413to remember than C<--use> - it's the same switch as perl itself uses 455to remember than C<--use> - it's the same switch as perl itself uses
414to load modules. Or maybe it confuses people. Time will tell. Or maybe 456to load modules. Or maybe it confuses people. Time will tell. Or maybe
415not. Sigh. 457not. Sigh.
681Example: create a standalone perl binary called F<./myexe> that will 723Example: create a standalone perl binary called F<./myexe> that will
682execute F<appfile> when it is started. 724execute F<appfile> when it is started.
683 725
684 staticperl mkbundle --app myexe --boot appfile 726 staticperl mkbundle --app myexe --boot appfile
685 727
728=item C<--ignore-env>
729
730Generates extra code to unset some environment variables before
731initialising/running perl. Perl supports a lot of environment variables
732that might alter execution in ways that might be undesirablre for
733standalone applications, and this option removes those known to cause
734trouble.
735
736Specifically, these are removed:
737
738C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause underaible
739output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and
740C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>,
741C<PERLIO_DEBUG> and C<PERLIO> can affect input and output.
742
743The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the
744startup code used by F<staticperl> overrides C<@INC> in all cases.
745
746This option will not make your program more secure (unless you are
747running with elevated privileges), but it will reduce the surprise effect
748when a user has these environment variables set and doesn't expect your
749standalone program to act like a perl interpreter.
750
686=item C<--static> 751=item C<--static>
687 752
688Add C<-static> to F<bundle.ldopts>, which means a fully static (if 753Add C<-static> to F<bundle.ldopts>, which means a fully static (if
689supported by the OS) executable will be created. This is not immensely 754supported by the OS) executable will be created. This is not immensely
690useful when just creating the bundle files, but is most useful when 755useful when just creating the bundle files, but is most useful when
858F<~/.staticperlrc> to override them. 923F<~/.staticperlrc> to override them.
859 924
860Most of the variables override (or modify) the corresponding F<Configure> 925Most of the variables override (or modify) the corresponding F<Configure>
861variable, except C<PERL_CCFLAGS>, which gets appended. 926variable, except C<PERL_CCFLAGS>, which gets appended.
862 927
928You should have a look near the beginning of the F<staticperl> script -
929staticperl tries to default C<PERL_OPTIMIZE> to some psace-saving options
930suitable for newer gcc versions. For other compilers or older versions you
931need to adjust these, for example, in your F<~/.staticperlrc>.
932
863=back 933=back
864 934
865=head4 Variables you probably I<do not want> to override 935=head4 Variables you probably I<do not want> to override
866 936
867=over 4 937=over 4
885=head3 OVERRIDABLE HOOKS 955=head3 OVERRIDABLE HOOKS
886 956
887In addition to environment variables, it is possible to provide some 957In addition to environment variables, it is possible to provide some
888shell functions that are called at specific times. To provide your own 958shell functions that are called at specific times. To provide your own
889commands, just define the corresponding function. 959commands, just define the corresponding function.
960
961The actual order in which hooks are invoked during a full install
962from scratch is C<preconfigure>, C<patchconfig>, C<postconfigure>,
963C<postbuild>, C<postinstall>.
890 964
891Example: install extra modules from CPAN and from some directories 965Example: install extra modules from CPAN and from some directories
892at F<staticperl install> time. 966at F<staticperl install> time.
893 967
894 postinstall() { 968 postinstall() {
901 975
902=over 4 976=over 4
903 977
904=item preconfigure 978=item preconfigure
905 979
906Called just before running F<./Configur> in the perl source 980Called just before running F<./Configure> in the perl source
907directory. Current working directory is the perl source directory. 981directory. Current working directory is the perl source directory.
908 982
909This can be used to set any C<PERL_xxx> variables, which might be costly 983This can be used to set any C<PERL_xxx> variables, which might be costly
910to compute. 984to compute.
911 985
986=item patchconfig
987
988Called after running F<./Configure> in the perl source directory to create
989F<./config.sh>, but before running F<./Configure -S> to actually apply the
990config. Current working directory is the perl source directory.
991
992Can be used to tailor/patch F<config.sh> or do any other modifications.
993
912=item postconfigure 994=item postconfigure
913 995
914Called after configuring, but before building perl. Current working 996Called after configuring, but before building perl. Current working
915directory is the perl source directory. 997directory is the perl source directory.
916
917Could be used to tailor/patch config.sh (followed by F<sh Configure -S>)
918or do any other modifications.
919 998
920=item postbuild 999=item postbuild
921 1000
922Called after building, but before installing perl. Current working 1001Called after building, but before installing perl. Current working
923directory is the perl source directory. 1002directory is the perl source directory.
1130 1209
1131Some functionality in the utf8 module, such as swash handling (used 1210Some functionality in the utf8 module, such as swash handling (used
1132for unicode character ranges in regexes) is implemented in the 1211for unicode character ranges in regexes) is implemented in the
1133C<"utf8_heavy.pl"> library: 1212C<"utf8_heavy.pl"> library:
1134 1213
1135 -M'"utf8_heavy.pl"' 1214 -Mutf8_heavy.pl
1136 1215
1137Many Unicode properties in turn are defined in separate modules, 1216Many Unicode properties in turn are defined in separate modules,
1138such as C<"unicore/Heavy.pl"> and more specific data tables such as 1217such as C<"unicore/Heavy.pl"> and more specific data tables such as
1139C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables 1218C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables
1140are big (7MB uncompressed, although F<staticperl> contains special 1219are big (7MB uncompressed, although F<staticperl> contains special
1159C<"AnyEvent/Util/uts46data.pl">. 1238C<"AnyEvent/Util/uts46data.pl">.
1160 1239
1161Or you can use C<--usepacklists> and specify C<-MAnyEvent> to include 1240Or you can use C<--usepacklists> and specify C<-MAnyEvent> to include
1162everything. 1241everything.
1163 1242
1243=item Cairo
1244
1245See Glib, same problem, same solution.
1246
1164=item Carp 1247=item Carp
1165 1248
1166Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of 1249Carp had (in older versions of perl) a dependency on L<Carp::Heavy>. As of
1167perl 5.12.2 (maybe earlier), this dependency no longer exists. 1250perl 5.12.2 (maybe earlier), this dependency no longer exists.
1168 1251
1169=item Config 1252=item Config
1170 1253
1171The F<perl -V> switch (as well as many modules) needs L<Config>, which in 1254The F<perl -V> switch (as well as many modules) needs L<Config>, which in
1172turn might need L<"Config_heavy.pl">. Including the latter gives you 1255turn might need L<"Config_heavy.pl">. Including the latter gives you
1173both. 1256both.
1257
1258=item Glib
1259
1260Glib literally requires Glib to be installed already to build - it tries
1261to fake this by running Glib out of the build directory before being
1262built. F<staticperl> tries to work around this by forcing C<MAN1PODS> and
1263C<MAN3PODS> to be empty via the C<PERL_MM_OPT> environment variable.
1264
1265=item Gtk2
1266
1267See Pango, same problems, same solution.
1268
1269=item Pango
1270
1271In addition to the C<MAN3PODS> problem in Glib, Pango also routes around
1272L<ExtUtils::MakeMaker> by compiling its files on its own. F<staticperl>
1273tries to patch L<ExtUtils::MM_Unix> to route around Pango.
1174 1274
1175=item Term::ReadLine::Perl 1275=item Term::ReadLine::Perl
1176 1276
1177Also needs L<Term::ReadLine::readline>, or C<--usepacklists>. 1277Also needs L<Term::ReadLine::readline>, or C<--usepacklists>.
1178 1278

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines