1alienfile(3) User Contributed Perl Documentation alienfile(3)
2
3
4
6 alienfile - Specification for defining an external dependency for CPAN
7
9 version 1.55
10
12 Do-it-yourself approach:
13
14 use alienfile;
15
16 probe [ 'pkg-config --exists libarchive' ];
17
18 share {
19
20 start_url 'http://libarchive.org/downloads/libarchive-3.2.2.tar.gz';
21
22 # the first one which succeeds will be used
23 download [ 'wget %{.meta.start_url}' ];
24 download [ 'curl -o %{.meta.start_url}' ];
25
26 extract [ 'tar xf %{.install.download}' ];
27
28 build [
29 # Note: will not work on Windows, better to use Build::Autoconf plugin
30 # if you need windows support
31 './configure --prefix=%{.install.prefix} --disable-shared',
32 '%{make}',
33 '%{make} install',
34 ];
35 }
36
37 gather [
38 [ 'pkg-config', '--modversion', 'libarchive', \'%{.runtime.version}' ],
39 [ 'pkg-config', '--cflags', 'libarchive', \'%{.runtime.cflags}' ],
40 [ 'pkg-config', '--libs', 'libarchive', \'%{.runtime.libs}' ],
41 ];
42
43 With plugins (better):
44
45 use alienfile;
46
47 plugin 'PkgConfig' => 'libarchive';
48
49 share {
50 start_url 'http://libarchive.org/downloads/';
51 plugin Download => (
52 filter => qr/^libarchive-.*\.tar\.gz$/,
53 version => qr/([0-9\.]+)/,
54 );
55 plugin Extract => 'tar.gz';
56 plugin 'Build::Autoconf';
57 build [
58 '%{configure} --disable-shared',
59 '%{make}',
60 '%{make} install',
61 ];
62 };
63
65 An alienfile is a recipe used by Alien::Build to, probe for system
66 libraries or download from the internet, and build source for those
67 libraries.
68
70 requires
71 "any" requirement (either share or system):
72
73 requires $module;
74 requires $module => $version;
75
76 configure time requirement:
77
78 configure {
79 requires $module;
80 requires $module => $version;
81 };
82
83 system requirement:
84
85 sys {
86 requires $module;
87 requires $module => $version;
88 };
89
90 share requirement:
91
92 share {
93 requires $module;
94 requires $module => $version;
95 };
96
97 specifies a requirement. Alien::Build takes advantage of dynamic
98 requirements, so only modules that are needed for the specific type of
99 install need to be loaded. Here are the different types of
100 requirements:
101
102 configure
103 Configure requirements should already be installed before the
104 alienfile is loaded.
105
106 any "Any" requirements are those that are needed either for the probe
107 stage, or in either the system or share installs.
108
109 share
110 Share requirements are those modules needed when downloading and
111 building from source.
112
113 system
114 System requirements are those modules needed when the system
115 provides the library or tool.
116
117 plugin
118 plugin $name => (%args);
119 plugin $name => $arg;
120
121 Load the given plugin. If you prefix the plugin name with an "=" sign,
122 then it will be assumed to be a fully qualified path name. Otherwise
123 the plugin will be assumed to live in the "Alien::Build::Plugin"
124 namespace. If there is an appropriate negotiate plugin, that one will
125 be loaded. Examples:
126
127 # Loads Alien::Build::Plugin::Fetch::Negotiate
128 # which will pick the best Alien::Build::Plugin::Fetch
129 # plugin based on the URL, and system configuration
130 plugin 'Fetch' => 'http://ftp.gnu.org/gnu/gcc';
131
132 # loads the plugin with the badly named class!
133 plugin '=Badly::Named::Plugin::Not::In::Alien::Build::Namespace';
134
135 # explicitly loads Alien::Build::Plugin::Prefer::SortVersions
136 plugin 'Prefer::SortVersions => (
137 filter => qr/^gcc-.*\.tar\.gz$/,
138 version => qr/([0-9\.]+)/,
139 );
140
141 probe
142 probe \&code;
143 probe \@commandlist;
144
145 Instructions for the probe stage. May be either a code reference, or a
146 command list.
147
148 configure
149 configure {
150 ...
151 };
152
153 Configure block. The only directive allowed in a configure block is
154 requires.
155
156 sys
157 sys {
158 ...
159 };
160
161 System block. Allowed directives are: requires and gather.
162
163 share
164 share {
165 ...
166 };
167
168 System block. Allowed directives are: download, fetch, decode, prefer,
169 extract, build, gather.
170
171 start_url
172 share {
173 start_url $url;
174 };
175
176 Set the start URL for download. This should be the URL to an index
177 page, or the actual tarball of the source.
178
179 download
180 share {
181 download \&code;
182 download \@commandlist;
183 };
184
185 Instructions for the download stage. May be either a code reference,
186 or a command list.
187
188 fetch
189 share {
190 fetch \&code;
191 fetch \@commandlist;
192 };
193
194 Instructions for the fetch stage. May be either a code reference, or a
195 command list.
196
197 decode
198 share {
199 decode \&code;
200 decode \@commandlist;
201 };
202
203 Instructions for the decode stage. May be either a code reference, or
204 a command list.
205
206 prefer
207 share {
208 prefer \&code;
209 prefer \@commandlist;
210 };
211
212 Instructions for the prefer stage. May be either a code reference, or
213 a command list.
214
215 extract
216 share {
217 extract \&code;
218 extract \@commandlist;
219 };
220
221 Instructions for the extract stage. May be either a code reference, or
222 a command list.
223
224 patch
225 share {
226 patch \&code;
227 patch \@commandlist;
228 };
229
230 Instructions for the patch stage. May be either a code reference, or a
231 command list.
232
233 patch_ffi
234 share {
235 patch_ffi \&code;
236 patch_ffi \@commandlist;
237 };
238
239 [DEPRECATED]
240
241 Instructions for the patch_ffi stage. May be either a code reference,
242 or a command list.
243
244 build
245 share {
246 build \&code;
247 build \@commandlist;
248 };
249
250 Instructions for the build stage. May be either a code reference, or a
251 command list.
252
253 build_ffi
254 share {
255 build \&code;
256 build \@commandlist;
257 };
258
259 [DEPRECATED]
260
261 Instructions for the build FFI stage. Builds shared libraries instead
262 of static. This is optional, and is only necessary if a fresh and
263 separate build needs to be done for FFI.
264
265 gather
266 gather \&code;
267 gather \@commandlist;
268
269 share {
270 gather \&code;
271 gather \@commandlist;
272 };
273
274 sys {
275 gather \&code;
276 gather \@commandlist;
277 };
278
279 Instructions for the gather stage. May be either a code reference, or
280 a command list. In the root block of the alienfile it will trigger in
281 both share and system build. In the share or sys block it will only
282 trigger in the corresponding build.
283
284 gather_ffi
285 share {
286 gather_ffi \&code;
287 gather_ffi \@commandlist;
288 }
289
290 [DEPRECATED]
291
292 Gather specific to "build_ffi". Not usually necessary.
293
294 ffi
295 share {
296 ffi {
297 patch \&code;
298 patch \@commandlist;
299 build \&code;
300 build \@commandlist;
301 gather \&code;
302 gather \@commandlist;
303 }
304 }
305
306 Specify patch, build or gather stages related to FFI.
307
308 meta_prop
309 my $hash = meta_prop;
310
311 Get the meta_prop hash reference.
312
313 meta
314 my $meta = meta;
315
316 Returns the meta object for your alienfile.
317
318 log
319 log($message);
320
321 Prints the given log to stdout.
322
323 test
324 share {
325 test \&code;
326 test \@commandlist;
327 };
328 sys {
329 test \&code;
330 test \@commandlist;
331 };
332
333 Run the tests
334
335 before
336 before $stage => \&code;
337
338 Execute the given code before the given stage. Stage should be one of
339 "probe", "download", "fetch", "decode", "prefer", "extract", "patch",
340 "build", "test", and "gather".
341
342 The before directive is only legal in the same blocks as the stage
343 would normally be legal in. For example, you can't do this:
344
345 use alienfile;
346
347 sys {
348 before 'build' => sub {
349 ...
350 };
351 };
352
353 Because a "build" wouldn't be legal inside a "sys" block.
354
355 after
356 after $stage => \&code;
357
358 Execute the given code after the given stage. Stage should be one of
359 "probe", "download", "fetch", "decode", "prefer", "extract", "patch",
360 "build", "test", and "gather".
361
362 The after directive is only legal in the same blocks as the stage would
363 normally be legal in. For example, you can't do this:
364
365 use alienfile;
366
367 sys {
368 after 'build' => sub {
369 ...
370 };
371 };
372
373 Because a "build" wouldn't be legal inside a "sys" block.
374
376 Alien
377 Alien::Build
378 Alien::Build::MM
379 Alien::Base
380
382 Author: Graham Ollis <plicease@cpan.org>
383
384 Contributors:
385
386 Diab Jerius (DJERIUS)
387
388 Roy Storey
389
390 Ilya Pavlov
391
392 David Mertens (run4flat)
393
394 Mark Nunberg (mordy, mnunberg)
395
396 Christian Walde (Mithaldu)
397
398 Brian Wightman (MidLifeXis)
399
400 Zaki Mughal (zmughal)
401
402 mohawk (mohawk2, ETJ)
403
404 Vikas N Kumar (vikasnkumar)
405
406 Flavio Poletti (polettix)
407
408 Salvador Fandiño (salva)
409
410 Gianni Ceccarelli (dakkar)
411
412 Pavel Shaydo (zwon, trinitum)
413
414 Kang-min Liu (劉康民, gugod)
415
416 Nicholas Shipp (nshp)
417
418 Juan Julián Merelo Guervós (JJ)
419
420 Joel Berger (JBERGER)
421
422 Petr Pisar (ppisar)
423
424 Lance Wicks (LANCEW)
425
426 Ahmad Fatoum (a3f, ATHREEF)
427
428 José Joaquín Atria (JJATRIA)
429
430 Duke Leto (LETO)
431
432 Shoichi Kaji (SKAJI)
433
434 Shawn Laffan (SLAFFAN)
435
436 Paul Evans (leonerd, PEVANS)
437
439 This software is copyright (c) 2011-2018 by Graham Ollis.
440
441 This is free software; you can redistribute it and/or modify it under
442 the same terms as the Perl 5 programming language system itself.
443
444
445
446perl v5.28.1 2019-02-24 alienfile(3)