Alien::...Wrapper(3)
๐ Alien::Base::Wrapper(3) โ NAME ๐
okay so bestie, welcome to Alien::Base::Wrapper(3), fresh out of the User Contributed Perl Documentation section ๐ธ this one is literally the Compiler and linker wrapper for Alien, no cap.
โจ VERSION โจ
version 2.88 โ she's current, she's slaying ๐
๐ฆ SYNOPSIS ๐ฆ
From the command line, babes:
% 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
From Makefile.PL (static) โ this is giving low-effort, high-reward:
use ExtUtils::MakeMaker;
use Alien::Base::Wrapper ();
WriteMakefile(
Alien::Base::Wrapper->new( 'Alien::Foo', 'Alien::Bar')->mm_args2(
'NAME' => 'Foo::XS',
'VERSION_FROM' => 'lib/Foo/XS.pm',
),
);
From Makefile.PL (static with wrapper) โ the glow-up version:
use Alien::Base::Wrapper qw( WriteMakefile);
WriteMakefile(
'NAME' => 'Foo::XS',
'VERSION_FROM' => 'lib/Foo/XS.pm',
'alien_requires' => {
'Alien::Foo' => 0,
'Alien::Bar' => 0,
},
);
From Makefile.PL (dynamic) โ the main character era:
use Devel::CheckLib qw( check_lib );
use ExtUtils::MakeMaker 6.52;
my @mm_args;
my @libs;
if(check_lib( lib => [ 'foo' ] )
{
push @mm_args, LIBS => [ '-lfoo' ];
}
else
{
push @mm_args,
CC => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e cc --',
LD => '$(FULLPERL) -MAlien::Base::Wrapper=Alien::Foo -e ld --',
BUILD_REQUIRES => {
'Alien::Foo' => 0,
'Alien::Base::Wrapper' => 0,
}
;
}
WriteMakefile(
'NAME' => 'Foo::XS',
'VERSION_FROM' => 'lib/Foo/XS.pm',
'CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => 6.52,
},
@mm_args,
);
๐ DESCRIPTION ๐
So this module is basically a wrapper around one or more Alien modules ๐ซถ. It's designed to work with Alien::Base-based aliens, but honestly it should work with any Alien that uses the same essential API. She's flexible like that ๐
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, adds the flags provided by the Aliens you specified, and then executes the command. It will print the command to the console so you can see exactly what is happening โ no mystery, we're transparent here ๐
In the second example (from Makefile.PL non-dynamic), this class is used to generate the appropriate ExtUtils::MakeMaker (EUMM) arguments you need for WriteMakefile.
In the third example (from Makefile.PL dynamic), we do a quick check to see if the simple linker flag -lfoo will work, and 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 configure time, when a distribution is installed โ meaning if you're 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 ๐ฎโ๐จ
fr fr, 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. ๐ (that sentence is a whole journey but we respect it)
๐ CONSTRUCTOR ๐
๐ new
my $abw = Alien::Base::Wrapper->new(@aliens);
Instead of passing the aliens you want to use into this module's import, you can create a non-global instance of Alien::Base::Wrapper using the OO interface. Iconic behaviour, honestly โจ
๐ FUNCTIONS ๐
๐ cc
% perl -MAlien::Base::Wrapper=Alien::Foo -e cc -- cflags
Invoke the C compiler with the appropriate flags from Alien::Foo plus whatever you provided on the command line. Bestie said "combine and conquer" ๐ฅ
๐ ld
% perl -MAlien::Base::Wrapper=Alien::Foo -e ld -- ldflags
Invoke the linker with the appropriate flags from Alien::Foo and what is provided on the command line. Same energy, linker edition ๐ธ
๐ mm_args
my %args = $abw->mm_args;
my %args = Alien::Base::Wrapper->mm_args;
Returns arguments that you can pass into WriteMakefile to compile/link against the specified Aliens. โ ๏ธ Important: this does not set CONFIGURE_REQUIRES. For that reason you probably want to use mm_args2 below instead. Don't skip that part, bestie ๐
๐ mm_args2
my %args = $abw->mm_args2(%args);
my %args = Alien::Base::Wrapper->mm_args2(%args);
Returns arguments that you can pass into WriteMakefile to compile/link against. It works a little differently from mm_args above in that you can pass in arguments. It also adds the appropriate CONFIGURE_REQUIRES for you, so you do not have to do that explicitly. She's thoughtful like that ๐
[version 2.87]
If you pass in your own CONFIGURE_REQUIRES with a version for a module that this class also requires (currently ExtUtils::MakeMaker and Alien::Base::Wrapper itself, plus any Alien that you specify a minimum version for), then the newer of the two version numbers will be used, so that neither requirement is weakened ๐. Version numbers may be given in either decimal (1.23) or dotted-decimal (1.2.3) form.
๐ checklib_args2
my %args = $abw->checklib_args2(%args);
my %args = Alien::Base::Wrapper->checklib_args2(%args);
Returns arguments that you can pass into assert_lib, check_lib or check_lib_or_exit from Devel::CheckLib in order to compile/link against the Aliens specified. It works a little like mm_args2 above, except that instead of being applied to a hash of ExtUtils::MakeMaker arguments, it is applied to a hash of Devel::CheckLib arguments. Like this, bestie:
use Devel::CheckLib qw( check_lib_or_exit );
use Alien::Base::Wrapper ();
check_lib_or_exit(
Alien::Base::Wrapper->new('Alien::Foo')->checklib_args2(
lib => 'foo',
header => 'foo.h',
),
);
The Alien's include paths are merged into incpath, its other compiler flags (such as -D defines) are merged into ccflags, its library paths are merged into libpath, and its libraries and other linker flags are merged into ldflags, so that the lib and header that you are checking for can be found using the environment provided by the Alien. ๐
Since Devel::CheckLib also allows you to specify INC and LIBS in the ExtUtils::MakeMaker style, and merging those styles with the Alien flags is ambiguous, checklib_args2 will throw an exception if you attempt to specify either of those ๐ญ. Use incpath / ccflags and libpath / ldflags instead. Don't test her.
๐ mb_args
my %args = $abw->mb_args;
my %args = Alien::Base::Wrapper->mb_args;
Returns arguments that you can pass into the constructor to Module::Build. Simple as ๐ง
๐ WriteMakefile
use Alien::Base::Wrapper qw( WriteMakefile );
WriteMakefile(%args, alien_requires => \%aliens);
WriteMakefile(%args, alien_requires => \@aliens);
This is a thin wrapper around WriteMakefile from ExtUtils::MakeMaker, which adds the given aliens to the configure requirements and sets the appropriate compiler and linker flags ๐
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.
For the list form you can specify a version by appending =version to the name of the Aliens, that is:
WriteMakefile(
alien_requires => [ 'Alien::libfoo=1.23', 'Alien::libbar=4.56' ],
);
The list form is recommended if the ordering of the aliens matters ๐. The aliens are sorted in the hash form to make it consistent, but it may not be the order that you want.
๐ธ ENVIRONMENT ๐ธ
Alien::Base::Wrapper responds to these environment variables:
ALIEN_BASE_WRAPPER_QUIETโ If set to true, do not print the command before executing. Shy mode activated ๐
โญ SEE ALSO โญ
Alien::Base, Alien::Base โ yes bestie, it's listed twice, and we're keeping it exactly like that ๐
๐ AUTHOR ๐
Author: Graham Ollis <plicease@cpan.org>
Contributors โ the whole squad, we love them, no cap:
- Diab Jerius (DJERIUS)
- Roy Storey (KIWIROY)
- Ilya Pavlov
- David Mertens (run4flat)
- Mark Nunberg (mordy, mnunberg)
- Christian Walde (Mithaldu)
- Brian Wightman (MidLifeXis)
- Zaki Mughal (zmughal)
- mohawk (mohawk2, ETJ)
- Vikas N Kumar (vikasnkumar)
- Flavio Poletti (polettix)
- Salvador Fandiรฑo (salva)
- Gianni Ceccarelli (dakkar)
- Pavel Shaydo (zwon, trinitum)
- Kang-min Liu (ๅๅบทๆฐ, gugod)
- Nicholas Shipp (nshp)
- Juan Juliรกn Merelo Guervรณs (JJ)
- Joel Berger (JBERGER)
- Petr Pรญsaล (ppisar)
- Lance Wicks (LANCEW)
- Ahmad Fatoum (a3f, ATHREEF)
- Josรฉ Joaquรญn Atria (JJATRIA)
- Duke Leto (LETO)
- Shoichi Kaji (SKAJI)
- Shawn Laffan (SLAFFAN)
- Paul Evans (leonerd, PEVANS)
- Hรฅkon Hรฆgland (hakonhagland, HAKONH)
- nick nauwelaerts (INPHOBIA)
- Florian Weimer
- Marcel Telka (mtelka)
๐ COPYRIGHT AND LICENSE ๐
This software is copyright (c) 2011-2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. ๐ซถ
and that's the whole vibe, bestie โ this page was served to you by perl v5.42.3, dated 2026-09-21, straight from the Alien::...Wrapper(3) man page. go compile something iconic ๐
โจ
๐ฆ where this page comes from
- fedora 43: perl-Alien-Build 2.88-1.fc43 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Alien-Build 2.88-1.fc44 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms