1Alien::Base::Wrapper(3)User Contributed Perl DocumentatioAnlien::Base::Wrapper(3)
2
3
4
6 Alien::Base::Wrapper - Compiler and linker wrapper for Alien
7
9 version 1.55
10
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 (non-dynamic):
18
19 use ExtUtils::MakeMaker;
20 use Alien::Base::Wrapper qw( Alien::Foo Alien::Bar !export );
21
22 WriteMakefile(
23 'NAME' => 'Foo::XS',
24 'VERSION_FROM' => 'lib/Foo/XS.pm',
25 'CONFIGURE_REQUIRES => {
26 'ExtUtils::MakeMaker' => 6.52,
27 'Alien::Foo' => 0,
28 'Alien::Bar' => 0,
29 },
30 Alien::Base::Wrapper->mm_args,
31 );
32
33 From Makefile.PL (dynamic):
34
35 use Devel::CheckLib qw( check_lib );
36 use ExtUtils::MakeMaker 6.52;
37
38 my @mm_args;
39 my @libs;
40
41 if(check_lib( lib => [ 'foo' ] )
42 {
43 push @mm_args, LIBS => [ '-lfoo' ];
44 }
45 else
46 {
47 push @mm_args,
48 CC => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e cc --',
49 LD => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e ld --',
50 BUILD_REQUIRES => {
51 'Alien::Foo' => 0,
52 'Alien::Base::Wrapper' => 0,
53 }
54 ;
55 }
56
57 WriteMakefile(
58 'NAME' => 'Foo::XS',
59 'VERSION_FROM' => 'lib/Foo/XS.pm',
60 'CONFIGURE_REQUIRES => {
61 'ExtUtils::MakeMaker' => 6.52,
62 },
63 @mm_args,
64 );
65
67 This module acts as a wrapper around one or more Alien modules. It is
68 designed to work with Alien::Base based aliens, but it should work with
69 any Alien which uses the same essential API.
70
71 In the first example (from the command line), this class acts as a
72 wrapper around the compiler and linker that Perl is configured to use.
73 It takes the normal compiler and linker flags and adds the flags
74 provided by the Aliens specified, and then executes the command. It
75 will print the command to the console so that you can see exactly what
76 is happening.
77
78 In the second example (from Makefile.PL non-dynamic), this class is
79 used to generate the appropriate ExtUtils::MakeMaker (EUMM) arguments
80 needed to "WriteMakefile".
81
82 In the third example (from Makefile.PL dynamic), we do a quick check to
83 see if the simple linker flag "-lfoo" will work, if so we use that. If
84 not, we use a wrapper around the compiler and linker that will use the
85 alien flags that are known at build time. The problem that this form
86 attempts to solve is that compiler and linker flags typically need to
87 be determined at configure time, when a distribution is installed,
88 meaning if you are going to use an Alien module then it needs to be a
89 configure prerequisite, even if the library is already installed and
90 easily detected on the operating system.
91
92 The author of this module believes that the third (from Makefile.PL
93 dynamic) form is somewhat unnecessary. Alien modules based on
94 Alien::Base have a few prerequisites, but they are well maintained and
95 reliable, so while there is a small cost in terms of extra
96 dependencies, the overall reliability thanks to reduced overall
97 complexity.
98
100 cc
101 % perl -MAlien::Base::Wrapper=Alien::Foo -e cc -- cflags
102
103 Invoke the C compiler with the appropriate flags from "Alien::Foo" and
104 what is provided on the command line.
105
106 ld
107 % perl -MAlien::Base::Wrapper=Alien::Foo -e ld -- ldflags
108
109 Invoke the linker with the appropriate flags from "Alien::Foo" and what
110 is provided on the command line.
111
112 mm_args
113 my %args = Alien::Base::Wrapper->mm_args;
114
115 Returns arguments that you can pass into "WriteMakefile" to
116 compile/link against the specified Aliens.
117
118 mb_args
119 my %args = Alien::Base::Wrapper->mb_args;
120
121 Returns arguments that you can pass into the constructor to
122 Module::Build.
123
125 Alien::Base::Wrapper responds to these environment variables:
126
127 ALIEN_BASE_WRAPPER_QUIET
128 If set to true, do not print the command before executing
129
131 Alien::Base, Alien::Base
132
134 Author: Graham Ollis <plicease@cpan.org>
135
136 Contributors:
137
138 Diab Jerius (DJERIUS)
139
140 Roy Storey
141
142 Ilya Pavlov
143
144 David Mertens (run4flat)
145
146 Mark Nunberg (mordy, mnunberg)
147
148 Christian Walde (Mithaldu)
149
150 Brian Wightman (MidLifeXis)
151
152 Zaki Mughal (zmughal)
153
154 mohawk (mohawk2, ETJ)
155
156 Vikas N Kumar (vikasnkumar)
157
158 Flavio Poletti (polettix)
159
160 Salvador Fandiño (salva)
161
162 Gianni Ceccarelli (dakkar)
163
164 Pavel Shaydo (zwon, trinitum)
165
166 Kang-min Liu (劉康民, gugod)
167
168 Nicholas Shipp (nshp)
169
170 Juan Julián Merelo Guervós (JJ)
171
172 Joel Berger (JBERGER)
173
174 Petr Pisar (ppisar)
175
176 Lance Wicks (LANCEW)
177
178 Ahmad Fatoum (a3f, ATHREEF)
179
180 José Joaquín Atria (JJATRIA)
181
182 Duke Leto (LETO)
183
184 Shoichi Kaji (SKAJI)
185
186 Shawn Laffan (SLAFFAN)
187
188 Paul Evans (leonerd, PEVANS)
189
191 This software is copyright (c) 2011-2018 by Graham Ollis.
192
193 This is free software; you can redistribute it and/or modify it under
194 the same terms as the Perl 5 programming language system itself.
195
196
197
198perl v5.28.1 2019-02-24 Alien::Base::Wrapper(3)