SPVM::B...ig::Exe(3)

πŸ“¦ version 0.990125, in alpine 3.24

πŸ’– NAME πŸ’–

Bestie, this is the User Contributed Perl Documentation page for SPVM::Builder::Config::Exe(3) β€” aka Executable File Config. It's giving "build config but make it executable." πŸ’…

🌸 DESCRIPTION 🌸

The SPVM::Builder::Config::Exe class has methods to manipulate the config for the executable file generated by spvmcc command. That's the whole assignment: config for your exe. ✨

πŸŽ€ USAGE πŸŽ€

use SPVM::Builder::Config::Exe;

my $config_exe = SPVM::Builder::Config::Exe->new_gnu99;

Boom. Config object acquired. 🫢

🌈 DETAILS 🌈

🚨 Warning: Should Not Change Compiler Flags 🚨

The fields for compiler flags in SPVM::Builder::Config β€” such as "cc" in SPVM::Builder::Config and "std" in SPVM::Builder::Config β€” should not be changed. Do not touch them, bestie. Fr fr. 😭

This is because the compiler flags are used to compile SPVM core source files and a bootstrap source file generated by spvmcc command. That's the reason, no cap.

πŸ¦‹ Config Mode πŸ¦‹

A config can have its mode if the config is one for an executable file generated by spvmcc command.

The mode is written in the format .MODE_NAME just before .config extension of a config file.

MODE_NAME must consist of a-zA-Z0-9_.

Examples:

# production mode
MyClass.production.config

# devel mode
MyClass.devel.config

Use mode field to get the config mode.

my $mode = $config->mode;

The spvmcc command has --mode option for giving a config mode.

spvmcc -o myapp --mode production myapp.spvm

πŸ‘‘ SUPER CLASS πŸ‘‘

  • SPVM::Builder::Config

Inheritance moment. πŸ’œ

🧚 FIELDS 🧚

✨ mode ✨

my $mode = $config->mode;
$config->mode($mode);

Gets and sets mode field.

πŸ’… before_compile_cbs_global πŸ’…

my $before_compile_cbs_global = $config_exe->before_compile_cbs_global;
$config_exe->before_compile_cbs_global($before_compile_cbs_global);

Gets and sets the before_compile_cbs_global field β€” an array reference of callbacks that work globally and are called just before the compile command cc is executed.

This affects all compilations. All of them. Globally. Iconic. πŸ”₯

πŸ“ ccflags_global πŸ“

my $ccflags_global = $config->ccflags_global;
$config->ccflags_global($ccflags_global);

Gets and sets the ccflags field β€” an array reference containing arguments of the compiler cc in all compilation.

🌸 ccflags_spvm 🌸

my $ccflags_spvm = $config->ccflags_spvm;
$config->ccflags_spvm($ccflags_spvm);

Gets and sets ccflags_spvm field β€” an array reference containing arguments of the compiler cc in compilations of SPVM source code and a bootstrap source file.

πŸ¦‹ ccflags_native πŸ¦‹

my $ccflags_native = $config->ccflags_native;
$config->ccflags_native($ccflags_native);

Gets and sets ccflags_native field β€” an array reference containing arguments of the compiler cc in compilation of all native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c).

πŸŽ€ ccflags_native_class πŸŽ€

my $ccflags_native_class = $config->ccflags_native_class($class_name);
$config->ccflags_native_class($class_name, $ccflags_native);

Gets and sets the value of ccflags_native_class field's class name key $class_name β€” an array reference containing arguments of the compiler cc in compilation of native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c) in $class_name.

πŸ’œ ccflags_precompile πŸ’œ

my $ccflags_precompile = $config->ccflags_precompile;
$config->ccflags_precompile($ccflags_precompile);

Gets and sets ccflags_precompile field β€” an array reference containing arguments of the compiler cc in compilation for precompilation.

⭐ defines_global ⭐

my $defines_global = $config->defines_global;
$config->defines_global($defines_global);

Gets and sets the defines field β€” an array reference containing the value of -D arguments of the compiler cc in all compilation.

🌈 defines_spvm 🌈

my $defines_spvm = $config->defines_spvm;
$config->defines_spvm($defines_spvm);

Gets and sets defines_spvm field β€” an array reference containing the value of -D arguments of the compiler cc in compilations of SPVM source code and a bootstrap source file.

πŸ’– defines_native πŸ’–

my $defines_native = $config->defines_native;
$config->defines_native($defines_native);

Gets and sets defines_native field β€” an array reference containing the value of -D arguments of the compiler cc in compilation of all native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c).

🧚 defines_native_class 🧚

my $defines_native_class = $config->defines_native_class($class_name);
$config->defines_native_class($class_name, $defines_native);

Gets and sets the value of defines_native_class field's class name key $class_name β€” an array reference containing the value of -D arguments of the compiler cc in compilation of native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c) in $class_name.

🫢 defines_precompile 🫢

