1# Alien::SDL [![Build Status](https://travis-ci.org/PerlGameDev/Alien-SDL.svg?branch=master)](https://travis-ci.org/PerlGameDev/Alien-SDL) 2 3NAME 4 Alien::SDL - building, finding and using SDL binaries 5 6VERSION 7 Version 1.444 8 9SYNOPSIS 10 Alien::SDL tries (in given order) during its installation: 11 12 * When given `--with-sdl-config' option use specified sdl-config script 13 to locate SDL libs. 14 perl Build.PL --with-sdl-config=/opt/sdl/bin/sdl-config 15 16 or using default script name 'sdl-config' by running: 17 18 perl Build.PL --with-sdl-config 19 20 IMPORTANT NOTE: Using --with-sdl-config avoids considering any other 21 build methods; no prompt with other available build options. 22 23 * Locate an already installed SDL via 'sdl-config' script. 24 * Check for SDL libs in directory specified by SDL_INST_DIR variable. In 25 this case the module performs SDL library detection via 26 '$SDL_INST_DIR/bin/sdl-config' script. 27 SDL_INST_DIR=/opt/sdl perl ./Build.PL 28 29 * Download prebuilt SDL binaries (if available for your platform). 30 * Build SDL binaries from source codes (if possible on your system). 31 32 Later you can use Alien::SDL in your module that needs to link agains 33 SDL and/or related libraries like this: 34 35 # Sample Makefile.pl 36 use ExtUtils::MakeMaker; 37 use Alien::SDL; 38 39 WriteMakefile( 40 NAME => 'Any::SDL::Module', 41 VERSION_FROM => 'lib/Any/SDL/Module.pm', 42 LIBS => Alien::SDL->config('libs', [-lAdd_Lib]), 43 INC => Alien::SDL->config('cflags'), 44 # + additional params 45 ); 46 47DESCRIPTION 48 Please see Alien for the manifesto of the Alien namespace. 49 50 In short `Alien::SDL' can be used to detect and get configuration 51 settings from an installed SDL and related libraries. Based on your 52 platform it offers the possibility to download and install prebuilt 53 binaries or to build SDL & co. from source codes. 54 55 The important facts: 56 57 * The module does not modify in any way the already existing SDL 58 installation on your system. 59 * If you reinstall SDL libs on your system you do not need to reinstall 60 Alien::SDL (providing that you use the same directory for the new 61 installation). 62 * The prebuild binaries and/or binaries built from sources are always 63 installed into perl module's 'share' directory. 64 * If you use prebuild binaries and/or binaries built from sources it 65 happens that some of the dynamic libraries (*.so, *.dll) will not 66 automaticly loadable as they will be stored somewhere under perl 67 module's 'share' directory. To handle this scenario Alien::SDL offers 68 some special functionality (see below). 69 70METHODS 71 config() 72 This function is the main public interface to this module. Basic 73 functionality works in a very similar maner to 'sdl-config' script: 74 75 Alien::SDL->config('prefix'); # gives the same string as 'sdl-config --prefix' 76 Alien::SDL->config('version'); # gives the same string as 'sdl-config --version' 77 Alien::SDL->config('libs'); # gives the same string as 'sdl-config --libs' 78 Alien::SDL->config('cflags'); # gives the same string as 'sdl-config --cflags' 79 80 On top of that this function supports special parameters: 81 82 Alien::SDL->config('ld_shared_libs'); 83 84 Returns a list of full paths to shared libraries (*.so, *.dll) that will 85 be required for running the resulting binaries you have linked with SDL 86 libs. 87 88 Alien::SDL->config('ld_paths'); 89 90 Returns a list of full paths to directories with shared libraries (*.so, 91 *.dll) that will be required for running the resulting binaries you have 92 linked with SDL libs. 93 94 Alien::SDL->config('ld_shlib_map'); 95 96 Returns a reference to hash of value pairs '<libnick>' => 97 '<full_path_to_shlib'>, where '<libnick>' is shortname for SDL related 98 library like: SDL, SDL_gfx, SDL_net, SDL_sound ... + some non-SDL 99 shortnames e.g. smpeg, jpeg, png. 100 101 NOTE: config('ld_<something>') return an empty list/hash if you have 102 decided to use SDL libraries already installed on your system. This 103 concerns 'sdl-config' detection and detection via 104 '$SDL_INST_DIR/bin/sdl-config'. 105 106 check_header() 107 This function checks the availability of given header(s) when using 108 compiler options provided by "Alien::SDL->config('cflags')". 109 110 Alien::SDL->check_header('SDL.h'); 111 Alien::SDL->check_header('SDL.h', 'SDL_net.h'); 112 113 Returns 1 if all given headers are available, 0 otherwise. 114 115 get_header_version() 116 Tries to find a header file specified as a param in SDL prefix direcotry 117 and based on "#define" macros inside this header file tries to get a 118 version triplet. 119 120 Alien::SDL->get_header_version('SDL_mixer.h'); 121 Alien::SDL->get_header_version('SDL_version.h'); 122 Alien::SDL->get_header_version('SDL_gfxPrimitives.h'); 123 Alien::SDL->get_header_version('SDL_image.h'); 124 Alien::SDL->get_header_version('SDL_mixer.h'); 125 Alien::SDL->get_header_version('SDL_net.h'); 126 Alien::SDL->get_header_version('SDL_ttf.h'); 127 Alien::SDL->get_header_version('smpeg.h'); 128 129 Returns string like '1.2.3' or undef if not able to find and parse 130 version info. 131 132BUGS 133 Please post issues and bugs at 134 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Alien-SDL 135 136AUTHOR 137 Kartik Thakore 138 CPAN ID: KTHAKORE 139 Thakore.Kartik@gmail.com 140 http://yapgh.blogspot.com 141 142ACKNOWLEDGEMENTS 143 kmx - complete redesign between versions 0.7.x and 0.8.x 144 145COPYRIGHT 146 This program is free software; you can redistribute it and/or modify it 147 under the same terms as Perl itself. 148 149 The full text of the license can be found in the LICENSE file included 150 with this module. 151 152