perl Build.PL --with-sdl-config=/opt/sdl/bin/sdl-config
or using default script name 'sdl-config' by running:
perl Build.PL --with-sdl-config
IMPORTANT NOTE: Using --with-sdl-config avoids considering any other build methods; no prompt with other available build options.
SDL_INST_DIR=/opt/sdl perl ./Build.PL
Later you can use Alien::SDL in your module that needs to link agains SDL and/or related libraries like this:
# Sample Makefile.pl use ExtUtils::MakeMaker; use Alien::SDL; WriteMakefile( NAME => 'Any::SDL::Module', VERSION_FROM => 'lib/Any/SDL/Module.pm', LIBS => Alien::SDL->config('libs', [-lAdd_Lib]), INC => Alien::SDL->config('cflags'), # + additional params );
In short "Alien::SDL" can be used to detect and get configuration settings from an installed SDL and related libraries. Based on your platform it offers the possibility to download and install prebuilt binaries or to build SDL & co. from source codes.
The important facts:
Alien::SDL->config('prefix'); # gives the same string as 'sdl-config --prefix' Alien::SDL->config('version'); # gives the same string as 'sdl-config --version' Alien::SDL->config('libs'); # gives the same string as 'sdl-config --libs' Alien::SDL->config('cflags'); # gives the same string as 'sdl-config --cflags'
On top of that this function supports special parameters:
Alien::SDL->config('ld_shared_libs');
Returns a list of full paths to shared libraries (*.so, *.dll) that will be required for running the resulting binaries you have linked with SDL libs.
Alien::SDL->config('ld_paths');
Returns a list of full paths to directories with shared libraries (*.so, *.dll) that will be required for running the resulting binaries you have linked with SDL libs.
Alien::SDL->config('ld_shlib_map');
Returns a reference to hash of value pairs '<libnick>' => '<full_path_to_shlib'>, where '<libnick>' is shortname for SDL related library like: SDL, SDL_gfx, SDL_net, SDL_sound ... + some non-SDL shortnames e.g. smpeg, jpeg, png.
NOTE: config('ld_<something>') return an empty list/hash if you have decided to use SDL libraries already installed on your system. This concerns 'sdl-config' detection and detection via '$SDL_INST_DIR/bin/sdl-config'.
Alien::SDL->check_header('SDL.h'); Alien::SDL->check_header('SDL.h', 'SDL_net.h');
Returns 1 if all given headers are available, 0 otherwise.
Alien::SDL->get_header_version('SDL_mixer.h'); Alien::SDL->get_header_version('SDL_version.h'); Alien::SDL->get_header_version('SDL_gfxPrimitives.h'); Alien::SDL->get_header_version('SDL_image.h'); Alien::SDL->get_header_version('SDL_mixer.h'); Alien::SDL->get_header_version('SDL_net.h'); Alien::SDL->get_header_version('SDL_ttf.h'); Alien::SDL->get_header_version('smpeg.h');
Returns string like '1.2.3' or undef if not able to find and parse version info.
Kartik Thakore CPAN ID: KTHAKORE Thakore.Kartik@gmail.com http://yapgh.blogspot.com
kmx - complete redesign between versions 0.7.x and 0.8.x
The full text of the license can be found in the LICENSE file included with this module.