my $defines_precompile = $config->defines_precompile;
$config->defines_precompile($defines_precompile);

Gets and sets defines_precompile field β€” an array reference containing the value of -D arguments of the compiler cc in compilation for precompilation.

πŸ”₯ optimize_global πŸ”₯

my $optimize_global = $config->optimize_global;
$config->optimize_global($optimize_global);

Gets and sets the optimize field β€” an argument of the compiler cc for optimization in all compilation.

πŸ’€ optimize_spvm πŸ’€

my $optimize_spvm = $config->optimize_spvm;
$config->optimize_spvm($optimize_spvm);

Gets and sets optimize_spvm field β€” an argument of the compiler cc for optimization in compilations of SPVM source code and a bootstrap source file.

πŸ‘‘ optimize_native πŸ‘‘

my $optimize_native = $config->optimize_native;
$config->optimize_native($optimize_native);

Gets and sets optimize_native field β€” an argument of the compiler cc for optimization in compilation of all native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c).

πŸ¦‹ optimize_native_class πŸ¦‹

my $optimize_native_class = $config->optimize_native_class($class_name);
$config->optimize_native_class($class_name, $optimize_native);

Gets and sets the value of optimize_native_class field's class name key $class_name β€” an argument of the compiler cc for optimization in compilation of native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c) in $class_name.

🌸 optimize_precompile 🌸

my $optimize_precompile = $config->optimize_precompile;
$config->optimize_precompile($optimize_precompile);

Gets and sets optimize_precompile field β€” an argument of the compiler cc for optimization in compilation for precompilation.

πŸŽ€ include_dirs_global πŸŽ€

my $include_dirs_global = $config->include_dirs_global;
$config->include_dirs_global($include_dirs_global);

Gets and sets the include_dirs field β€” an array reference containing -I arguments of the compiler cc in all compilation.

πŸ’œ include_dirs_spvm πŸ’œ

my $include_dirs_spvm = $config->include_dirs_spvm;
$config->include_dirs_spvm($include_dirs_spvm);

Gets and sets include_dirs_spvm field β€” an array reference containing -I arguments of the compiler cc in compilations of SPVM source code and a bootstrap source file.

πŸ“ include_dirs_native πŸ“

my $include_dirs_native = $config->include_dirs_native;
$config->include_dirs_native($include_dirs_native);

Gets and sets include_dirs_native field β€” an array reference containing -I arguments of the compiler cc in compilation of all native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c).

🌈 include_dirs_native_class 🌈

my $include_dirs_native_class = $config->include_dirs_native_class($class_name);
$config->include_dirs_native_class($class_name, $include_dirs_native);

Gets and sets the value of include_dirs_native_class field's class name key $class_name β€” an array reference containing -I arguments of the compiler cc in compilation of native class source files (such as MyClass.c) and all native source files (such as MyClass.native/src/mysource.c) in $class_name.

⭐ include_dirs_precompile ⭐

my $include_dirs_precompile = $config->include_dirs_precompile;
$config->include_dirs_precompile($include_dirs_precompile);

Gets and sets include_dirs_precompile field β€” an array reference containing -I arguments of the compiler cc in compilation for precompilation.

🧚 external_object_files 🧚

my $external_object_files = $config->external_object_files;
$config->external_object_files($external_object_files);

Gets and sets external_object_files field β€” an array reference containing additional external object files linked to an executable file.

πŸ‘‘ spvm_archive πŸ‘‘

An SPVM archive.

See load_spvm_archive and get_spvm_archive.

πŸ’– spvm_archive_skip_classes πŸ’–

my $spvm_archive_skip_classes = $config->spvm_archive_skip_classes;
$config->spvm_archive_skip_classes($spvm_archive_skip_classes);

Gets and sets spvm_archive_skip_classes field β€” an array reference containing the names of classes in an SPVM archive you do not want to load.

See also load_spvm_archive.

πŸ’… METHODS πŸ’…

okay bestie this is the part where the object actually does stuff β€” every single method, no skips, no "you get the idea" 😀 let's go 🫢


🌸 new

my $config_exe = SPVM::Builder::Config::Exe->new(%fields);

Makes you a brand new SPVM::Builder::Config::Exe object, built from %fields plus the fields of its super classes. It does this by calling the new method of its super class, handing it %fields with the field default values already filled in ✨

Field Default Values:

  • output_type β†’ "exe"
  • before_compile_cbs_global β†’ []
  • Other Fields β†’ undef

πŸŽ€ load_base_config

my $config = $config->load_base_config($config_file);

Takes the config file path $config_file, works out the base config file path from it, then calls load_config with that base config file path and the config arguments β€” and gives you back whatever that returns πŸ’–

So what even is a base config file? It's literally the config file with its mode stripped off, iykyk:

# Config file
MyClass.mode.config

# Base config file
MyClass.config

Examples:

my $config = SPVM::Builder::Config::Exe->load_base_config(__FILE__);

πŸ¦‹ load_mode_config

