SPVMCC(1)

πŸ“¦ version 0.990125, in alpine 3.24

✨ 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" in perl.
  • --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 -D is 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 -I is 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 --help in spvm, that's where the whole explanation lives 🫢
  • -h β€” the short version, -h. same deal: see -h in spvm πŸ’–
  • --version β€” prints the version. see --version in spvm, no cap ✨
  • -v β€” smol version of the above, -v. see -v in spvm 🌸
  • -I β€” used as -I DIR. see -I in spvm for the full tea πŸ“
  • --build-dir β€” used as --build-dir DIR. see --build-dir in spvm πŸ’œ
  • -B β€” used as -B DIR. see -B in spvm πŸ¦‹
  • -w β€” just -w. see -w in spvm, mwah 😌
  • -Mblib β€” literally -Mblib. see -Mblib in spvm πŸŽ€
  • --output β€” takes --output FILE and 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 the spvmcc command. 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, the spvmcc command runs without finishing the program πŸ™ˆ
  • --mode β€” takes --mode MODE and 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 as MyClass.c) and native source files (such as MyClass.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 as MyClass.c) and its native source files (such as MyClass.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 -D prefixed onto it. this affects all source files. repeatable πŸ’œ
  • --define-spvm β€” takes --define-spvm VALUE. compiler flag with -D prefixed. this affects SPVM core source files and a bootstrap file. repeatable 🌸
  • --define-native β€” takes --define-native CLASS_NAME@VALUE. compiler flag with -D prefixed. this affects native class source files (such as MyClass.c) and native source files (such as MyClass.native/src/foo). repeatable πŸ“
  • --define-native-class β€” takes --define-native-class VALUE. compiler flag with -D prefixed. this affects a native class source file specified by CLASS_NAME (such as MyClass.c) and its native source files (such as MyClass.native/src/foo). repeatable πŸ”₯

example:

# Expanded to -DDEBUG_MEMORY
--define-native-class MyClass@DEBUG_MEMORY
  • --define-precompile β€” takes --define-precompile VALUE. compiler flag with -D prefixed. 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 as MyClass.c) and native source files (such as MyClass.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 as MyClass.c) and its native source files (such as MyClass.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 -I prefixed. affects all source files. repeatable πŸ’–
  • --include-dir-spvm β€” takes --include-dir-spvm DIR. compiler flag with -I prefixed. affects SPVM core source files and a bootstrap file. repeatable 🌸
  • --include-dir-native β€” takes --include-dir-native DIR. compiler flag with -I prefixed. affects native class source files (such as MyClass.c) and native source files (such as MyClass.native/src/foo). repeatable πŸ“
  • --include-dir-native-class β€” takes --include-dir-native-class DIR. compiler flag with -I prefixed. affects a native class source file specified by CLASS_NAME (such as MyClass.c) and its native source files (such as MyClass.native/src/foo). repeatable 🌟

example:

--include-dir-native-class MyClass@/path/foo
  • --include-dir-precompile β€” takes --include-dir-precompile DIR. compiler flag with -I prefixed. 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 -o option. the recommended file extension for an SPVM archive is a tarball (.spvm-archive.tar.gz) πŸ‘‘

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