.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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::Build::Plugin 3" .TH Alien::Build::Plugin 3 2023-07-25 "perl v5.38.0" "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::Build::Plugin \- Plugin base class for Alien::Build .SH VERSION .IX Header "VERSION" version 2.80 .SH SYNOPSIS .IX Header "SYNOPSIS" Create your plugin: .PP .Vb 1 \& package Alien::Build::Plugin::Type::MyPlugin; \& \& use Alien::Build::Plugin; \& use Carp (); \& \& has prop1 => \*(Aqdefault value\*(Aq; \& has prop2 => sub { \*(Aqdefault value\*(Aq }; \& has prop3 => sub { Carp::croak \*(Aqprop3 is a required property\*(Aq }; \& \& sub init \& { \& my($self, $meta) = @_; \& \& my $prop1 = $self\->prop1; \& my $prop2 = $self\->prop2; \& my $prop3 = $self\->prop3; \& \& $meta\->register_hook(sub { \& build => [ \*(Aq%{make}\*(Aq, \*(Aq%{make} install\*(Aq ], \& }); \& } .Ve .PP From your alienfile .PP .Vb 5 \& use alienfile; \& plugin \*(AqType::MyPlugin\*(Aq => ( \& prop2 => \*(Aqdifferent value\*(Aq, \& prop3 => \*(Aqneed to provide since it is required\*(Aq, \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This document describes the Alien::Build plugin base class. For details on how to write a plugin, see Alien::Build::Manual::PluginAuthor. .PP Listed are some common types of plugins: .IP Alien::Build::Plugin::Build 4 .IX Item "Alien::Build::Plugin::Build" Tools for building. .IP Alien::Build::Plugin::Core 4 .IX Item "Alien::Build::Plugin::Core" Tools already included. .IP Alien::Build::Plugin::Decode 4 .IX Item "Alien::Build::Plugin::Decode" Normally use Download plugins which will pick the correct Decode plugins. .IP Alien::Build::Plugin::Digest 4 .IX Item "Alien::Build::Plugin::Digest" Tools for checking cryptographic signatures during a \f(CW\*(C`share\*(C'\fR install. .IP Alien::Build::Plugin::Download 4 .IX Item "Alien::Build::Plugin::Download" Methods for retrieving from the internet. .IP Alien::Build::Plugin::Extract 4 .IX Item "Alien::Build::Plugin::Extract" Extract from archives that have been downloaded. .IP Alien::Build::Plugin::Fetch 4 .IX Item "Alien::Build::Plugin::Fetch" Normally use Download plugins which will pick the correct Fetch plugins. .IP Alien::Build::Plugin::Gather 4 .IX Item "Alien::Build::Plugin::Gather" Plugins that modify or enhance the gather step. .IP Alien::Build::Plugin::PkgConfig 4 .IX Item "Alien::Build::Plugin::PkgConfig" Plugins that work with \f(CW\*(C`pkg\-config\*(C'\fR or libraries that provide the same functionality. .IP Alien::Build::Plugin::Prefer 4 .IX Item "Alien::Build::Plugin::Prefer" Normally use Download plugins which will pick the correct Prefer plugins. .IP Alien::Build::Plugin::Probe 4 .IX Item "Alien::Build::Plugin::Probe" Look for packages already installed on the system. .IP Alien::Build::Plugin::Probe 4 .IX Item "Alien::Build::Plugin::Probe" Plugins useful for unit testing Alien::Build itself, or plugins for it. .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" .SS new .IX Subsection "new" .Vb 1 \& my $plugin = Alien::Build::Plugin\->new(%props); .Ve .SS PROPERTIES .IX Subsection "PROPERTIES" .SS instance_id .IX Subsection "instance_id" .Vb 1 \& my $id = $plugin\->instance_id; .Ve .PP Returns an instance id for the plugin. This is computed from the class and arguments that are passed into the plugin constructor, so technically two instances with the exact same arguments will have the same instance id, but in practice you should never have two instances with the exact same arguments. .SH METHODS .IX Header "METHODS" .SS init .IX Subsection "init" .Vb 1 \& $plugin\->init($ab_class\->meta); # $ab is an Alien::Build class name .Ve .PP You provide the implementation for this. The intent is to register hooks and set meta properties on the Alien::Build class. .SS has .IX Subsection "has" .Vb 2 \& has $prop_name; \& has $prop_name => $default; .Ve .PP Specifies a property of the plugin. You may provide a default value as either a string scalar, or a code reference. The code reference will be called to compute the default value, and if you want the default to be a list or hash reference, this is how you want to do it: .PP .Vb 1 \& has foo => sub { [1,2,3] }; .Ve .SS meta .IX Subsection "meta" .Vb 1 \& my $meta = $plugin\->meta; .Ve .PP Returns the plugin meta object. .SH "SEE ALSO" .IX Header "SEE ALSO" Alien::Build, alienfile, Alien::Build::Manual::PluginAuthor .SH AUTHOR .IX Header "AUTHOR" Author: Graham Ollis .PP Contributors: .PP Diab Jerius (DJERIUS) .PP Roy Storey (KIWIROY) .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, ETJ) .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 (JJ) .PP Joel Berger (JBERGER) .PP Petr Písař (ppisar) .PP Lance Wicks (LANCEW) .PP Ahmad Fatoum (a3f, ATHREEF) .PP José Joaquín Atria (JJATRIA) .PP Duke Leto (LETO) .PP Shoichi Kaji (SKAJI) .PP Shawn Laffan (SLAFFAN) .PP Paul Evans (leonerd, PEVANS) .PP Håkon Hægland (hakonhagland, HAKONH) .PP nick nauwelaerts (INPHOBIA) .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.