SPVMCC(1)
β¨ Name β¨
spvmcc(1) β User Contributed Perl Documentation. Okay bestie, this page is about spvmcc β Generating Excutable File (thatβs the manualβs spelling, not me being chaotic π). Itβs the command that turns SPVM classes into an executable file, and itβs giving build-system main character energy.
π Description π
The spvmcc command generates an executable file from SPVM classes. No cap, thatβs the whole vibe: you feed it SPVM stuff, it gives you an executable.
πΈ Usage πΈ
Usage: spvmcc [OPTIONS] SCRIPT_NAME
spvmcc -o myapp myapp.spvm
spvmcc -I lib/SPVM -o myapp myapp.spvm
Now the option menu, one bullet per option so nobody gets lost in the sauce π
π Options π
-h,--helpβ shows this message.-v,--versionβ shows the version.-o,--output FILEβ the output file name.-I DIRβ adds a include directory.-B,--build-dir DIRβ build directory.-q,--quietβ stops the output of messages.-f,--forceβ forces the compile and link.--no-configβ no configration file is ok.-m,--mode MODEβ config mode.-wβ enables warning flag.-Mblibβ same as"-Mblib"inperl.--ccflag VALUEβ compiler flag.--ccflag-spvm VALUEβ same as--ccflag, but only SPVM core source files and a bootstrap file.--ccflag-native VALUEβ same as--ccflag, but only native class source files and native source files.--ccflag-native-class CLASS_NAME@VALUEβ same as--ccflag-native, but only a class.--ccflag-precompile VALUEβ same as--ccflag, but only precompile class source files.--define VALUEβ same as--ccflag, but-Dis prefixed.--define-spvm VALUEβ same as--define, but only SPVM core source files and a bootstrap file.--define-native VALUEβ same as--define, but only native class source files and native source files.--define-native-class CLASS_NAME@VALUEβ same as--define-native, but only a class.--define-precompile VALUEβ same as--define, but only precompile class source files.--optimize LEVELβ optimization level such as"-O3","-O0 -g".--optimize-spvm LEVELβ same as--optimize, but only SPVM core source files and a bootstrap file.--optimize-native LEVELβ same as--optimize, but only native class source files and native source files.--optimize-native-class CLASS_NAME@LEVELβ same as--optimize-native, but only a class.--optimize-precompile LEVELβ same as--optimize, but only precompile class source files.--include-dir DIRβ same as--ccflag, but-Iis prefixed.--include-dir-spvm DIRβ same as--include-dir, but only SPVM core source files and a bootstrap file.--include-dir-native DIRβ same as--include-dir, but only native class source files and native source files.--include-dir-native-class CLASS_NAME@DIRβ same as--include-dir-native, but only a class.--include-dir-precompile DIRβ same as--include-dir, but only precompile class source files.--build-spvm-archiveβ generate an SPVM archive.
π¦ Details π¦
π spvmcc Command π
spvmcc [OPTIONS] SCRIPT_NAME
The spvmcc command generates an executable file from SPVM classes.
OPTIONS are options. Iconic, honestly.
SCRIPT_NAME is a script path that contains an SPVM script.
# myapp.spvm
use Fn;
my $var = 1;
say $var;
Anon class that contains a bootstrap method is allowed as an SPVM script.
# myapp.spvm
class {
version "1.001";
our $FOO : int;
use Fn;
static method main : void () {
my $var = 1;
say $var;
}
}
The base name of SCRIPT_NAME must be a Script Base Name. Otherwise an exception is thrown. Periodt.
See Class Search Directories about default class search directories.
See SPVM::Document::EnvironmentVariables about available environment variables.
π Config File for Executable File π
A config file that corresponding to the script name must exist for an executable file, except for the case that --no-config is specified.
The config for an executable file is a SPVM::Builder::Config::Exe object.
"myapp.config":
use SPVM::Builder::Config::Exe;
my $exe_config = SPVM::Builder::Config::Exe->new;
$exe_config
π Caching System π
Compiled object files and an executable file are not rebuilt unless they need to be rebuilt.
--force option forces the rebuild. Not me having to poke it manually unless you pass that flag, iykyk.
π§ Resources π§
bestie, this is the part where resources are not automatically compiled. Read it twice, fr fr.
There are important points to be aware of when generating executable files. That is, resources are not automatically compiled.
When you run an SPVM program with the spvm command, the resources are contained within the shared library of each class. Therefore, there are no conflicts between resources.
However, in the case of executable files, there are resource conflicts. For this, the resources must be resolved manually in the configuration file.
$config->use_resource('Resource::Zlib');
This is hard work, but given that the executable file must be compiled from source files and run on a variety of platforms, I think that solving it manually is a better way.
I have published a command that allows you to view the list of classes using resources and the resource settings.
See also --resource-info option in spvmdeps command to dump resource information.
π lib Directive π
If the source code specified by SCRIPT_NAME contains lib directives, the directories specified by lib directive is prepended to class search directories.
#lib "$FindBin::Bin/lib"
This directories specified by lib directive is placed after the directories specified by --include-dir option.
β SPVM Archive β
An SPVM archive is a tarball (.tar.gz) containing SPVM class files and object files generated from native classes, precompilation classes, and resource classes.
spvmcc.json in an SPVM archive has archive information. This contains the application name, the mode, the version and class information.
The recommended file extension is .spvm-archive.tar.gz.
An SPVM archive does not contains external object files (.o), static library files (.a), dynamic library files (.so, .dll, etc), and SPVM anon class files.
An SPVM archive can be created by --build-spvm-archive option.
spvmcc --build-spvm-archive -o $exe_dir/myapp.spvm-archive.tar.gz myapp.spvm
An SPVM archive can be load by load_spvm_archive in SPVM::Builder::Config::Exe method.
By loading an SPVM archive, you can load its classes, and its object files are linked.
If an SPVM archive is loaded and --build-spvm-archive option is specified, the current application information is merged with the SPVM archive information, and then the merged SPVM archive is output.
β¨ OPTIONS β¨
Okay bestie, buckle up β there are a lot of flags here, but honestly? They're organized. Slay. π Let's go.
--helpβ shows you help. literally just check out--helpinspvm, that's where the whole explanation lives π«Ά-hβ the short version,-h. same deal: see-hinspvmπ--versionβ prints the version. see--versioninspvm, no cap β¨-vβ smol version of the above,-v. see-vinspvmπΈ-Iβ used as-I DIR. see-Iinspvmfor the full tea π--build-dirβ used as--build-dir DIR. see--build-dirinspvmπ-Bβ used as-B DIR. see-Binspvmπ¦-wβ just-w. see-winspvm, mwah π-Mblibβ literally-Mblib. see-Mblibinspvmπ--outputβ takes--output FILEand sets the output file path to FILE. and bestie, this output file is an executable file π-oβ takes-o FILE. it's the exact same thing as--output, just shorter β¨--quietβ shuts up the messages coming from thespvmcccommand. peace and quiet, we love to see it π€«-qβ-q. same as--quiet, periodt π--forceβ forces a rebuild of object files and an executable file. like "idc if nothing changed, build it again" energy π₯-fβ-f. same as--force, fr fr π--no-configβ if you specify this and a config file does not exist, thespvmcccommand runs without finishing the program π--modeβ takes--mode MODEand specifies the config mode MODE. check the Config Mode section for what the modes actually are, iykyk π-mβ takes-m MODE. same as--modeπ«Ά--ccflagβ takes--ccflag VALUE, a compiler flag. this one affects all source files. and yes, you can repeat this option as many times as you want β--ccflag-spvmβ takes--ccflag-spvm VALUE, a compiler flag. this affects SPVM core source files and a bootstrap file. repeatable too π--ccflag-nativeβ takes--ccflag-native VALUE, a compiler flag. this affects native class source files (such asMyClass.c) and native source files (such asMyClass.native/src/foo). repeat it all you like π¦--ccflag-native-classβ takes--ccflag-native-class CLASS_NAME@VALUE, a compiler flag. this affects a native class source file specified by CLASS_NAME (such asMyClass.c) and its native source files (such asMyClass.native/src/foo). repeatable β¨
example, bestie:
--ccflag-native-class MyClass@-Wall
--ccflag-precompileβ takes--ccflag-precompile VALUE, a compiler flag. this affects precompile class source files. repeatable π--defineβ takes--define VALUE. it's a compiler flag, but with-Dprefixed onto it. this affects all source files. repeatable π--define-spvmβ takes--define-spvm VALUE. compiler flag with-Dprefixed. this affects SPVM core source files and a bootstrap file. repeatable πΈ--define-nativeβ takes--define-native CLASS_NAME@VALUE. compiler flag with-Dprefixed. this affects native class source files (such asMyClass.c) and native source files (such asMyClass.native/src/foo). repeatable π--define-native-classβ takes--define-native-class VALUE. compiler flag with-Dprefixed. this affects a native class source file specified by CLASS_NAME (such asMyClass.c) and its native source files (such asMyClass.native/src/foo). repeatable π₯
example:
# Expanded to -DDEBUG_MEMORY
--define-native-class MyClass@DEBUG_MEMORY
--define-precompileβ takes--define-precompile VALUE. compiler flag with-Dprefixed. this affects precompile class source files. repeatable π§--optimizeβ takes--optimize LEVEL, an optimization level. affects all source files π
example:
--optimize "-O0 -g"
--optimize-spvmβ takes--optimize-spvm LEVEL, an optimization level. this affects SPVM core source files and a bootstrap file β--optimize-nativeβ takes--optimize-native LEVEL, an optimization level. this affects native class source files (such asMyClass.c) and native source files (such asMyClass.native/src/foo) π¦--optimize-native-classβ takes--optimize-native-class LEVEL, an optimization level. this affects a native class source file specified by CLASS_NAME (such asMyClass.c) and its native source files (such asMyClass.native/src/foo). repeatable π
example:
--optimize-native-class "MyClass@-O0 -g"
--optimize-precompileβ takes--optimize-precompile LEVEL, an optimization level. this affects precompile class source files π--include-dirβ takes--include-dir DIR. it's a compiler flag, but with-Iprefixed. affects all source files. repeatable π--include-dir-spvmβ takes--include-dir-spvm DIR. compiler flag with-Iprefixed. affects SPVM core source files and a bootstrap file. repeatable πΈ--include-dir-nativeβ takes--include-dir-native DIR. compiler flag with-Iprefixed. affects native class source files (such asMyClass.c) and native source files (such asMyClass.native/src/foo). repeatable π--include-dir-native-classβ takes--include-dir-native-class DIR. compiler flag with-Iprefixed. affects a native class source file specified by CLASS_NAME (such asMyClass.c) and its native source files (such asMyClass.native/src/foo). repeatable π
example:
--include-dir-native-class MyClass@/path/foo
--include-dir-precompileβ takes--include-dir-precompile DIR. compiler flag with-Iprefixed. affects precompile class source files. repeatable π§--object-fileβ takes--object-file OBJECT_FILE, an additional object file OBJECT_FILE passed to the linker. repeatable π--build-spvm-archiveβ no value, just the flag. generates an SPVM archive into the path given by the-ooption. the recommended file extension for an SPVM archive is a tarball (.spvm-archive.tar.gz) π
π COPYRIGHT & LICENSE π
Copyright 2023 Yuki Kimoto. All Rights Reserved.
MIT License.
okay that's the whole thing, bestie β you're officially a spvmcc girlie now πβ¨ this page is from perl v5.42.2, dated 2026-02-03, and it's SPVMCC(1) if you need to cite your sources π go build something iconic π
π¦ 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