1Alien::Base::Wrapper(3)User Contributed Perl DocumentatioAnlien::Base::Wrapper(3)
2
3
4

NAME

6       Alien::Base::Wrapper - Compiler and linker wrapper for Alien
7

VERSION

9       version 2.38
10

SYNOPSIS

12       From the command line:
13
14        % perl -MAlien::Base::Wrapper=Alien::Foo,Alien::Bar -e cc -- -o foo.o -c foo.c
15        % perl -MAlien::Base::Wrapper=Alien::Foo,Alien::Bar -e ld -- -o foo foo.o
16
17       From Makefile.PL (static):
18
19        use ExtUtils::MakeMaker;
20        use Alien::Base::Wrapper ();
21
22        WriteMakefile(
23          Alien::Base::Wrapper->new( 'Alien::Foo', 'Alien::Bar')->mm_args2(
24            'NAME'              => 'Foo::XS',
25            'VERSION_FROM'      => 'lib/Foo/XS.pm',
26          ),
27        );
28
29       From Makefile.PL (static with wrapper)
30
31        use Alien::Base::Wrapper qw( WriteMakefile);
32
33        WriteMakefile(
34          'NAME'              => 'Foo::XS',
35          'VERSION_FROM'      => 'lib/Foo/XS.pm',
36          'alien_requires'    => {
37            'Alien::Foo' => 0,
38            'Alien::Bar' => 0,
39          },
40        );
41
42       From Makefile.PL (dynamic):
43
44        use Devel::CheckLib qw( check_lib );
45        use ExtUtils::MakeMaker 6.52;
46
47        my @mm_args;
48        my @libs;
49
50        if(check_lib( lib => [ 'foo' ] )
51        {
52          push @mm_args, LIBS => [ '-lfoo' ];
53        }
54        else
55        {
56          push @mm_args,
57            CC => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e cc --',
58            LD => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e ld --',
59            BUILD_REQUIRES => {
60              'Alien::Foo'           => 0,
61              'Alien::Base::Wrapper' => 0,
62            }
63          ;
64        }
65
66        WriteMakefile(
67          'NAME'         => 'Foo::XS',
68          'VERSION_FROM' => 'lib/Foo/XS.pm',
69          'CONFIGURE_REQUIRES => {
70            'ExtUtils::MakeMaker' => 6.52,
71          },
72          @mm_args,
73        );
74

DESCRIPTION

76       This module acts as a wrapper around one or more Alien modules.  It is
77       designed to work with Alien::Base based aliens, but it should work with
78       any Alien which uses the same essential API.
79
80       In the first example (from the command line), this class acts as a
81       wrapper around the compiler and linker that Perl is configured to use.
82       It takes the normal compiler and linker flags and adds the flags
83       provided by the Aliens specified, and then executes the command.  It
84       will print the command to the console so that you can see exactly what
85       is happening.
86
87       In the second example (from Makefile.PL non-dynamic), this class is
88       used to generate the appropriate ExtUtils::MakeMaker (EUMM) arguments
89       needed to "WriteMakefile".
90
91       In the third example (from Makefile.PL dynamic), we do a quick check to
92       see if the simple linker flag "-lfoo" will work, if so we use that.  If
93       not, we use a wrapper around the compiler and linker that will use the
94       alien flags that are known at build time.  The problem that this form
95       attempts to solve is that compiler and linker flags typically need to
96       be determined at configure time, when a distribution is installed,
97       meaning if you are going to use an Alien module then it needs to be a
98       configure prerequisite, even if the library is already installed and
99       easily detected on the operating system.
100
101       The author of this module believes that the third (from Makefile.PL
102       dynamic) form is somewhat unnecessary.  Alien modules based on
103       Alien::Base have a few prerequisites, but they are well maintained and
104       reliable, so while there is a small cost in terms of extra
105       dependencies, the overall reliability thanks to reduced overall
106       complexity.
107

CONSTRUCTOR

109   new
110        my $abw = Alien::Base::Wrapper->new(@aliens);
111
112       Instead of passing the aliens you want to use into this modules import
113       you can create a non-global instance of "Alien::Base::Wrapper" using
114       the OO interface.
115

FUNCTIONS

