| 1 | # You may distribute under the terms of either the GNU General Public License | ||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||
| 3 | # | ||
| 4 | # (C) Paul Evans, 2021 -- leonerd@leonerd.org.uk | ||
| 5 | |||
| 6 | package Object::Pad::ExtensionBuilder 0.825; | ||
| 7 | |||
| 8 | 1 | ▶ | use v5.18; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | C<Object::Pad::ExtensionBuilder> - build-time support for extensions to C<Object::Pad> | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | =for highlighter language=perl | ||
| 18 | |||
| 19 | In F<Build.PL>: | ||
| 20 | |||
| 21 | use Object::Pad::ExtensionBuilder; | ||
| 22 | |||
| 23 | my $build = Module::Build->new) | ||
| 24 | ..., | ||
| 25 | configure_requires => { | ||
| 26 | 'Object::Pad::ExtensionBuilder' => 0, | ||
| 27 | }, | ||
| 28 | ); | ||
| 29 | |||
| 30 | Object::Pad::ExtensionBuilder->extend_module_build( $build ); | ||
| 31 | |||
| 32 | ... | ||
| 33 | |||
| 34 | =head1 DESCRIPTION | ||
| 35 | |||
| 36 | This module provides a build-time helper to assist authors writing XS modules | ||
| 37 | that provide L<Object::Pad> extensions. It prepares a L<Module::Build>-using | ||
| 38 | distribution to be able to compile it. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | =head1 METHODS | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | =head2 write_object_pad_h | ||
| 47 | |||
| 48 | Object::Pad::ExtensionBuilder->write_object_pad_h; | ||
| 49 | |||
| 50 | This method no longer does anything I<since version 0.810>. | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | sub write_object_pad_h | ||
| 55 | 0 | ▶ | { |
|
Subroutine
write_object_pad_h: not called CC=1 SCAR=0.0
Pod
documented
| |||
| 56 | } | ||
| 57 | |||
| 58 | =head2 extra_compiler_flags | ||
| 59 | |||
| 60 | @flags = Object::Pad::ExtensionBuilder->extra_compiler_flags; | ||
| 61 | |||
| 62 | Returns a list of extra flags that the build scripts should add to the | ||
| 63 | compiler invocation. This enables the C compiler to find the | ||
| 64 | F<object_pad.h> file. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | sub extra_compiler_flags | ||
| 69 | 0 | ▶ | { |
|
Subroutine
extra_compiler_flags: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 70 | 0 | shift; | |
| 71 | |||
| 72 | 0 | require File::ShareDir; | |
| 73 | 0 | require File::Spec; | |
| 74 | 0 | require Object::Pad; | |
| 75 | 0 | return "-I" . File::Spec->catdir( File::ShareDir::module_dir( "Object::Pad" ), "include" ); | |
| 76 | } | ||
| 77 | |||
| 78 | =head2 extend_module_build | ||
| 79 | |||
| 80 | Object::Pad::ExtensionBuilder->extend_module_build( $build ); | ||
| 81 | |||
| 82 | A convenient shortcut for performing all the tasks necessary to make a | ||
| 83 | L<Module::Build>-based distribution use the helper. | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | sub extend_module_build | ||
| 88 | 0 | ▶ | { |
|
Subroutine
extend_module_build: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 89 | 0 | my $self = shift; | |
| 90 | 0 | my ( $build ) = @_; | |
| 91 | |||
| 92 | # preserve existing flags | ||
| 93 | 0 | my @flags = @{ $build->extra_compiler_flags }; | |
| 94 | 0 | push @flags, $self->extra_compiler_flags; | |
| 95 | |||
| 96 | 0 | $build->extra_compiler_flags( @flags ); | |
| 97 | } | ||
| 98 | |||
| 99 | =head1 AUTHOR | ||
| 100 | |||
| 101 | Paul Evans <leonerd@leonerd.org.uk> | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | 1 | 0x55AA; | |