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