Alien-SDL2
view release on metacpan or search on metacpan
lib/Alien/SDL2.pm view on Meta::CPAN
package Alien::SDL2;
use strict;
use warnings;
use Alien::SDL2::ConfigData;
use File::ShareDir qw(dist_dir);
use File::Spec;
use File::Find;
use File::Spec::Functions qw(catdir catfile rel2abs);
use File::Temp qw(tempfile);
use Capture::Tiny;
use Config;
=head1 NAME
Alien::SDL2 - building, finding and using SDL2 binaries
=head1 VERSION
Version 0.002
=cut
our $VERSION = '0.002';
$VERSION = eval $VERSION;
my %HAVELIB_CACHE;
=head1 SYNOPSIS
Alien::SDL2 tries (in given order) during its installation:
=over
=item * When given C<--with-sdl2-config> option use specified sdl2-config
script to locate SDL2 libs.
perl Build.PL --with-sdl2-config=/opt/sdl2/bin/sdl2-config
or using default script name 'sdl2-config' by running:
perl Build.PL --with-sdl2-config
B<IMPORTANT NOTE:> Using --with-sdl2-config avoids considering any other
build methods; no prompt with other available build options.
=item * Locate an already installed SDL2 via 'sdl2-config' script.
=item * Download prebuilt SDL2 binaries (if available for your platform).
=item * Build SDL2 binaries from source codes (if possible on your system).
=back
Later you can use Alien::SDL2 in your module that needs to link agains SDL2
and/or related libraries like this:
# Sample Makefile.pl
use ExtUtils::MakeMaker;
use Alien::SDL2;
WriteMakefile(
NAME => 'Any::SDL2::Module',
VERSION_FROM => 'lib/Any/SDL2/Module.pm',
LIBS => Alien::SDL2->config('libs', [-lAdd_Lib]),
INC => Alien::SDL2->config('cflags'),
# + additional params
);
=head1 DESCRIPTION
Please see L<Alien> for the manifesto of the Alien namespace.
In short C<Alien::SDL2> can be used to detect and get
configuration settings from an installed SDL2 and related libraries.
Based on your platform it offers the possibility to download and
install prebuilt binaries or to build SDL2 & co. from source codes.
The important facts:
=over
=item * The module does not modify in any way the already existing SDL2
installation on your system.
=item * If you reinstall SDL2 libs on your system you do not need to
reinstall Alien::SDL2 (providing that you use the same directory for
the new installation).
=item * The prebuild binaries and/or binaries built from sources are always
installed into perl module's 'share' directory.
=item * If you use prebuild binaries and/or binaries built from sources
it happens that some of the dynamic libraries (*.so, *.dll) will not
automaticly loadable as they will be stored somewhere under perl module's
'share' directory. To handle this scenario Alien::SDL2 offers some special
functionality (see below).
=back
=head1 METHODS
=head2 config()
This function is the main public interface to this module. Basic
( run in 0.723 second using v1.01-cache-2.11-cpan-0b5f733616e )