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.27 by root, Tue Dec 21 19:32:34 2010 UTC vs.
Revision 1.28 by root, Tue Dec 21 19:44:43 2010 UTC

389 389
390Example: include AnyEvent and AnyEvent::Impl::Perl. 390Example: include AnyEvent and AnyEvent::Impl::Perl.
391 391
392 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl 392 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl
393 393
394Sometimes you want to load old-style "perl libraries" (F<.pl> files), or 394Sometimes you want to load old-style "perl libraries" (F<.pl> files),
395maybe other weirdly named files. To do that, you need to quote the name in 395or maybe other weirdly named files. To do that, you need to quote
396single or double quotes. When given on the command line, you probably need 396the name in single or double quotes (this is because F<staticperl>
397to quote once more to avoid your shell interpreting it. Common cases that 397I<literally> just adds the string after the C<require> - which acts
398need this are F<Config_heavy.pl> and F<utf8_heavy.pl>. 398different when confronted with quoted vs. unquoted strings). When given on
399the command line, you probably need to quote once more to avoid your shell
400interpreting it. Common cases that need this are F<Config_heavy.pl> and
401F<utf8_heavy.pl>.
399 402
400Example: include the required files for F<perl -V> to work in all its 403Example: include the required files for F<perl -V> to work in all its
401glory (F<Config.pm> is included automatically by this). 404glory (F<Config.pm> is included automatically by this).
402 405
403 # bourne shell 406 # bourne shell
404 staticperl mkbundle --use '"Config_heavy.pl"' 407 staticperl mkbundle --use '"Config_heavy.pl"'
405 408
406 # bundle specification file 409 # bundle specification file
407 use "Config_heavy.pl" 410 use "Config_heavy.pl"
408 411
409The C<-M>module syntax is included as an alias that might be easier to 412The C<-M>module syntax is included as a convenience that might be easier
410remember than C<--use>. Or maybe it confuses people. Time will tell. Or 413to 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
411maybe not. Sigh. 415not. Sigh.
412 416
413=item C<--eval> "perl code" | C<-e> "perl code" 417=item C<--eval> "perl code" | C<-e> "perl code"
414 418
415Sometimes it is easier (or necessary) to specify dependencies using perl 419Sometimes it is easier (or necessary) to specify dependencies using perl
416code, or maybe one of the modules you use need a special use statement. In 420code, or maybe one of the modules you use need a special use statement. In
455This is very useful to include "everything": 459This is very useful to include "everything":
456 460
457 --incglob '*' 461 --incglob '*'
458 462
459It is also useful for including perl libraries, or trees of those, such as 463It is also useful for including perl libraries, or trees of those, such as
460the unicode database files needed by some perl builtins, the regex engine 464the unicode database files needed by some perl built-ins, the regex engine
461and other modules. 465and other modules.
462 466
463 --incglob '/unicore/**.pl' 467 --incglob '/unicore/**.pl'
464 468
465=item C<--add> F<file> | C<--add> "F<file> alias" 469=item C<--add> F<file> | C<--add> "F<file> alias"
466 470
467Adds the given (perl) file into the bundle (and optionally call it 471Adds the given (perl) file into the bundle (and optionally call it
468"alias"). The F<file> is either an absolute path or a path relative to 472"alias"). The F<file> is either an absolute path or a path relative to
469the current directory. If an alias is specified, then this is the name it 473the current directory. If an alias is specified, then this is the name it
470will use for C<@INC> searches, otherfile the F<file> will be used as the 474will use for C<@INC> searches, otherwise the F<file> will be used as the
471internal name. 475internal name.
472 476
473This switch is used to include extra files into the bundle. 477This switch is used to include extra files into the bundle.
474 478
475Example: embed the file F<httpd> in the current directory as F<httpd.pm> 479Example: embed the file F<httpd> in the current directory as F<httpd.pm>
518 522
519=item Step 2: filter all files using C<--include> and C<--exclude> options. 523=item Step 2: filter all files using C<--include> and C<--exclude> options.
520 524
521After all candidate files and modules are added, they are I<filtered> 525After all candidate files and modules are added, they are I<filtered>
522by a combination of C<--include> and C<--exclude> patterns (there is an 526by a combination of C<--include> and C<--exclude> patterns (there is an
523implicit C<--include **> at the end, so if no filters are specified, all 527implicit C<--include *> at the end, so if no filters are specified, all
524files are included). 528files are included).
525 529
526All that this step does is potentially reduce the number of files that are 530All that this step does is potentially reduce the number of files that are
527to be included - no new files are added during this step. 531to be included - no new files are added during this step.
528 532
631Last not least, if you need accurate line numbers in error messages, 635Last not least, if you need accurate line numbers in error messages,
632or in the unlikely case where C<pod> is too slow, or some module gets 636or in the unlikely case where C<pod> is too slow, or some module gets
633mistreated, you can specify C<none> to not mangle included perl sources in 637mistreated, you can specify C<none> to not mangle included perl sources in
634any way. 638any way.
635 639
636=item --perl 640=item C<--perl>
637 641
638After writing out the bundle files, try to link a new perl interpreter. It 642After writing out the bundle files, try to link a new perl interpreter. It
639will be called F<perl> and will be left in the current working 643will be called F<perl> and will be left in the current working
640directory. The bundle files will be removed. 644directory. The bundle files will be removed.
641 645
646it will be even smaller than the standard perl interpreter as none of the 650it will be even smaller than the standard perl interpreter as none of the
647modules of the base distribution (such as L<Fcntl>) will be included. 651modules of the base distribution (such as L<Fcntl>) will be included.
648 652
649 staticperl mkperl -Mcommon::sense 653 staticperl mkperl -Mcommon::sense
650 654
651=item --app name 655=item C<--app> F<name>
652 656
653After writing out the bundle files, try to link a new standalone 657After writing out the bundle files, try to link a new standalone
654program. It will be called C<name>, and the bundle files get removed after 658program. It will be called C<name>, and the bundle files get removed after
655linking it. 659linking it.
656 660
669Example: create a standalone perl binary called F<./myexe> that will 673Example: create a standalone perl binary called F<./myexe> that will
670execute F<appfile> when it is started. 674execute F<appfile> when it is started.
671 675
672 staticperl mkbundle --app myexe --boot appfile 676 staticperl mkbundle --app myexe --boot appfile
673 677
674=item --static 678=item C<--static>
675 679
676Add C<-static> to F<bundle.ldopts>, which means a fully static (if 680Add C<-static> to F<bundle.ldopts>, which means a fully static (if
677supported by the OS) executable will be created. This is not immensely 681supported by the OS) executable will be created. This is not immensely
678useful when just creating the bundle files, but is most useful when 682useful when just creating the bundle files, but is most useful when
679linking a binary with the C<--perl> or C<--app> options. 683linking a binary with the C<--perl> or C<--app> options.
686systems based on GNU libc don't really support it in a very usable 690systems based on GNU libc don't really support it in a very usable
687fashion either. Try uClibc if you want to create fully statically linked 691fashion either. Try uClibc if you want to create fully statically linked
688executables, or try the C<--staticlib> option to link only some libraries 692executables, or try the C<--staticlib> option to link only some libraries
689statically. 693statically.
690 694
691=item --staticlib libname 695=item C<--staticlib> libname
692 696
693When not linking fully statically, this option allows you to link specific 697When not linking fully statically, this option allows you to link specific
694libraries statically. What it does is simply replace all occurances of 698libraries statically. What it does is simply replace all occurrences of
695C<-llibname> with the GCC-specific C<-Wl,-Bstatic -llibname -Wl,-Bdynamic> 699C<-llibname> with the GCC-specific C<-Wl,-Bstatic -llibname -Wl,-Bdynamic>
696option. 700option.
697 701
698This will have no effect unless the library is actually linked against, 702This will have no effect unless the library is actually linked against,
699specifically, C<--staticlib> will not link against the named library 703specifically, C<--staticlib> will not link against the named library
700unless it would be linked against anyway. 704unless it would be linked against anyway.
701 705
702Example: link libcrypt statically into the binary. 706Example: link libcrypt statically into the final binary.
703 707
704 staticperl mkperl -MIO::AIO --staticlib crypt 708 staticperl mkperl -MIO::AIO --staticlib crypt
705 709
706 # ldopts might now contain: 710 # ldopts might now contain:
707 # -lm -Wl,-Bstatic -lcrypt -Wl,-Bdynamic -lpthread 711 # -lm -Wl,-Bstatic -lcrypt -Wl,-Bdynamic -lpthread

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines