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 you've been warned!
21 If you are interested in helping please contact us at sdl-devel\@perl.org.
22 *******************************************************************************
25 my $sdl_compile_flags = SDL::Utility->sdl_c_flags();
26 my $sdl_link_flags = SDL::Utility->sdl_libs();
29 # location of source file => location of build file to get name right
31 # name of shared library (soname)
32 # preprocessor definition
39 to => 'lib/SDL_perl.xs',
41 libraries => [qw( SDL SDL_image SDL_mixer SDL_net SDL_ttf SDL_gfx
46 from => 'src/Core/objects/Rect.xs',
47 to => 'lib/SDL/Rect.xs',
49 libraries => [qw( SDL )],
53 from => 'src/Core/objects/Color.xs',
54 to => 'lib/SDL/Color.xs',
56 libraries => [qw( SDL )],
60 from => 'src/Core/objects/Surface.xs',
61 to => 'lib/SDL/Surface.xs',
63 libraries => [qw( SDL SDL_image )],
67 from => 'src/Core/objects/PixelFormat.xs',
68 to => 'lib/SDL/PixelFormat.xs',
70 libraries => [qw( SDL SDL_image )],
74 from => 'src/TTF/objects/TTF_Font.xs',
75 to => 'lib/SDL/TTF_Font.xs',
77 libraries => [qw( SDL SDL_ttf )],
81 from => 'src/OpenGL.xs',
82 to => 'lib/SDL/OpenGL.xs',
84 libraries => [qw( SDL GL GLU )],
88 from => 'src/SFont.xs',
89 to => 'lib/SDL/SFont.xs',
91 libraries => [qw( SDL SDL_image SDL_ttf )],
101 define => 'HAVE_SDL_IMAGE',
102 header => 'SDL_image.h'
105 define => 'HAVE_SDL_MIXER',
106 header => 'SDL_mixer.h'
109 define => 'HAVE_SDL_NET',
110 header => 'SDL_net.h'
113 define => 'HAVE_SDL_TTF',
114 header => 'SDL_ttf.h'
117 define => 'HAVE_SDL_GFX',
118 header => 'SDL_gfxPrimitives.h'
121 define => 'HAVE_PNG',
125 define => 'HAVE_JPEG',
126 header => 'jpeglib.h',
129 define => 'HAVE_SMPEG',
137 define => 'HAVE_GLU',
142 # need the platform-specific module to find include paths correctly
143 # see build/lib/SDL/Build/*pm
144 my $arch = SDL::Build->get_arch( $^O );
146 # see which subsystems can be built -- do we have headers for them?
147 my $build_systems = $arch->find_subsystems( \%subsystems, \%libraries );
149 # now write SDL::Config
150 $arch->write_sdl_config( $build_systems );
152 # and fetch all of the information needed to compile
153 my $defines = $arch->build_defines( \%libraries, $build_systems );
154 my $includes = $arch->build_includes( \%libraries, $build_systems );
155 my $links = $arch->build_links( \%libraries, $build_systems );
157 # mangle the compilable files into a format Module::Build can understand
158 my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
160 my $build = SDL::Build->new(
161 module_name => 'SDL',
162 dist_name => 'SDL_Perl',
164 dist_version_from => 'lib/SDL.pm',
165 configure_requires =>
168 'ExtUtils::CBuilder' => '0.260301',
169 'Alien::SDL' => '0.7.1',
173 'Test::Simple' => '0.47',
178 'Pod::ToDemo' => '0.20'
184 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> ] },
186 dist_author => 'David J. Goehrig <DGOEHRIG@cpan.org>, Kartik Thakore <KTHAKORE@cpan.org>',
189 if($arch eq 'Darwin')
191 $build->{c_source} = $arch->build_c_source( \%libraries, $build_systems );
192 $build->{c_sources} = $arch->build_c_sources( \%libraries, $build_systems );
193 $build->{install_base} = $arch->build_install_base( \%libraries, $build_systems );
197 # and here's where the real (and ugly) magic works... see SDL::Build
207 # now we're ready to go!
208 $build->create_build_script();