my $config = $config->load_mode_config($config_file, $mode);

Same energy as above but mode-flavored: it builds the mode config file path from the config file path $config_file, calls load_config with that mode config file path and the config arguments, and returns its return value 🌈

my $config = SPVM::Builder::Config::Exe->load_mode_config(__FILE__, "production");

Oh and heads up β€” the mode field gets set to $mode. Periodt πŸ’…


🧚 add_before_compile_cb_global

$config_exe->add_before_compile_cb_global(@before_compile_cbs_global);

Pushes @before_compile_cbs_global onto the end of the before_compile_cbs_global field. Queue behavior, no cutting in line πŸ™ˆ

Examples:

$config_exe->add_before_compile_cb_global(sub {
  my ($config, $compile_info) = @_;

  my $cc_command = $compile_info->to_command;

  # Do something
});

⭐ add_ccflag_global

$config->add_ccflag_global(@ccflags_global);

Appends @ccflags_global to the end of the ccflags_global field πŸ”₯


⭐ add_ccflag_spvm

$config->add_ccflag_spvm(@ccflags_spvm);

Appends @ccflags_spvm to the end of the ccflags_spvm field πŸ”₯


⭐ add_ccflag_native

$config->add_ccflag_native(@ccflags_native);

Appends @ccflags_native to the end of the ccflags_native field πŸ”₯


πŸ’œ add_ccflag_native_class

$config->add_ccflag_native_class($class_name, @ccflags_native_class);

Appends @ccflags_native_class to the end of the ccflags_native_class field's key $class_name β€” very class-specific of you, slay πŸŽ€


⭐ add_ccflag_precompile

$config->add_ccflag_precompile(@ccflags_precompile);

Appends @ccflags_precompile to the end of the ccflags_precompile field πŸ”₯


⭐ add_define_global

$config->add_define_global(@defines_global);

Appends @defines_global to the end of the defines_global field ✨


⭐ add_define_spvm

$config->add_define_spvm(@defines_spvm);

Appends @defines_spvm to the end of the defines_spvm field ✨


⭐ add_define_native

$config->add_define_native(@defines_native);

Appends @defines_native to the end of the defines_native field ✨


πŸ’œ add_define_native_class

$config->add_define_native_class($class_name, @defines_native_class);

Appends @defines_native_class to the end of the defines_native_class field's key $class_name πŸ‘‘


⭐ add_define_precompile

$config->add_define_precompile(@defines_precompile);

Appends @defines_precompile to the end of the defines_precompile field ✨


🌈 add_include_dir_global

$config->add_include_dir_global(@include_dirs_global);

Appends @include_dirs_global to the end of the include_dirs_global field πŸ“


🌈 add_include_dir_spvm

$config->add_include_dir_spvm(@include_dirs_spvm);

Appends @include_dirs_spvm to the end of the include_dirs_spvm field πŸ“


🌈 add_include_dir_native

$config->add_include_dir_native(@include_dirs_native);

Appends @include_dirs_native to the end of the include_dirs_native field πŸ“


πŸ’œ add_include_dir_native_class

$config->add_include_dir_native_class($class_name, @include_dirs_native_class);

Appends @include_dirs_native_class to the end of the include_dirs_native_class field's key $class_name πŸ“‚


🌈 add_include_dir_precompile

$config->add_include_dir_precompile(@include_dirs_precompile);

Appends @include_dirs_precompile to the end of the include_dirs_precompile field πŸ“


πŸ“ add_external_object_file

$config->add_external_object_file(@external_object_files);

Appends @external_object_files to the end of the external_object_files field 🧚


πŸ‘‘ load_spvm_archive

$config->load_spvm_archive($spvm_archive);
$config->load_spvm_archive($spvm_archive, $options);

Loads an SPVM archive. Iconic.

But bestie, be so real with me for a sec β€” it doesn't actually load it right this instant 😭 What really happens is that the spvm_archive field just gets set to $spvm_archive, the spvm_archive_skip_classes field gets set to the value of the skip option, and the loading goes down later. Delayed gratification, literally.

Options:

  • skip β€” an array reference containing the names of classes you do not want to load πŸ™…β€β™€οΈ

Examples:

my $config_dir = File::Basename::dirname __FILE__;

$config->load_spvm_archive("$config_dir/myapp.spvm-archive.tar.gz);

$config->load_spvm_archive("$config_dir/myapp.spvm-archive.tar.gz, {skip => ['SomeClass1', 'SomeClass2]});

🫢 get_spvm_archive

my $spvm_archive = $config->get_spvm_archive;

Gets an SPVM archive. Short, sweet, gets the thing πŸ’–


Copyright (c) 2023 Yuki Kimoto

MIT License


and that's a wrap on part 2, bestie πŸŽ€ this page came from the perl v5.42.2 docs, dated 2026-02-03 β€” go build something iconic with it, mwah πŸ’‹βœ¨πŸŒΈ

πŸ“¦ where this page comes from