3 # Copyright (C) 2003 chromatic
4 # Copyright (C) 2004 David J. Goehrig
5 # Copyright (C) 2009 Kartik Thakore
16 my $sdl_compile_flags = `sdl-config --cflags`;
17 my $sdl_link_flags = `sdl-config --libs`;
21 croak "SDL doesn't appear to be installed.\n" .
22 "Please check that sdl-config is in your path and try again.\n";
25 chomp( $sdl_compile_flags );
26 chomp( $sdl_link_flags );
30 # location of source file => location of build file to get name right
32 # name of shared library (soname)
33 # preprocessor definition
40 to => './SDL_perl.xs',
42 libraries => [qw( SDL SDL_image SDL_mixer SDL_net SDL_ttf SDL_gfx
47 from => 'src/OpenGL.xs',
48 to => 'SDL/OpenGL.xs',
50 libraries => [qw( SDL GL GLU )],
54 from => 'src/SFont.xs',
57 libraries => [qw( SDL SDL_image )],
67 define => 'HAVE_SDL_IMAGE',
68 header => 'SDL_image.h'
71 define => 'HAVE_SDL_MIXER',
72 header => 'SDL_mixer.h'
75 define => 'HAVE_SDL_NET',
79 define => 'HAVE_SDL_TTF',
83 define => 'HAVE_SDL_GFX',
84 header => 'SDL_gfxPrimitives.h'
91 define => 'HAVE_JPEG',
92 header => 'jpeglib.h',
95 define => 'HAVE_SMPEG',
103 define => 'HAVE_GLU',
108 # need the platform-specific module to find include paths correctly
109 # see build/lib/SDL/Build/*pm
110 my $arch = SDL::Build->get_arch( $^O );
112 # see which subsystems can be built -- do we have headers for them?
113 my $build_systems = $arch->find_subsystems( \%subsystems, \%libraries );
115 # now write SDL::Config
116 $arch->write_sdl_config( $build_systems );
118 # and fetch all of the information needed to compile
119 my $defines = $arch->build_defines( \%libraries, $build_systems );
120 my $includes = $arch->build_includes( \%libraries, $build_systems );
121 my $links = $arch->build_links( \%libraries, $build_systems );
123 # mangle the compilable files into a format Module::Build can understand
124 my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
126 my $build = SDL::Build->new(
127 module_name => 'SDL',
128 dist_name => 'SDL_Perl',
130 dist_version_from => 'lib/SDL.pm',
133 'Test::Simple' => '0.47',
134 'Module::Build' => '0.22',
138 'Pod::ToDemo' => '0.20',
142 dist_author => 'David J. Goehrig <DGOEHRIG@cpan.org>',
145 # and here's where the real (and ugly) magic works... see SDL::Build
156 # now we're ready to go!
157 $build->create_build_script();