Name

SPVM::Builder::Util::API - Builder Utility APIs

Description

The SPVM::Builder::Util::API module has the public utility functions to build SPVM native classes and SPVM precompilation classes.

Usage

my $native_make_rule = SPVM::Builder::Util::API::create_make_rule_native('MyClass');

my $precompile_make_rule = SPVM::Builder::Util::API::create_make_rule_precompile('MyClass');

Functions

create_make_rule_native

my $make_rule = SPVM::Builder::Util::API::create_make_rule_native($class_name);

Creates a string of make commands for generating a dynamic library for a native class given the class name $class_name, and returns it.

A native class must have at least one method with the native attribute.

Examples:

# Makefile.PL
sub MY::postamble {
  
  my $make_rule = '';
  
  # Native compile make rule
  $make_rule .= SPVM::Builder::Util::API::create_make_rule_native('Foo');
  
  return $make_rule;
}

create_make_rule_precompile

my $make_rule = SPVM::Builder::Util::API::create_make_rule_precompile($class_name);

Creates a string of make commands for generating a dynamic library for a precompilation class given the class name $class_name, and returns it.

A precompilation class must have at least one method with the precompile attribute.

Examples:

# Makefile.PL
sub MY::postamble {
  
  my $make_rule = '';
  
  # Precompile make rule
  $make_rule .= SPVM::Builder::Util::API::create_make_rule_precompile('Foo');
  
  return $make_rule;
}

create_default_config

my $config = SPVM::Builder::Util::API::create_default_config();

Creates a default config, and returns it. It is a SPVM::Builder::Config object.

Currently the default config is created by the following operation.

my $config = SPVM::Builder::Config->new_gnu99(file_optional => 1);

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License