1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229
|
NAME
Alien::Build - Build external dependencies for use in CPAN
VERSION
version 2.84
SYNOPSIS
my $build = Alien::Build->load('./alienfile');
$build->load_requires('configure');
$build->set_prefix('/usr/local');
$build->set_stage('/foo/mystage'); # needs to be absolute
$build->load_requires($build->install_type);
$build->download;
$build->build;
# files are now in /foo/mystage, it is your job (or
# ExtUtils::MakeMaker, Module::Build, etc) to copy
# those files into /usr/local
DESCRIPTION
This module provides tools for building external (non-CPAN)
dependencies for CPAN. It is mainly designed to be used at install time
of a CPAN client, and work closely with Alien::Base which is used at
runtime.
This is the detailed documentation for the Alien::Build class. If you
are starting out you probably want to do so from one of these
documents:
Alien::Build::Manual::Alien
A broad overview of Alien-Build and its ecosystem.
Alien::Build::Manual::AlienUser
For users of an Alien::libfoo that is implemented using Alien::Base.
(The developer of Alien::libfoo should provide the documentation
necessary, but if not, this is the place to start).
Alien::Build::Manual::AlienAuthor
If you are writing your own Alien based on Alien::Build and
Alien::Base.
Alien::Build::Manual::FAQ
If you have a common question that has already been answered, like
"How do I use alienfile with some build system".
Alien::Build::Manual::PluginAuthor
This is for the brave souls who want to write plugins that will work
with Alien::Build + alienfile.
Alien::Build::Manual::Security
If you are concerned that Aliens might be downloading tarballs off
the internet, then this is the place for you. This will discuss some
of the risks of downloading (really any) software off the internet
and will give you some tools to remediate these risks.
Note that you will not usually create a Alien::Build instance directly,
but rather be using a thin installer layer, such as Alien::Build::MM
(for use with ExtUtils::MakeMaker) or Alien::Build::MB (for use with
Module::Build). One of the goals of this project is to remain installer
agnostic.
CONSTRUCTORS
new
my $build = Alien::Build->new;
This creates a new empty instance of Alien::Build. Normally you will
want to use load below to create an instance of Alien::Build from an
alienfile recipe.
load
my $build = Alien::Build->load($alienfile);
This creates an Alien::Build instance with the given alienfile recipe.
resume
my $build = Alien::Build->resume($alienfile, $root);
Load a checkpointed Alien::Build instance. You will need the original
alienfile and the build root (usually _alien), and a build that had
been properly checkpointed using the checkpoint method below.
PROPERTIES
There are three main properties for Alien::Build. There are a number of
properties documented here with a specific usage. Note that these
properties may need to be serialized into something primitive like JSON
that does not support: regular expressions, code references of blessed
objects.
If you are writing a plugin (Alien::Build::Plugin) you should use a
prefix like "plugin_name" (where name is the name of your plugin) so
that it does not interfere with other plugin or future versions of
Alien::Build. For example, if you were writing
Alien::Build::Plugin::Fetch::NewProtocol, please use the prefix
plugin_fetch_newprotocol:
sub init
{
my($self, $meta) = @_;
$meta->prop( plugin_fetch_newprotocol_foo => 'some value' );
$meta->register_hook(
some_hook => sub {
my($build) = @_;
$build->install_prop->{plugin_fetch_newprotocol_bar} = 'some other value';
$build->runtime_prop->{plugin_fetch_newprotocol_baz} = 'and another value';
}
);
}
If you are writing a alienfile recipe please use the prefix my_:
use alienfile;
meta_prop->{my_foo} = 'some value';
probe sub {
my($build) = @_;
$build->install_prop->{my_bar} = 'some other value';
$build->install_prop->{my_baz} = 'and another value';
};
Any property may be used from a command:
probe [ 'some command %{.meta.plugin_fetch_newprotocol_foo}' ];
probe [ 'some command %{.install.plugin_fetch_newprotocol_bar}' ];
probe [ 'some command %{.runtime.plugin_fetch_newprotocol_baz}' ];
probe [ 'some command %{.meta.my_foo}' ];
probe [ 'some command %{.install.my_bar}' ];
probe [ 'some command %{.runtime.my_baz}' ];
meta_prop
my $href = $build->meta_prop;
my $href = Alien::Build->meta_prop;
Meta properties have to do with the recipe itself, and not any
particular instance that probes or builds that recipe. Meta properties
can be changed from within an alienfile using the meta_prop directive,
or from a plugin from its init method (though should NOT be modified
from any hooks registered within that init method). This is not
strictly enforced, but if you do not follow this rule your recipe will
likely be broken.
arch
This is a hint to an installer like Alien::Build::MM or
Alien::Build::MB, that the library or tool contains architecture
dependent files and so should be stored in an architecture dependent
location. If not specified by your alienfile then it will be set to
true.
check_digest
True if cryptographic digest should be checked when files are fetched
or downloaded. This is set by Digest negotiator plugin.
destdir
Some plugins (Alien::Build::Plugin::Build::Autoconf for example)
support installing via DESTDIR. They will set this property to true
if they plan on doing such an install. This helps Alien::Build find
the staged install files and how to locate them.
If available, DESTDIR is used to stage install files in a sub
directory before copying the files into blib. This is generally
preferred method if available.
destdir_filter
Regular expression for the files that should be copied from the
DESTDIR into the stage directory. If not defined, then all files will
be copied.
destdir_ffi_filter
Same as destdir_filter except applies to build_ffi instead of build.
digest
This properties contains the cryptographic digests (if any) that
should be used when verifying any fetched and downloaded files. It is
a hash reference where the key is the filename and the value is an
array reference containing a pair of values, the first being the
algorithm ('SHA256' is recommended) and the second is the actual
digest. The special filename * may be specified to indicate that any
downloaded file should match that digest. If there are both real
filenames and the * placeholder, the real filenames will be used for
filenames that match and any other files will use the placeholder.
Example:
$build->meta_prop->{digest} = {
'foo-1.00.tar.gz' => [ SHA256 => '9feac593aa49a44eb837de52513a57736457f1ea70078346c60f0bfc5f24f2c1' ],
'foo-1.01.tar.gz' => [ SHA256 => '6bbde6a7f10ae5924cf74afc26ff5b7bc4b4f9dfd85c6b534c51bd254697b9e7' ],
'*' => [ SHA256 => '33a20aae3df6ecfbe812b48082926d55391be4a57d858d35753ab1334b9fddb3' ],
};
Cryptographic signatures will only be checked if the check_digest
meta property is set and if the Digest negotiator plugin is loaded.
(The Digest negotiator can be used directly, but is also loaded
automatically if you use the digest directive is used by the
alienfile).
env
Environment variables to override during the build stage.
env_interpolate
Environment variable values will be interpolated with helpers.
Example:
meta->prop->{env_interpolate} = 1;
meta->prop->{env}->{PERL} = '%{perl}';
local_source
Set to true if source code package is available locally. (that is not
fetched over the internet). This is computed by default based on the
start_url property. Can be set by an alienfile or plugin.
platform
Hash reference. Contains information about the platform beyond just
$^O.
platform.compiler_type
Refers to the type of flags that the compiler accepts. May be
expanded in the future, but for now, will be one of:
microsoft
On Windows when using Microsoft Visual C++
unix
Virtually everything else, including gcc on windows.
The main difference is that with Visual C++ -LIBPATH should be used
instead of -L, and static libraries should have the .LIB suffix
instead of .a.
platform.system_type
$^O is frequently good enough to make platform specific logic in
your alienfile, this handles the case when $^O can cover platforms
that provide multiple environments that Perl might run under. The
main example is windows, but others may be added in the future.
unix
vms
windows-activestate
windows-microsoft
windows-mingw
windows-strawberry
windows-unknown
Note that cygwin and msys are considered unix even though they run
on windows!
platform.cpu.count
Contains a non-negative integer of available (possibly virtual)
CPUs on the system. This can be used by build plugins to build in
parallel. The environment variable ALIEN_CPU_COUNT can be set to
override the CPU count.
platform.cpu.arch.name
Contains a normalized name for the architecture of the current
Perl. This can be used by fetch plugins to determine which binary
packages to download. The value may be one of the following, but
this list will be expanded as needed.
armel
32-bit ARM soft-float
armhf
32-bit ARM hard-float
aarch64
64-bit ARM
ppc
32-bit PowerPC (big-endian)
ppc64
64-bit PowerPC (big-endian)
x86
32-bit Intel (i386, i486, i686)
x86_64
64-bit Intel (AMD64)
unknown
Unable to detect architecture. Please report this if needed.
out_of_source
Build in a different directory from the where the source code is
stored. In autoconf this is referred to as a "VPATH" build. Everyone
else calls this an "out-of-source" build. When this property is true,
instead of extracting to the source build root, the downloaded source
will be extracted to an source extraction directory and the source
build root will be empty. You can use the extract install property to
get the location of the extracted source.
network
True if a network fetch is available. This should NOT be set by an
alienfile or plugin. This is computed based on the
ALIEN_INSTALL_NETWORK environment variables.
start_url
The default or start URL used by fetch plugins.
install_prop
my $href = $build->install_prop;
Install properties are used during the install phase (either under
share or system install). They are remembered for the entire install
phase, but not kept around during the runtime phase. Thus they cannot
be accessed from your Alien::Base based module.
autoconf_prefix
The prefix as understood by autoconf. This is only different on
Windows Where MSYS is used and paths like C:/foo are represented as
/C/foo which are understood by the MSYS tools, but not by Perl. You
should only use this if you are using
Alien::Build::Plugin::Build::Autoconf in your alienfile. This is set
during before the build hook is run.
download
The location of the downloaded archive (tar.gz, or similar) or
directory. This will be undefined until the archive is actually
downloaded.
download_detail
This property contains optional details about a downloaded file. This
property is populated by Alien::Build core. This property is a hash
reference. The key is the path to the file that has been downloaded
and the value is a hash reference with additional detail. All fields
are optional.
download_detail.digest
This, if available, with the cryptographic signature that was
successfully matched against the downloaded file. It is an array
reference with a pair of values, the algorithm (typically something
like SHA256) and the digest.
download_detail.protocol
This, if available, will be the URL protocol used to fetch the
downloaded file.
env
Environment variables to override during the build stage. Plugins are
free to set additional overrides using this hash.
extract
The location of the last source extraction. For a "out-of-source"
build (see the out_of_source meta property above), this will only be
set once. For other types of builds, the source code may be extracted
multiple times, and thus this property may change.
old
[deprecated]
Hash containing information on a previously installed Alien of the
same name, if available. This may be useful in cases where you want
to reuse the previous install if it is still sufficient.
old.prefix
[deprecated]
The prefix for the previous install. Versions prior to 1.42
unfortunately had this in typo form of preifx.
old.runtime
[deprecated]
The runtime properties from the previous install.
patch
Directory with patches, if available. This will be undef if there are
no patches. When initially installing an alien this will usually be a
sibling of the alienfile, a directory called patch. Once installed
this will be in the share directory called _alien/patch. The former
is useful for rebuilding an alienized package using af.
prefix
The install time prefix. Under a destdir install this is the same as
the runtime or final install location. Under a non-destdir install
this is the stage directory (usually the appropriate share directory
under blib).
root
The build root directory. This will be an absolute path. It is the
absolute form of ./_alien by default.
stage
The stage directory where files will be copied. This is usually the
root of the blib share directory.
system_probe_class
After the probe step this property may contain the plugin class that
performed the system probe. It shouldn't be filled in directly by the
plugin (instead if should use the hook property probe_class, see
below). This is optional, and not all probe plugins will provide this
information.
system_probe_instance_id
After the probe step this property may contain the plugin instance id
that performed the system probe. It shouldn't be filled in directly
by the plugin (instead if should use the hook property
probe_instance_id, see below). This is optional, and not all probe
plugins will provide this information.
plugin_instance_prop
my $href = $build->plugin_instance_prop($plugin);
This returns the private plugin instance properties for a given plugin.
This method should usually only be called internally by plugins
themselves to keep track of internal state. Because the content can be
used arbitrarily by the owning plugin because it is private to the
plugin, and thus is not part of the Alien::Build spec.
runtime_prop
my $href = $build->runtime_prop;
Runtime properties are used during the install and runtime phases
(either under share or system install). This should include anything
that you will need to know to use the library or tool during runtime,
and shouldn't include anything that is no longer relevant once the
install process is complete.
alien_build_version
The version of Alien::Build used to install the library or tool.
alt
Alternate configurations. If the alienized package has multiple
libraries this could be used to store the different compiler or
linker flags for each library. Typically this will be set by a plugin
in the gather stage (for either share or system installs).
cflags
The compiler flags. This is typically set by a plugin in the gather
stage (for either share or system installs).
cflags_static
The static compiler flags. This is typically set by a plugin in the
gather stage (for either share or system installs).
command
The command name for tools where the name my differ from platform to
platform. For example, the GNU version of make is usually make in
Linux and gmake on FreeBSD. This is typically set by a plugin in the
gather stage (for either share or system installs).
ffi_name
The name DLL or shared object "name" to use when searching for
dynamic libraries at runtime. This is passed into FFI::CheckLib, so
if your library is something like libarchive.so or archive.dll you
would set this to archive. This may be a string or an array of
strings. This is typically set by a plugin in the gather stage (for
either share or system installs).
ffi_checklib
This property contains two sub properties:
ffi_checklib.share
$build->runtime_prop->{ffi_checklib}->{share} = [ ... ];
Array of additional FFI::CheckLib flags to pass in to find_lib for
a share install.
ffi_checklib.system
Array of additional FFI::CheckLib flags to pass in to find_lib for
a system install.
Among other things, useful for specifying the try_linker_script
flag:
$build->runtime_prop->{ffi_checklib}->{system} = [ try_linker_script => 1 ];
This is typically set by a plugin in the gather stage (for either
share or system installs).
inline_auto_include
[version 2.53]
This property is an array reference of C code that will be passed
into Inline::C to make sure that appropriate headers are
automatically included. See "auto_include" in Inline::C for details.
install_type
The install type. This is set by AB core after the probe hook is
executed. Is one of:
system
For when the library or tool is provided by the operating system,
can be detected by Alien::Build, and is considered satisfactory by
the alienfile recipe.
share
For when a system install is not possible, the library source will
be downloaded from the internet or retrieved in another appropriate
fashion and built.
libs
The library flags. This is typically set by a plugin in the gather
stage (for either share or system installs).
libs_static
The static library flags. This is typically set by a plugin in the
gather stage (for either share or system installs).
perl_module_version
The version of the Perl module used to install the alien (if
available). For example if Alien::curl is installing libcurl this
would be the version of Alien::curl used during the install step.
prefix
The final install root. This is usually they share directory.
version
The version of the library or tool. This is typically set by a plugin
in the gather stage (for either share or system installs).
hook_prop
my $href = $build->hook_prop;
Hook properties are for the currently running (if any) hook. They are
used only during the execution of each hook and are discarded after. If
no hook is currently running then hook_prop will return undef.
name
The name of the currently running hook.
version (probe)
Probe and PkgConfig plugins may set this property indicating the
version of the alienized package. Not all plugins and configurations
may be able to provide this.
probe_class (probe)
Probe and PkgConfig plugins may set this property indicating the
plugin class that made the probe. If the probe results in a system
install this will be propagated to system_probe_class for later use.
probe_instance_id (probe)
Probe and PkgConfig plugins may set this property indicating the
plugin instance id that made the probe. If the probe results in a
system install this will be propagated to system_probe_instance_id
for later use.
METHODS
checkpoint
$build->checkpoint;
Save any install or runtime properties so that they can be reloaded on
a subsequent run in a separate process. This is useful if your build
needs to be done in multiple stages from a Makefile, such as with
ExtUtils::MakeMaker. Once checkpointed you can use the resume
constructor (documented above) to resume the probe/build/install]
process.
root
my $dir = $build->root;
This is just a shortcut for:
my $root = $build->install_prop->{root};
Except that it will be created if it does not already exist.
install_type
my $type = $build->install_type;
This will return the install type. (See the like named install property
above for details). This method will call probe if it has not already
been called.
is_system_install
my $boolean = $build->is_system_install;
Returns true if the alien is a system install type.
is_share_install
my $boolean = $build->is_share_install;
Returns true if the alien is a share install type.
download_rule
my $rule = $build->download_rule;
This returns install rule as a string. This is determined by the
environment and should be one of:
warn
Warn only if fetching via non secure source (secure sources include
https, and bundled files, may include other encrypted protocols in
the future).
digest
Require that any downloaded source package have a cryptographic
signature in the alienfile and that signature matches what was
downloaded.
encrypt
Require that any downloaded source package is fetched via secure
source.
digest_or_encrypt
Require that any downloaded source package is either fetched via a
secure source or has a cryptographic signature in the alienfile and
that signature matches what was downloaded.
digest_and_encrypt
Require that any downloaded source package is both fetched via a
secure source and has a cryptographic signature in the alienfile and
that signature matches what was downloaded.
The current default is warn, but in the near future this will be
upgraded to digest_or_encrypt.
set_prefix
$build->set_prefix($prefix);
Set the final (unstaged) prefix. This is normally only called by
Alien::Build::MM and similar modules. It is not intended for use from
plugins or from an alienfile.
set_stage
$build->set_stage($dir);
Sets the stage directory. This is normally only called by
Alien::Build::MM and similar modules. It is not intended for use from
plugins or from an alienfile.
requires
my $hash = $build->requires($phase);
Returns a hash reference of the modules required for the given phase.
Phases include:
configure
These modules must already be available when the alienfile is read.
any
These modules are used during either a system or share install.
share
These modules are used during the build phase of a share install.
system
These modules are used during the build phase of a system install.
load_requires
$build->load_requires($phase);
This loads the appropriate modules for the given phase (see requires
above for a description of the phases).
probe
my $install_type = $build->probe;
Attempts to determine if the operating system has the library or tool
already installed. If so, then the string system will be returned and a
system install will be performed. If not, then the string share will be
installed and the tool or library will be downloaded and built from
source.
If the environment variable ALIEN_INSTALL_TYPE is set, then that will
force a specific type of install. If the detection logic cannot
accommodate the install type requested then it will fail with an
exception.
download
$build->download;
Download the source, usually as a tarball, usually from the internet.
Under a system install this does not do anything.
fetch
my $res = $build->fetch;
my $res = $build->fetch($url, %options);
Fetch a resource using the fetch hook. Returns the same hash structure
described below in the fetch hook documentation.
[version 2.39]
As of Alien::Build 2.39, these options are supported:
http_headers
my $res = $build->fetch($url, http_headers => [ $key1 => $value1, $key2 => $value 2, ... ]);
Set the HTTP request headers on all outgoing HTTP requests. Note that
not all protocols or fetch plugins support setting request headers,
but the ones that do not should issue a warning if you try to set
request headers and they are not supported.
check_digest
[experimental]
my $bool = $build->check_digest($path);
Checks any cryptographic signatures for the given file. The file is
specified by $path which may be one of:
string
Containing the path to the file to be checked.
Path::Tiny
Containing the path to the file to be checked.
HASH
A Hash reference containing information about a file. See the fetch
hook for details on the format.
Returns true if the cryptographic signature matches, false if
cryptographic signatures are disabled. Will throw an exception if the
signature does not match, or if no plugin provides the correct
algorithm for checking the signature.
decode
my $decoded_res = $build->decode($res);
Decode the HTML or file listing returned by fetch. Returns the same
hash structure described below in the decode hook documentation.
prefer
my $sorted_res = $build->prefer($res);
Filter and sort candidates. The preferred candidate will be returned
first in the list. The worst candidate will be returned last. Returns
the same hash structure described below in the prefer hook
documentation.
extract
my $dir = $build->extract;
my $dir = $build->extract($archive);
Extracts the given archive into a fresh directory. This is normally
called internally to Alien::Build, and for normal usage is not needed
from a plugin or alienfile.
build
$build->build;
Run the build step. It is expected that probe and download have already
been performed. What it actually does depends on the type of install:
share
The source is extracted, and built as determined by the alienfile
recipe. If there is a gather_share that will be executed last.
system
The gather_system hook will be executed.
test
$build->test;
Run the test phase
clean_install
$build->clean_install
Clean files from the final install location. The default implementation
removes all files recursively except for the _alien directory. This is
helpful when you have an old install with files that may break the new
build.
For a non-share install this doesn't do anything.
system
$build->system($command);
$build->system($command, @args);
Interpolates the command and arguments and run the results using the
Perl system command.
log
$build->log($message);
Send a message to the log. By default this prints to STDOUT.
meta
my $meta = Alien::Build->meta;
my $meta = $build->meta;
Returns the meta object for your Alien::Build class or instance. The
meta object is a way to manipulate the recipe, and so any changes to
the meta object should be made before the probe, download or build
steps.
META METHODS
prop
my $href = $build->meta->prop;
Meta properties. This is the same as calling meta_prop on the class or
Alien::Build instance.
add_requires
Alien::Build->meta->add_requires($phase, $module => $version, ...);
Add the requirement to the given phase. Phase should be one of:
configure
any
share
system
interpolator
my $interpolator = $build->meta->interpolator;
my $interpolator = Alien::Build->interpolator;
Returns the Alien::Build::Interpolate instance for the Alien::Build
class.
has_hook
my $bool = $build->meta->has_hook($name);
my $bool = Alien::Build->has_hook($name);
Returns if there is a usable hook registered with the given name.
register_hook
$build->meta->register_hook($name, $instructions);
Alien::Build->meta->register_hook($name, $instructions);
Register a hook with the given name. $instruction should be either a
code reference, or a command sequence, which is an array reference.
default_hook
$build->meta->default_hook($name, $instructions);
Alien::Build->meta->default_hook($name, $instructions);
Register a default hook, which will be used if the alienfile does not
register its own hook with that name.
around_hook
$build->meta->around_hook($hook_name, $code);
Alien::Build->meta->around_hook($hook_name, $code);
Wrap the given hook with a code reference. This is similar to a Moose
method modifier, except that it wraps around the given hook instead of
a method. For example, this will add a probe system requirement:
$build->meta->around_hook(
probe => sub {
my $orig = shift;
my $build = shift;
my $type = $orig->($build, @_);
return $type unless $type eq 'system';
# also require a configuration file
if(-f '/etc/foo.conf')
{
return 'system';
}
else
{
return 'share';
}
},
);
after_hook
$build->meta->after_hook($hook_name, sub {
my(@args) = @_;
...
});
Execute the given code reference after the hook. The original arguments
are passed into the code reference.
before_hook
$build->meta->before_hook($hook_name, sub {
my(@args) = @_;
...
});
Execute the given code reference before the hook. The original
arguments are passed into the code reference.
apply_plugin
Alien::Build->meta->apply_plugin($name);
Alien::Build->meta->apply_plugin($name, @args);
Apply the given plugin with the given arguments.
ENVIRONMENT
Alien::Build responds to these environment variables:
ALIEN_BUILD_LOG
The default log class used. See Alien::Build::Log and
Alien::Build::Log::Default.
ALIEN_BUILD_PKG_CONFIG
Override the logic in Alien::Build::Plugin::PkgConfig::Negotiate
which chooses the best pkg-config plugin.
ALIEN_BUILD_POSTLOAD
semicolon separated list of plugins to automatically load after
parsing your alienfile.
ALIEN_BUILD_PRELOAD
semicolon separated list of plugins to automatically load before
parsing your alienfile.
ALIEN_BUILD_RC
Perl source file which can override some global defaults for
Alien::Build, by, for example, setting preload and postload plugins.
ALIEN_DOWNLOAD_RULE
This value determines the rules by which types of downloads are
allowed. The legal values listed under "download_rule", plus default
which will be the default for the current version of Alien::Build.
For this version that default is warn.
ALIEN_INSTALL_NETWORK
If set to true (the default), then network fetch will be allowed. If
set to false, then network fetch will not be allowed.
What constitutes a local vs. network fetch is determined based on the
start_url and local_source meta properties. An alienfile or plugin
could override this detection (possibly inappropriately), so this
variable is not a substitute for properly auditing of Perl modules
for environments that require that.
ALIEN_INSTALL_TYPE
If set to share or system, it will override the system detection
logic. If set to default, it will use the default setting for the
alienfile. The behavior of other values is undefined.
Although the recommended way for a consumer to use an Alien::Base
based Alien is to declare it as a static configure and build-time
dependency, some consumers may prefer to fallback on using an Alien
only when the consumer itself cannot detect the necessary package. In
some cases the consumer may want the user to opt-in to using an Alien
before requiring it.
To keep the interface consistent among Aliens, the consumer of the
fallback opt-in Alien may fallback on the Alien if the environment
variable ALIEN_INSTALL_TYPE is set to any value. The rationale is
that by setting this environment variable the user is aware that
Alien modules may be installed and have indicated consent. The actual
implementation of this, by its nature would have to be in the
consuming CPAN module.
DESTDIR
This environment variable will be manipulated during a destdir
install.
PKG_CONFIG
This environment variable can be used to override the program name
for pkg-config when using the command line plugin:
Alien::Build::Plugin::PkgConfig::CommandLine.
ftp_proxy, all_proxy
If these environment variables are set, it may influence the Download
negotiation plugin Alien::Build::Plugin::Download::Negotiate. Other
proxy variables may be used by some Fetch plugins, if they support
it.
SUPPORT
The intent of the Alien-Build team is to support the same versions of
Perl that are supported by the Perl toolchain. As of this writing that
means 5.16 and better.
Please feel encouraged to report issues that you encounter to the
project GitHub Issue tracker:
https://github.com/PerlAlien/Alien-Build/issues
Better if you can fix the issue yourself, please feel encouraged to
open pull-request on the project GitHub:
https://github.com/PerlAlien/Alien-Build/pulls
If you are confounded and have questions, join us on the #native
channel on irc.perl.org. The Alien-Build developers frequent this
channel and can probably help point you in the right direction. If you
don't have an IRC client handy, you can use this web interface:
https://chat.mibbit.com/?channel=%23native&server=irc.perl.org
SEE ALSO
Alien::Build::Manual::AlienAuthor, Alien::Build::Manual::AlienUser,
Alien::Build::Manual::Contributing, Alien::Build::Manual::FAQ,
Alien::Build::Manual::PluginAuthor
alienfile, Alien::Build::MM, Alien::Build::Plugin, Alien::Base, Alien
THANKS
Alien::Base was originally written by Joel Berger, the rest of this
project would not have been possible without him getting the project
started. Thanks to his support I have been able to augment the original
Alien::Base system with a reliable set of tools (Alien::Build,
alienfile, Test::Alien), which make up this toolset.
The original Alien::Base is still copyright (c) 2012-2020 Joel Berger.
It has the same license as the rest of the Alien::Build and related
tools distributed as Alien-Build. Joel Berger thanked a number of
people who helped in in the development of Alien::Base, in the
documentation for that module.
I would also like to acknowledge the other members of the PerlAlien
github organization, Zakariyya Mughal (sivoais, ZMUGHAL) and mohawk
(ETJ). Also important in the early development of Alien::Build were the
early adopters Chase Whitener (genio, CAPOEIRAB, author of
Alien::libuv), William N. Braswell, Jr (willthechill, WBRASWELL, author
of Alien::JPCRE2 and Alien::PCRE2) and Ahmad Fatoum (a3f, ATHREEF,
author of Alien::libudev and Alien::LibUSB).
The Alien ecosystem owes a debt to Dan Book, who goes by Grinnz on IRC,
for answering question about how to use Alien::Build and friends.
AUTHOR
Author: Graham Ollis <plicease@cpan.org>
Contributors:
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
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.
|