Module...:XSUtil(3pm)

🌸 NAME 🌸

Welcome to Module...:XSUtil(3pm) from the User Contributed Perl Documentation, bestie πŸ’– This is Module::Build::XSUtil, aka a Module::Build class for building XS modules. That's literally its whole thing. Slay.


✨ SYNOPSIS ✨

Use in your Build.PL, fr fr:

use strict;
use warnings;
use Module::Build::XSUtil;

my $builder = Module::Build::XSUtil->new(
    dist_name            => 'Your-XS-Module',
    license              => 'perl',
    dist_author          => 'Your Name <yourname@example.com>',
    dist_version_from    => 'lib/Your/XS/Module',
    generate_ppport_h    => 'lib/Your/XS/ppport.h',
    generate_xshelper_h  => 'lib/Your/XS/xshelper.h',
    needs_compiler_c99   => 1,
);

$builder->create_build_script();

Use in custom builder module. This one's giving subclass energy πŸ¦‹:

package builder::MyBuilder;
use strict;
use warnings;
use base 'Module::Build::XSUtil';

sub new {
    my ($class, %args) = @_;
    my $self = $class->SUPER::new(
        %args,
        generate_ppport_h    => 'lib/Your/XS/ppport.h',
        generate_xshelper_h  => 'lib/Your/XS/xshelper.h',
        needs_compiler_c99   => 1,
    );
    return $self;
}

1;

πŸŽ€ DESCRIPTION πŸŽ€

Module::Build::XSUtil is a subclass of Module::Build for support building XS modules. Iconic behavior, honestly.

These are the new parameters in the Module::Build::new method πŸ‘‘:

  • needs_compiler_c99 β€” checks whether a C99 compiler is available. If it's not available, Build.PL exits by 0. πŸ’€
  • needs_compiler_cpp β€” checks whether a C++ compiler is available. If it's not available, Build.PL exits by 0. Also appends 'extra_compiler_flags' and 'extra_linker_flags' for C++.
  • generate_ppport_h β€” generates ppport.h by Devel::PPPort.
  • generate_xshelper_h β€” generates xshelper.h, a helper header file to include EXTERN.h, perl.h, XSUB.h, and ppport.h, and defines some portability stuff that ppport.h does not support. It is porting from Module::Install::XSUtil.
  • cc_warnings β€” enables the compiler warnings flag. It's enabled by default. ✨
  • -g options β€” if you invoke Build.PL with the -g option, it will build with debug options.

πŸ¦‹ SEE ALSO πŸ¦‹

Module::Install::XSUtil β€” go look, iykyk.


πŸ’– LICENSE πŸ’–

Copyright (C) Hideaki Ohno.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


🌈 AUTHOR 🌈

Hideaki Ohno <hide.o.j55 {at} gmail.com>


That's the whole tea 🫢 this has been Module...:XSUtil(3pm), perl v5.42.2, dated 2023-07-03. Now go build your XS module, main character πŸ’…βœ¨

πŸ“¦ where this page comes from