Mini Shell
Direktori : /usr/local/share/man/man3/ |
|
Current File : //usr/local/share/man/man3/Alien::Base::Wrapper.3pm |
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Alien::Base::Wrapper 3"
.TH Alien::Base::Wrapper 3 "2024-10-29" "perl v5.32.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Alien::Base::Wrapper \- Compiler and linker wrapper for Alien
.SH "VERSION"
.IX Header "VERSION"
version 2.84
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
From the command line:
.PP
.Vb 2
\& % perl \-MAlien::Base::Wrapper=Alien::Foo,Alien::Bar \-e cc \-\- \-o foo.o \-c foo.c
\& % perl \-MAlien::Base::Wrapper=Alien::Foo,Alien::Bar \-e ld \-\- \-o foo foo.o
.Ve
.PP
From Makefile.PL (static):
.PP
.Vb 2
\& use ExtUtils::MakeMaker;
\& use Alien::Base::Wrapper ();
\&
\& WriteMakefile(
\& Alien::Base::Wrapper\->new( \*(AqAlien::Foo\*(Aq, \*(AqAlien::Bar\*(Aq)\->mm_args2(
\& \*(AqNAME\*(Aq => \*(AqFoo::XS\*(Aq,
\& \*(AqVERSION_FROM\*(Aq => \*(Aqlib/Foo/XS.pm\*(Aq,
\& ),
\& );
.Ve
.PP
From Makefile.PL (static with wrapper)
.PP
.Vb 1
\& use Alien::Base::Wrapper qw( WriteMakefile);
\&
\& WriteMakefile(
\& \*(AqNAME\*(Aq => \*(AqFoo::XS\*(Aq,
\& \*(AqVERSION_FROM\*(Aq => \*(Aqlib/Foo/XS.pm\*(Aq,
\& \*(Aqalien_requires\*(Aq => {
\& \*(AqAlien::Foo\*(Aq => 0,
\& \*(AqAlien::Bar\*(Aq => 0,
\& },
\& );
.Ve
.PP
From Makefile.PL (dynamic):
.PP
.Vb 2
\& use Devel::CheckLib qw( check_lib );
\& use ExtUtils::MakeMaker 6.52;
\&
\& my @mm_args;
\& my @libs;
\&
\& if(check_lib( lib => [ \*(Aqfoo\*(Aq ] )
\& {
\& push @mm_args, LIBS => [ \*(Aq\-lfoo\*(Aq ];
\& }
\& else
\& {
\& push @mm_args,
\& CC => \*(Aq$(FULLPERL) \-MAlien::Base::Wrapper=Alien::Foo \-e cc \-\-\*(Aq,
\& LD => \*(Aq$(FULLPERL) \-MAlien::Base::Wrapper=Alien::Foo \-e ld \-\-\*(Aq,
\& BUILD_REQUIRES => {
\& \*(AqAlien::Foo\*(Aq => 0,
\& \*(AqAlien::Base::Wrapper\*(Aq => 0,
\& }
\& ;
\& }
\&
\& WriteMakefile(
\& \*(AqNAME\*(Aq => \*(AqFoo::XS\*(Aq,
\& \*(AqVERSION_FROM\*(Aq => \*(Aqlib/Foo/XS.pm\*(Aq,
\& \*(AqCONFIGURE_REQUIRES => {
\& \*(AqExtUtils::MakeMaker\*(Aq => 6.52,
\& },
\& @mm_args,
\& );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module acts as a wrapper around one or more Alien modules. It is designed to work
with Alien::Base based aliens, but it should work with any Alien which uses the same
essential \s-1API.\s0
.PP
In the first example (from the command line), this class acts as a wrapper around the
compiler and linker that Perl is configured to use. It takes the normal compiler and
linker flags and adds the flags provided by the Aliens specified, and then executes the
command. It will print the command to the console so that you can see exactly what is
happening.
.PP
In the second example (from Makefile.PL non-dynamic), this class is used to generate the
appropriate ExtUtils::MakeMaker (\s-1EUMM\s0) arguments needed to \f(CW\*(C`WriteMakefile\*(C'\fR.
.PP
In the third example (from Makefile.PL dynamic), we do a quick check to see if the simple
linker flag \f(CW\*(C`\-lfoo\*(C'\fR will work, if so we use that. If not, we use a wrapper around the
compiler and linker that will use the alien flags that are known at build time. The
problem that this form attempts to solve is that compiler and linker flags typically
need to be determined at \fIconfigure\fR time, when a distribution is installed, meaning
if you are going to use an Alien module then it needs to be a configure prerequisite,
even if the library is already installed and easily detected on the operating system.
.PP
The author of this module believes that the third (from Makefile.PL dynamic) form is
somewhat unnecessary. Alien modules based on Alien::Base have a few prerequisites,
but they are well maintained and reliable, so while there is a small cost in terms of extra
dependencies, the overall reliability thanks to reduced overall complexity.
.SH "CONSTRUCTOR"
.IX Header "CONSTRUCTOR"
.SS "new"
.IX Subsection "new"
.Vb 1
\& my $abw = Alien::Base::Wrapper\->new(@aliens);
.Ve
.PP
Instead of passing the aliens you want to use into this modules import you can create
a non-global instance of \f(CW\*(C`Alien::Base::Wrapper\*(C'\fR using the \s-1OO\s0 interface.
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
.SS "cc"
.IX Subsection "cc"
.Vb 1
\& % perl \-MAlien::Base::Wrapper=Alien::Foo \-e cc \-\- cflags
.Ve
.PP
Invoke the C compiler with the appropriate flags from \f(CW\*(C`Alien::Foo\*(C'\fR and what
is provided on the command line.
.SS "ld"
.IX Subsection "ld"
.Vb 1
\& % perl \-MAlien::Base::Wrapper=Alien::Foo \-e ld \-\- ldflags
.Ve
.PP
Invoke the linker with the appropriate flags from \f(CW\*(C`Alien::Foo\*(C'\fR and what
is provided on the command line.
.SS "mm_args"
.IX Subsection "mm_args"
.Vb 2
\& my %args = $abw\->mm_args;
\& my %args = Alien::Base::Wrapper\->mm_args;
.Ve
.PP
Returns arguments that you can pass into \f(CW\*(C`WriteMakefile\*(C'\fR to compile/link against
the specified Aliens. Note that this does not set \f(CW\*(C`CONFIGURE_REQUIRES\*(C'\fR. You
probably want to use \f(CW\*(C`mm_args2\*(C'\fR below instead for that reason.
.SS "mm_args2"
.IX Subsection "mm_args2"
.Vb 2
\& my %args = $abw\->mm_args2(%args);
\& my %args = Alien::Base::Wrapper\->mm_args2(%args);
.Ve
.PP
Returns arguments that you can pass into \f(CW\*(C`WriteMakefile\*(C'\fR to compile/link against. It works
a little differently from \f(CW\*(C`mm_args\*(C'\fR above in that you can pass in arguments. It also adds
the appropriate \f(CW\*(C`CONFIGURE_REQUIRES\*(C'\fR for you so you do not have to do that explicitly.
.SS "mb_args"
.IX Subsection "mb_args"
.Vb 2
\& my %args = $abw\->mb_args;
\& my %args = Alien::Base::Wrapper\->mb_args;
.Ve
.PP
Returns arguments that you can pass into the constructor to Module::Build.
.SS "WriteMakefile"
.IX Subsection "WriteMakefile"
.Vb 3
\& use Alien::Base::Wrapper qw( WriteMakefile );
\& WriteMakefile(%args, alien_requires => \e%aliens);
\& WriteMakefile(%args, alien_requires => \e@aliens);
.Ve
.PP
This is a thin wrapper around \f(CW\*(C`WriteMakefile\*(C'\fR from ExtUtils::MakeMaker, which adds the
given aliens to the configure requirements and sets the appropriate compiler and linker
flags.
.PP
If the aliens are specified as a hash reference, then the keys are the module names and the
values are the versions. For a list it is just the name of the aliens.
.PP
For the list form you can specify a version by appending \f(CW\*(C`=version\*(C'\fR to the name of the
Aliens, that is:
.PP
.Vb 3
\& WriteMakefile(
\& alien_requires => [ \*(AqAlien::libfoo=1.23\*(Aq, \*(AqAlien::libbar=4.56\*(Aq ],
\& );
.Ve
.PP
The list form is recommended if the ordering of the aliens matter. The aliens are sorted in
the hash form to make it consistent, but it may not be the order that you want.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
Alien::Base::Wrapper responds to these environment variables:
.IP "\s-1ALIEN_BASE_WRAPPER_QUIET\s0" 4
.IX Item "ALIEN_BASE_WRAPPER_QUIET"
If set to true, do not print the command before executing
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Alien::Base, Alien::Base
.SH "AUTHOR"
.IX Header "AUTHOR"
Author: Graham Ollis <plicease@cpan.org>
.PP
Contributors:
.PP
Diab Jerius (\s-1DJERIUS\s0)
.PP
Roy Storey (\s-1KIWIROY\s0)
.PP
Ilya Pavlov
.PP
David Mertens (run4flat)
.PP
Mark Nunberg (mordy, mnunberg)
.PP
Christian Walde (Mithaldu)
.PP
Brian Wightman (MidLifeXis)
.PP
Zaki Mughal (zmughal)
.PP
mohawk (mohawk2, \s-1ETJ\s0)
.PP
Vikas N Kumar (vikasnkumar)
.PP
Flavio Poletti (polettix)
.PP
Salvador Fandiño (salva)
.PP
Gianni Ceccarelli (dakkar)
.PP
Pavel Shaydo (zwon, trinitum)
.PP
Kang-min Liu (劉康民, gugod)
.PP
Nicholas Shipp (nshp)
.PP
Juan Julián Merelo Guervós (\s-1JJ\s0)
.PP
Joel Berger (\s-1JBERGER\s0)
.PP
Petr Písař (ppisar)
.PP
Lance Wicks (\s-1LANCEW\s0)
.PP
Ahmad Fatoum (a3f, \s-1ATHREEF\s0)
.PP
José Joaquín Atria (\s-1JJATRIA\s0)
.PP
Duke Leto (\s-1LETO\s0)
.PP
Shoichi Kaji (\s-1SKAJI\s0)
.PP
Shawn Laffan (\s-1SLAFFAN\s0)
.PP
Paul Evans (leonerd, \s-1PEVANS\s0)
.PP
Håkon Hægland (hakonhagland, \s-1HAKONH\s0)
.PP
nick nauwelaerts (\s-1INPHOBIA\s0)
.PP
Florian Weimer
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This software is copyright (c) 2011\-2022 by Graham Ollis.
.PP
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Zerion Mini Shell 1.0