117   cc
118        % perl -MAlien::Base::Wrapper=Alien::Foo -e cc -- cflags
119
120       Invoke the C compiler with the appropriate flags from "Alien::Foo" and
121       what is provided on the command line.
122
123   ld
124        % perl -MAlien::Base::Wrapper=Alien::Foo -e ld -- ldflags
125
126       Invoke the linker with the appropriate flags from "Alien::Foo" and what
127       is provided on the command line.
128
129   mm_args
130        my %args = $abw->mm_args;
131        my %args = Alien::Base::Wrapper->mm_args;
132
133       Returns arguments that you can pass into "WriteMakefile" to
134       compile/link against the specified Aliens.  Note that this does not set
135       "CONFIGURE_REQUIRES".  You probably want to use "mm_args2" below
136       instead for that reason.
137
138   mm_args2
139        my %args = $abw->mm_args2(%args);
140        my %args = Alien::Base::Wrapper->mm_args2(%args);
141
142       Returns arguments that you can pass into "WriteMakefile" to
143       compile/link against.  It works a little differently from "mm_args"
144       above in that you can pass in arguments.  It also adds the appropriate
145       "CONFIGURE_REQUIRES" for you so you do not have to do that explicitly.
146
147   mb_args
148        my %args = $abw->mb_args;
149        my %args = Alien::Base::Wrapper->mb_args;
150
151       Returns arguments that you can pass into the constructor to
152       Module::Build.
153
154   WriteMakefile
155        use Alien::Base::Wrapper qw( WriteMakefile );
156        WriteMakefile(%args, alien_requires => %aliens);
157        WriteMakefile(%args, alien_requires => @aliens);
158
159       This is a thin wrapper around "WriteMakefile" from ExtUtils::MakeMaker,
160       which adds the given aliens to the configure requirements and sets the
161       appropriate compiler and linker flags.
162
163       If the aliens are specified as a hash reference, then the keys are the
164       module names and the values are the versions.  For a list it is just
165       the name of the aliens.
166
167       For the list form you can specify a version by appending "=version" to
168       the name of the Aliens, that is:
169
170        WriteMakefile(
171          alien_requires => [ 'Alien::libfoo=1.23', 'Alien::libbar=4.56' ],
172        );
173
174       The list form is recommended if the ordering of the aliens matter.  The
175       aliens are sorted in the hash form to make it consistent, but it may
176       not be the order that you want.
177

ENVIRONMENT

179       Alien::Base::Wrapper responds to these environment variables:
180
181       ALIEN_BASE_WRAPPER_QUIET
182           If set to true, do not print the command before executing
183

SEE ALSO

185       Alien::Base, Alien::Base
186

AUTHOR

188       Author: Graham Ollis <plicease@cpan.org>
189
190       Contributors:
191
192       Diab Jerius (DJERIUS)
193
194       Roy Storey (KIWIROY)
195
196       Ilya Pavlov
197
198       David Mertens (run4flat)
199
200       Mark Nunberg (mordy, mnunberg)
201
202       Christian Walde (Mithaldu)
203
204       Brian Wightman (MidLifeXis)
205
206       Zaki Mughal (zmughal)
207
208       mohawk (mohawk2, ETJ)
209
210       Vikas N Kumar (vikasnkumar)
211
212       Flavio Poletti (polettix)
213
214       Salvador Fandiño (salva)
215
216       Gianni Ceccarelli (dakkar)
217
218       Pavel Shaydo (zwon, trinitum)
219
220       Kang-min Liu (劉康民, gugod)
221
222       Nicholas Shipp (nshp)
223
224       Juan Julián Merelo Guervós (JJ)
225
226       Joel Berger (JBERGER)
227
228       Petr Pisar (ppisar)
229
230       Lance Wicks (LANCEW)
231
232       Ahmad Fatoum (a3f, ATHREEF)
233
234       José Joaquín Atria (JJATRIA)
235
236       Duke Leto (LETO)
237
238       Shoichi Kaji (SKAJI)
239
240       Shawn Laffan (SLAFFAN)
241
242       Paul Evans (leonerd, PEVANS)
243
244       Håkon Hægland (hakonhagland, HAKONH)
245
247       This software is copyright (c) 2011-2020 by Graham Ollis.
248
249       This is free software; you can redistribute it and/or modify it under
250       the same terms as the Perl 5 programming language system itself.
251
252
253
254perl v5.32.0                      2021-01-12           Alien::Base::Wrapper(3)
Impressum