The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FFI::Build::Platform - Platform specific configuration.

VERSION

version 0.12

SYNOPSIS

 use FFI::Build::Platform;

DESCRIPTION

This class is used to abstract out the platform specific parts of the FFI::Build system. You shouldn't need to use it directly in most cases, unless you are working on FFI::Build itself.

CONSTRUCTOR

new

 my $platform = FFI::Build::Platform->new;

Create a new instance of FFI::Build::Platform.

default

 my $platform = FFI::Build::Platform->default;

Returns the default instance of FFI::Build::Platform.

METHODS

All of these methods may be called either as instance or classes methods. If called as a class method, the default instance will be used.

osname

 my $osname = $platform->osname;

The "os name" as understood by Perl. This is the same as $^O.

object_suffix

 my $suffix = $platform->object_suffix;

The object suffix for the platform. On UNIX this is usually .o. On Windows this is usually .obj.

library_suffix

 my(@suffix) = $platform->library_suffix;
 my $suffix  = $platform->library_suffix;

The library suffix for the platform. On Linux and some other UNIX this is often .so. On OS X, this is .dylib and .bundle. On Windows this is .dll.

library_prefix

 my $prefix = $platform->library_prefix;

The library prefix for the platform. On Unix this is usually lib, as in libfoo.

cc

 my $cc = $platform->cc;

The C compiler

cxx

 my $cxx = $platform->cxx;

The C++ compiler that naturally goes with the C compiler.

for

 my $for = $platform->for;

The Fortran compiler that naturally goes with the C compiler.

ld

 my $ld = $platform->ld;

The C linker

shellwords

 my @words = $platform->shellwords(@strings);

This is a wrapper around Text::ParseWords's shellwords with some platform workarounds applied.

cflags

 my $cflags = $platform->cflags;

The compiler flags needed to compile object files that can be linked into a dynamic library. On Linux, for example, this is usually -fPIC.

ldflags

 my $ldflags = $platform->ldflags;

The linker flags needed to link object files into a dynamic library. This is NOT the libs style library flags that specify the location and name of a library to link against, this is instead the flags that tell the linker to generate a dynamic library. On Linux, for example, this is usually -shared.

extra_system_inc

 my @dir = $platform->extra_syste_inc;

Extra include directory flags, such as -I/usr/local/include, which were configured when Perl was built.

extra_system_lib

 my @dir = $platform->extra_syste_lib;

Extra library directory flags, such as -L/usr/local/lib, which were configured when Perl was built.

cc_mm_works

 my $flags = $platform->cc_mm_works;

Returns the flags that can be passed into the C compiler to compute dependencies.

flag_object_output

 my $flag = $platform->flag_object_output($object_filename);

Returns the flags that the compiler recognizes as being used to write out to a specific object filename.

flag_library_output

 my $flag = $platform->flag_library_output($library_filename);

Returns the flags that the compiler recognizes as being used to write out to a specific library filename.

which

 my $path = $platform->which($command);

Returns the full path of the given command, if it is available, otherwise undef is returned.

diag

Diagnostic for the platform as a string. This is for human consumption only, and the format may and will change over time so do not attempt to use is programmatically.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.