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.10 by root, Tue Dec 7 09:27:54 2010 UTC vs.
Revision 1.15 by root, Wed Dec 8 23:01:30 2010 UTC

14 staticperl cpan # invoke CPAN shell 14 staticperl cpan # invoke CPAN shell
15 staticperl instmod path... # install unpacked modules 15 staticperl instmod path... # install unpacked modules
16 staticperl instcpan modulename... # install modules from CPAN 16 staticperl instcpan modulename... # install modules from CPAN
17 staticperl mkbundle <bundle-args...> # see documentation 17 staticperl mkbundle <bundle-args...> # see documentation
18 staticperl mkperl <bundle-args...> # see documentation 18 staticperl mkperl <bundle-args...> # see documentation
19 staticperl mkapp appname <bundle-args...> # see documentation
19 20
20Typical Examples: 21Typical Examples:
21 22
22 staticperl install # fetch, configure, build and install perl 23 staticperl install # fetch, configure, build and install perl
23 staticperl cpan # run interactive cpan shell 24 staticperl cpan # run interactive cpan shell
24 staticperl mkperl -M '"Config_heavy.pl"' # build a perl that supports -V 25 staticperl mkperl -M '"Config_heavy.pl"' # build a perl that supports -V
25 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http 26 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
26 # build a perl with the above modules linked in 27 # build a perl with the above modules linked in
28 staticperl mkapp myapp --boot mainprog mymodules
29 # build a binary "myapp" from mainprog and mymodules
27 30
28=head1 DESCRIPTION 31=head1 DESCRIPTION
29 32
30This script helps you creating single-file perl interpreters, or embedding 33This script helps you creating single-file perl interpreters, or embedding
31a perl interpreter in your applications. Single-file means that it is 34a perl interpreter in your applications. Single-file means that it is
81Maintaining your own custom perl build can be a pain in the ass, and while 84Maintaining your own custom perl build can be a pain in the ass, and while
82F<staticperl> tries to make this easy, it still requires a custom perl 85F<staticperl> tries to make this easy, it still requires a custom perl
83build and possibly fiddling with some modules. PAR is likely to produce 86build and possibly fiddling with some modules. PAR is likely to produce
84results faster. 87results faster.
85 88
89Ok, PAR never has worked for me out of the box, and for some people,
90F<staticperl> does work out of the box, as they don't count "fiddling with
91module use lists" against it, but nevertheless, F<staticperl> is certainly
92a bit more difficult to use.
93
86=back 94=back
87 95
88=head1 HOW DOES IT WORK? 96=head1 HOW DOES IT WORK?
89 97
90Simple: F<staticperl> downloads, compile and installs a perl version of 98Simple: F<staticperl> downloads, compile and installs a perl version of
184command by specifying all the directories with modules in them that you 192command by specifying all the directories with modules in them that you
185want to have built. 193want to have built.
186 194
187=item F<staticperl clean> 195=item F<staticperl clean>
188 196
189Runs F<make distclean> in the perl source directory (and potentially 197Deletes the perl source directory (and potentially cleans up other
190cleans up other intermediate files). This can be used to clean up 198intermediate files). This can be used to clean up files only needed for
191intermediate files without removing the installed perl interpreter. 199building perl, without removing the installed perl interpreter, or to
200force a re-build from scratch.
201
202At the moment, it doesn't delete downloaded tarballs.
192 203
193=item F<staticperl distclean> 204=item F<staticperl distclean>
194 205
195This wipes your complete F<~/.staticperl> directory. Be careful with this, 206This wipes your complete F<~/.staticperl> directory. Be careful with this,
196it nukes your perl download, perl sources, perl distribution and any 207it nukes your perl download, perl sources, perl distribution and any
236(required by L<AnyEvent::HTTPD>) implements various URI schemes as extra 247(required by L<AnyEvent::HTTPD>) implements various URI schemes as extra
237modules - since L<AnyEvent::HTTPD> only needs C<http> URIs, we only need 248modules - since L<AnyEvent::HTTPD> only needs C<http> URIs, we only need
238to include that module. I found out about these dependencies by carefully 249to include that module. I found out about these dependencies by carefully
239watching any error messages about missing modules... 250watching any error messages about missing modules...
240 251
252Instead of building a new perl binary, you can also build a standalone
253application:
254
255 # build the app
256 staticperl mkapp app --boot eg/httpd \
257 -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI::http
258
259 # run it
260 ./app
261
241=head3 OPTION PROCESSING 262=head3 OPTION PROCESSING
242 263
243All options can be given as arguments on the command line (typically 264All options can be given as arguments on the command line (typically
244using long (e.g. C<--verbose>) or short option (e.g. C<-v>) style). Since 265using long (e.g. C<--verbose>) or short option (e.g. C<-v>) style). Since
245specifying a lot of modules can make the command line very cumbersome, 266specifying a lot of modules can make the command line very cumbersome,
304C<mkperl> command (instead of C<mkbundle>): 325C<mkperl> command (instead of C<mkbundle>):
305 326
306 # build a new ./perl with only common::sense in it - very small :) 327 # build a new ./perl with only common::sense in it - very small :)
307 staticperl mkperl -Mcommon::sense 328 staticperl mkperl -Mcommon::sense
308 329
330=item --app name
331
332After writing out the bundle files, try to link a new standalone
333program. It will be called C<name>, and the bundle files get removed after
334linking it.
335
336The difference to the (mutually exclusive) C<--perl> option is that the
337binary created by this option will not try to act as a perl interpreter -
338instead it will simply initialise the perl interpreter, clean it up and
339exit.
340
341This switch is automatically used when F<staticperl> is invoked with the
342C<mkapp> command (instead of C<mkbundle>):
343
344To let it do something useful you I<must> add some boot code, e.g. with
345the C<--boot> option.
346
347Example: create a standalone perl binary that will execute F<appfile> when
348it is started.
349
350 staticperl mkbundle --app myexe --boot appfile
351
309=item --use module | -Mmodule 352=item --use module | -Mmodule
310 353
311Include the named module and all direct dependencies. This is done by 354Include the named module and all direct dependencies. This is done by
312C<require>'ing the module in a subprocess and tracing which other modules 355C<require>'ing the module in a subprocess and tracing which other modules
313and files it actually loads. If the module uses L<AutoLoader>, then all 356and files it actually loads. If the module uses L<AutoLoader>, then all
415Any other argument is interpreted as a bundle specification file, which 458Any other argument is interpreted as a bundle specification file, which
416supports most long options (without extra quoting), one option per line. 459supports most long options (without extra quoting), one option per line.
417 460
418=back 461=back
419 462
420=head2 F<STATCPERL> CONFIGURATION AND HOOKS 463=head2 F<STATICPERL> CONFIGURATION AND HOOKS
421 464
422During (each) startup, F<staticperl> tries to source the following shell 465During (each) startup, F<staticperl> tries to source the following shell
423files in order: 466files in order:
424 467
425 /etc/staticperlrc 468 /etc/staticperlrc
441=item C<EMAIL> 484=item C<EMAIL>
442 485
443The e-mail address of the person who built this binary. Has no good 486The e-mail address of the person who built this binary. Has no good
444default, so should be specified by you. 487default, so should be specified by you.
445 488
489=item C<CPAN>
490
491The URL of the CPAN mirror to use (e.g. L<http://mirror.netcologne.de/cpan/>).
492
493=item C<EXTRA_MODULES>
494
495Additional modules installed during F<staticperl install>. Here you can
496set which modules you want have to installed from CPAN.
497
498Example: I really really need EV, AnyEvent, Coro and AnyEvent::AIO.
499
500 EXTRA_MODULES="EV AnyEvent Coro AnyEvent::AIO"
501
502Note that you can also use a C<postinstall> hook to achieve this, and
503more.
504
446=back 505=back
447 506
448=head4 Variables you might I<want> to override 507=head4 Variables you might I<want> to override
449 508
450=over 4 509=over 4
451 510
511=item C<STATICPERL>
512
513The directory where staticperl stores all its files
514(default: F<~/.staticperl>).
515
516=item C<PERL_MM_USE_DEFAULT>, C<EV_EXTRA_DEFS>, ...
517
518Usually set to C<1> to make modules "less inquisitive" during their
519installation, you can set any environment variable you want - some modules
520(such as L<Coro> or L<EV>) use environment variables for further tweaking.
521
452=item C<PERLVER> 522=item C<PERL_VERSION>
453 523
454The perl version to install - default is currently C<5.12.2>, but C<5.8.9> 524The perl version to install - default is currently C<5.12.2>, but C<5.8.9>
455is also a good choice (5.8.9 is much smaller than 5.12.2, while 5.10.1 is 525is also a good choice (5.8.9 is much smaller than 5.12.2, while 5.10.1 is
456about as big as 5.12.2). 526about as big as 5.12.2).
457 527
458=item C<CPAN>
459
460The URL of the CPAN mirror to use (e.g. L<http://mirror.netcologne.de/cpan/>).
461
462=item C<EXTRA_MODULES>
463
464Additional modules installed during F<staticperl install>. Here you can
465set which modules you want have to installed from CPAN.
466
467Example: I really really need EV, AnyEvent, Coro and IO::AIO.
468
469 EXTRA_MODULES="EV AnyEvent Coro IO::AIO"
470
471Note that you can also use a C<postinstall> hook to achieve this, and
472more.
473
474=item C<PERL_MM_USE_DEFAULT>, C<EV_EXTRA_DEFS>, ...
475
476Usually set to C<1> to make modules "less inquisitive" during their
477installation, you can set any environment variable you want - some modules
478(such as L<Coro> or L<EV>) use environment variables for further tweaking.
479
480=item C<STATICPERL>
481
482The directory where staticperl stores all its files
483(default: F<~/.staticperl>).
484
485=item C<PREFIX> 528=item C<PERL_PREFIX>
486 529
487The prefix where perl gets installed (default: F<$STATICPERL/perl>), 530The prefix where perl gets installed (default: F<$STATICPERL/perl>),
488i.e. where the F<bin> and F<lib> subdirectories will end up. 531i.e. where the F<bin> and F<lib> subdirectories will end up.
489 532
490=item C<PERL_CONFIGURE> 533=item C<PERL_CONFIGURE>
542 instcpan Anyevent::AIO AnyEvent::HTTPD 585 instcpan Anyevent::AIO AnyEvent::HTTPD
543 } 586 }
544 587
545=over 4 588=over 4
546 589
590=item preconfigure
591
592Called just before running F<./Configur> in the perl source
593directory. Current working directory is the perl source directory.
594
595This can be used to set any C<PERL_xxx> variables, which might be costly
596to compute.
597
547=item postconfigure 598=item postconfigure
548 599
549Called after configuring, but before building perl. Current working 600Called after configuring, but before building perl. Current working
550directory is the perl source directory. 601directory is the perl source directory.
551 602
552Could be used to tailor/patch config.sh (followed by F<./Configure -S>) or 603Could be used to tailor/patch config.sh (followed by F<sh Configure -S>)
553do any other modifications. 604or do any other modifications.
554 605
555=item postbuild 606=item postbuild
556 607
557Called after building, but before installing perl. Current working 608Called after building, but before installing perl. Current working
558directory is the perl source directory. 609directory is the perl source directory.
707If you use C<linuxthreads.old>, then you should also be aware that 758If you use C<linuxthreads.old>, then you should also be aware that
708uClibc shares C<errno> between all threads when statically linking. See 759uClibc shares C<errno> between all threads when statically linking. See
709L<http://lists.uclibc.org/pipermail/uclibc/2010-June/044157.html> for a 760L<http://lists.uclibc.org/pipermail/uclibc/2010-June/044157.html> for a
710workaround (And L<https://bugs.uclibc.org/2089> for discussion). 761workaround (And L<https://bugs.uclibc.org/2089> for discussion).
711 762
712C<ccache> support is also recommended, especially if you want to 763C<ccache> support is also recommended, especially if you want
713play around with buildroot options. Enabling the C<miniperl> package 764to play around with buildroot options. Enabling the C<miniperl>
714will probably enable all options required for a successful perl 765package will probably enable all options required for a successful
715build. F<staticperl> itself additionally needs either C<wget> or C<curl>. 766perl build. F<staticperl> itself additionally needs either C<wget>
767(recommended, for CPAN) or C<curl>.
716 768
717As for shells, busybox should provide all that is needed, but the default 769As for shells, busybox should provide all that is needed, but the default
718busybox configuration doesn't include F<comm> which is needed by perl - 770busybox configuration doesn't include F<comm> which is needed by perl -
719either make a custom busybox config, or compile coreutils. 771either make a custom busybox config, or compile coreutils.
720 772

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines