The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Module::Install::ForC::Env - build environment object for M::I::ForC

DESCRIPTION

This class expression the build environments.

METHODS

M::I::ForC::Env->new(%env)

This method create the new instance of M::I::ForC::Env. %env can take a generic variables.

The default value is following:

        CC       => $Config{cc},
        LD       => $Config{ld},
        LDFLAGS  => $Config{ldflags},
        CCFLAGS  => $Config{ccflags},
        LIBS     => [],

You can use env() for shortcut, see Module::Install::ForC.

$env->clone()

clone the instance.

$env->append($key, $val)

append the data for $env.

$env->program($binary, \@src, %opts)

make executable program named $binary from \@src.

You can specify the environment variables for each program.

    $env->program('foo', ['foo.c'], LIBS => ['pthread']);
$env->test($binary, $src, %opts)

make executable test command named $binary from \@src.

You can specify the environment variables for each test.

    $env->test('t/01_simple', 't/01_simple.c', LIBS => ['pthread']);

Then, you will get following files:

    't/01_simple': executable test file
    't/01_simple.t': test bootstrap script, written by perl
$env->shared_library($lib, \@src, %opts)

Make shared library named $lib from \@src.

$env->static_library($lib, \@src, %opts)

Make static library named $lib from \@src.

$env->parse_config(`pkg-config x11 --cflags --libs`)
    @return $env

Parse configuration and merge to $env from pkg-config.

$env->install('hello.exe' => 'bin')

Copy hello.exe to $prefix/bin/

$env->install_bin('hello.exe')

This is shorthand of $env->install('hello.exe' => 'bin').

$env->install_lib('libhello.so')

This is shorthand of $env->install('libhello.so' => 'lib').

my $bool = $env->have_header('stdlib.h')

Do you have a stdlib.h?

my $bool = $env->have_library('tt')

Do your have library?

my $bool = $env->have_type('pid_t')

Do your have the type?

my $bool = $env->try_cc("int main() { }");

Can you compile this?

AUTHOR

Tokuhiro Matsuno <tokuhirom slkjfd gmail.com>

LICENSE

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