3 # Copyright (C) 2003 chromatic
4 # Copyright (C) 2004 David J. Goehrig
5 # Copyright (C) 2009 Kartik Thakore
18 print STDERR <<BROKENWIN if ($^O =~ /MSWin.*|cygwin/ );
19 *************************** !!!WARNING!!! *****************************
20 Windows support is currently experimental - you can continue, but
21 you've been warned! If you are interested in helping please contact us
22 at sdl-devel\@perl.org, or join us on #sdl in irc.perl.org
23 ***********************************************************************
26 my $sdl_compile_flags = SDL::Utility->sdl_c_flags();
27 my $sdl_link_flags = SDL::Utility->sdl_libs();
30 # location of source file => location of build file to get name right
32 # name of shared library (soname)
33 # preprocessor definition
40 to => 'lib/SDL_perl.xs',
42 libraries => [qw( SDL SDL_image SDL_mixer SDL_net SDL_ttf SDL_gfx
47 from => 'src/Core/Video.xs',
48 to => 'lib/SDL/Video.xs',
50 libraries => [qw( SDL )],
54 from => 'src/Core/objects/Rect.xs',
55 to => 'lib/SDL/Rect.xs',
57 libraries => [qw( SDL )],
61 from => 'src/Core/objects/Color.xs',
62 to => 'lib/SDL/Color.xs',
64 libraries => [qw( SDL )],
68 from => 'src/Core/objects/Surface.xs',
69 to => 'lib/SDL/Surface.xs',
71 libraries => [qw( SDL )],
75 from => 'src/Core/objects/Overlay.xs',
76 to => 'lib/SDL/Overlay.xs',
78 libraries => [qw( SDL )],
82 from => 'src/Core/objects/PixelFormat.xs',
83 to => 'lib/SDL/PixelFormat.xs',
85 libraries => [qw( SDL )],
89 from => 'src/Core/objects/VideoInfo.xs',
90 to => 'lib/SDL/VideoInfo.xs',
92 libraries => [qw( SDL )],
97 from => 'src/TTF/objects/TTF_Font.xs',
98 to => 'lib/SDL/TTF_Font.xs',
100 libraries => [qw( SDL SDL_ttf )],
104 from => 'src/OpenGL.xs',
105 to => 'lib/SDL/OpenGL.xs',
107 libraries => [qw( SDL GL GLU )],
111 from => 'src/SFont.xs',
112 to => 'lib/SDL/SFont.xs',
114 libraries => [qw( SDL SDL_ttf )],
120 define => 'HAVE_SDL',
124 define => 'HAVE_SDL_IMAGE',
125 header => 'SDL_image.h'
128 define => 'HAVE_SDL_MIXER',
129 header => 'SDL_mixer.h'
132 define => 'HAVE_SDL_NET',
133 header => 'SDL_net.h'
136 define => 'HAVE_SDL_TTF',
137 header => 'SDL_ttf.h'
140 define => 'HAVE_SDL_GFX',
141 header => 'SDL_gfxPrimitives.h'
144 define => 'HAVE_PNG',
148 define => 'HAVE_JPEG',
149 header => 'jpeglib.h',
152 define => 'HAVE_SMPEG',
160 define => 'HAVE_GLU',
165 # need the platform-specific module to find include paths correctly
166 # see build/lib/SDL/Build/*pm
167 my $arch = SDL::Build->get_arch( $^O );
169 # see which subsystems can be built -- do we have headers for them?
170 my $build_systems = $arch->find_subsystems( \%subsystems, \%libraries );
172 # now write SDL::Config
173 $arch->write_sdl_config( $build_systems );
175 # and fetch all of the information needed to compile
176 my $defines = $arch->build_defines( \%libraries, $build_systems );
177 my $includes = $arch->build_includes( \%libraries, $build_systems );
178 my $links = $arch->build_links( \%libraries, $build_systems );
180 # mangle the compilable files into a format Module::Build can understand
181 my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
183 my $build = SDL::Build->new(
184 module_name => 'SDL',
185 dist_name => 'SDL_Perl',
187 dist_version_from => 'lib/SDL.pm',
188 configure_requires =>
191 'ExtUtils::CBuilder' => '0.260301',
192 'Alien::SDL' => '0.7.1',
196 'Test::Simple' => '0.47',
201 'Pod::ToDemo' => '0.20'
207 no_index => { file => [ <make/lib/SDL/*.pm>, <make/lib/SDL/Build/*.pm>, <make/lib/ExtUtils/CBuilder/*>, <make/lib/ExtUtils/*>, <make/lib/ExtUtils/CBuilder/Platform/Windows.pm> ] },
209 dist_author => 'David J. Goehrig <DGOEHRIG@cpan.org>, Kartik Thakore <KTHAKORE@cpan.org>',
212 if($arch eq 'Darwin')
214 $build->{c_source} = $arch->build_c_source( \%libraries, $build_systems );
215 $build->{c_sources} = $arch->build_c_sources( \%libraries, $build_systems );
216 $build->{install_base} = $arch->build_install_base( \%libraries, $build_systems );
220 # and here's where the real (and ugly) magic works... see SDL::Build
230 # now we're ready to go!
231 $build->create_build_script();