SPVM::B...ig::Exe(3)
π 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 & LICENSE π
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
- alpine 3.24: spvm-doc 0.990125-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms