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