3 # Copyright (C) 2003 chromatic
4 # Copyright (C) 2004 David J. Goehrig
5 # Copyright (C) 2009 Kartik Thakore
17 my $sdl_compile_flags = `sdl-config --cflags`;
18 my $sdl_link_flags = `sdl-config --libs`;
22 croak "SDL doesn't appear to be installed.\n" .
23 "Please check that sdl-config is in your path and try again.\n";
26 chomp( $sdl_compile_flags );
27 chomp( $sdl_link_flags );
31 # location of source file => location of build file to get name right
33 # name of shared library (soname)
34 # preprocessor definition
41 to => './SDL_perl.xs',
43 libraries => [qw( SDL SDL_image SDL_mixer SDL_net SDL_ttf SDL_gfx
48 from => 'src/OpenGL.xs',
49 to => 'SDL/OpenGL.xs',
51 libraries => [qw( SDL GL GLU )],
55 from => 'src/SFont.xs',
58 libraries => [qw( SDL SDL_image )],
68 define => 'HAVE_SDL_IMAGE',
69 header => 'SDL_image.h'
72 define => 'HAVE_SDL_MIXER',
73 header => 'SDL_mixer.h'
76 define => 'HAVE_SDL_NET',
80 define => 'HAVE_SDL_TTF',
84 define => 'HAVE_SDL_GFX',
85 header => 'SDL_gfxPrimitives.h'
92 define => 'HAVE_JPEG',
93 header => 'jpeglib.h',
96 define => 'HAVE_SMPEG',
104 define => 'HAVE_GLU',
109 # need the platform-specific module to find include paths correctly
110 # see build/lib/SDL/Build/*pm
111 my $arch = SDL::Build->get_arch( $^O );
113 # see which subsystems can be built -- do we have headers for them?
114 my $build_systems = $arch->find_subsystems( \%subsystems, \%libraries );
116 # now write SDL::Config
117 $arch->write_sdl_config( $build_systems );
119 # and fetch all of the information needed to compile
120 my $defines = $arch->build_defines( \%libraries, $build_systems );
121 my $includes = $arch->build_includes( \%libraries, $build_systems );
122 my $links = $arch->build_links( \%libraries, $build_systems );
124 # mangle the compilable files into a format Module::Build can understand
125 my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
127 my $build = SDL::Build->new(
128 module_name => 'SDL',
129 dist_name => 'SDL_Perl',
131 dist_version_from => 'lib/SDL.pm',
134 'Test::Simple' => '0.47',
135 'Module::Build' => '0.22',
139 'Pod::ToDemo' => '0.20',
143 dist_author => 'David J. Goehrig <DGOEHRIG@cpan.org>',
146 # and here's where the real (and ugly) magic works... see SDL::Build
157 # now we're ready to go!
158 $build->create_build_script();