SPVM::Builder::LibInfo - Library Information
The SPVM::Builder::LibInfo class has methods to manipulate library information.
my $lib_info = SPVM::Builder::LibInfo->new(%fields); my $lib_arg = $lib_info->to_arg;
my $name = $lib_info->name; $lib_info->name($name);
Gets and sets the name field.
name
This field is a library name.
Examples:
$lib_info->name('z'); $lib_info->name('png');
my $file = $lib_info->file; $lib_info->file($file);
Gets and sets the file field.
file
This field is the absolute path of the library file like /path/libz.so, /path/libpng.a.
/path/libz.so
/path/libpng.a
my $is_static = $lib_info->is_static; $lib_info->is_static($is_static);
Gets and sets the is_static field.
is_static
If this field is a true value, a static library is linked.
my $is_abs = $lib_info->is_abs; $lib_info->is_abs($is_abs);
Gets and sets the is_abs field.
is_abs
If this field is a true value, the library is linked by the library name like -lfoo.
-lfoo
Otherwise the library is linked by the absolute path of the library like /path/libfoo.so.
/path/libfoo.so
my $static_option_cb = $lib_info->static_option_cb; $lib_info->static_option_cb($static_option_cb);
Gets and sets the static_option_cb field.
static_option_cb
This field is the callback to create a linker option to link a static library.
my $lib_info = SPVM::Builder::LibInfo->new(%fields);
Creates a SPVM::Builder::LibInfo object with "Fields".
Default Field Values:
If a field is not defined, the field is set to the following default value.
"name"
undef
"file"
"is_static"
0
"is_abs"
"static_option_cb"
sub { my ($self, $name) = @_; $name = "-Wl,-Bstatic -l$name -Wl,-Bdynamic"; return $name; };
my $link_command_arg = $lib_info->to_arg;
Creates an argument of the link command from the "is_abs" field and "is_static" field, and returns it.
The following ones are examples of the return value.
-lfoo -Wl,-Bstatic -lfoo -Wl,-Bdynamic /path/foo.so /path/foo.a
my $lib_name = $lib_info->to_string;
Returns the "name" field.
Overloads the following operators.
my $bool = !!$lib_info;
Always true.
my $lib_name = "$lib_info";
Alias for the "to_string" method.
Copyright (c) 2023 Yuki Kimoto
MIT License
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.