use SDL::Build;
use YAML;
use YAML::Node;
+use inc::Utility qw(sdl_libs sdl_c_flags);
-my $sdl_compile_flags = `sdl-config --cflags`;
-my $sdl_link_flags = `sdl-config --libs`;
-
-if ($? >> 8)
-{
- croak "SDL doesn't appear to be installed.\n" .
- "Please check that sdl-config is in your path and try again.\n";
-}
-
-chomp( $sdl_compile_flags );
-chomp( $sdl_link_flags );
-
+my $sdl_compile_flags = sdl_c_flags();
+my $sdl_link_flags = sdl_libs();
# subsystem to build
# file
# location of source file => location of build file to get name right
--- /dev/null
+package inc::Utility;
+use strict;
+use warnings;
+use Carp;
+
+BEGIN{
+ require Exporter;
+ our @ISA = qw(Exporter);
+ our @EXPORT_OK = qw(sdl_con_found sdl_libs sdl_c_flags);
+}
+
+#checks to see if sdl-config is availabe
+#
+sub sdl_con_found
+{
+ `sdl-config --libs`;
+ return 0 if ($? >> 8);
+ return 1;
+}
+
+sub sdl_libs
+{
+ if(sdl_con_found)
+ {
+ local $_ = `sdl-config --libs`;
+ return chomp($_);
+ }
+ else
+ {
+ return undef;
+ }
+}
+
+sub sdl_c_flags
+{
+ if(sdl_con_found)
+ {
+ local $_ = `sdl-config --cflags`;
+ return chomp($_);
+ }
+ else
+ {
+ return undef;
+ }
+}
+
+1;
$sdl_config = {
'OpenGL' => {
'GL' => [
- '/System/Library/Frameworks/OpenGL.framework/Headers',
- '/System/Library/Frameworks/OpenGL.framework/Libraries'
+ '/usr/include/GL',
+ '/usr/lib'
],
'SDL' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'GLU' => [
- '/System/Library/Frameworks/OpenGL.framework/Headers',
- '/System/Library/Frameworks/OpenGL.framework/Libraries'
+ '/usr/include/GL',
+ '/usr/lib'
]
},
'SDL' => {
'png' => [
- '/opt/local/include',
- '/opt/local/lib'
+ '/usr/include',
+ '/usr/lib'
],
'SDL' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'SDL_ttf' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'SDL_net' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'SDL_image' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'SDL_gfx' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'jpeg' => [
- '/opt/local/include',
- '/opt/local/lib'
+ '/usr/include',
+ '/usr/lib'
],
- 'smpeg' => 0,
+ 'smpeg' => [
+ '/usr/include/smpeg',
+ '/usr/lib'
+ ],
'SDL_mixer' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
]
},
'SFont' => {
'SDL_image' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
],
'SDL' => [
- '/opt/local/include/SDL',
- '/opt/local/lib'
+ '/usr/include/SDL',
+ '/usr/lib'
]
}
};