3 # Copyright (C) 2003 chromatic
4 # Copyright (C) 2004 David J. Goehrig
14 my $sdl_compile_flags = `sdl-config --cflags`;
15 my $sdl_link_flags = `sdl-config --libs`;
19 die "SDL doesn't appear to be installed.\n" .
20 "Please check that sdl-config is in your path and try again.\n";
23 chomp( $sdl_compile_flags );
24 chomp( $sdl_link_flags );
28 # location of source file => location of build file to get name right
30 # name of shared library (soname)
31 # preprocessor definition
38 to => 'SDL/SDL_perl.xs',
40 libraries => [qw( SDL SDL_image SDL_mixer SDL_net SDL_ttf SDL_gfx
45 from => 'src/OpenGL.xs',
46 to => 'SDL/OpenGL/OpenGL.xs',
48 libraries => [qw( SDL GL GLU )],
52 from => 'src/SFont.xs',
53 to => 'SDL/SFont/SFont.xs',
55 libraries => [qw( SDL SDL_image )],
65 define => 'HAVE_SDL_IMAGE',
66 header => 'SDL_image.h'
69 define => 'HAVE_SDL_MIXER',
70 header => 'SDL_mixer.h'
73 define => 'HAVE_SDL_NET',
77 define => 'HAVE_SDL_TTF',
81 define => 'HAVE_SDL_GFX',
82 header => 'SDL_gfxPrimitives.h'
89 define => 'HAVE_JPEG',
90 header => 'jpeglib.h',
93 define => 'HAVE_SMPEG',
101 define => 'HAVE_GLU',
106 # need the platform-specific module to find include paths correctly
107 # see build/lib/SDL/Build/*pm
108 my $arch = SDL::Build->get_arch( $^O );
110 # see which subsystems can be built -- do we have headers for them?
111 my $build_systems = $arch->find_subsystems( \%subsystems, \%libraries );
113 # now write SDL::Config
114 $arch->write_sdl_config( $build_systems );
116 # and fetch all of the information needed to compile
117 my $defines = $arch->build_defines( \%libraries, $build_systems );
118 my $includes = $arch->build_includes( \%libraries, $build_systems );
119 my $links = $arch->build_links( \%libraries, $build_systems );
121 # mangle the compilable files into a format Module::Build can understand
122 my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
124 my $build = SDL::Build->new(
125 dist_name => 'SDL_Perl',
127 dist_version_from => 'lib/SDL.pm',
130 'Test::Simple' => '0.47',
131 'Module::Build' => '0.22',
135 'Pod::ToDemo' => '0.20',
139 dist_author => 'David J. Goehrig <DGOEHRIG@cpan.org>',
142 # and here's where the real (and ugly) magic works... see SDL::Build
153 # now we're ready to go!
154 $build->create_build_script();