Tweaked a few setting on the Mac OS X build system to locate Mac Ports libraries...
[sdlgit/SDL_perl.git] / make / lib / SDL / Build / Darwin.pm
1 #!/usr/bin/env perl
2 #
3 # Darwin.pm
4 #
5 # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
6 #
7 # ------------------------------------------------------------------------------
8 #
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 # ------------------------------------------------------------------------------
24 #
25 # Please feel free to send questions, suggestions or improvements to:
26 #
27 #       David J. Goehrig
28 #       dgoehrig@cpan.org
29 #
30
31 package SDL::Build::Darwin;
32
33 use base 'SDL::Build';
34
35 sub fetch_includes
36 {
37         return (
38         '/usr/local/include/SDL'   => '/usr/local/lib',
39         '/usr/local/include'       => '/usr/local/lib',
40         '/usr/local/include/smpeg' => '/usr/local/lib',
41         '/usr/include/SDL'         => '/usr/lib',
42         '/usr/include'             => '/usr/lib',
43         '/usr/include/smpeg'       => '/usr/lib',
44         '/usr/local/include/GL'    => '/usr/local/lib',
45         '/usr/local/include/gl'    => '/usr/local/lib',
46         '/usr/include/GL'          => '/usr/lib', 
47         '/usr/include/gl'          => '/usr/lib', 
48         '/opt/local/include/SDL'   => '/opt/local/lib',         # Mac Ports
49         '/opt/local/include'   => '/opt/local/lib',             # Mac Ports
50
51         '/System/Library/Frameworks/SDL_mixer.framework/Headers'     => '../../lib',
52         '/System/Library/Frameworks/SDL_image.framework/Headers'     => '../../lib',
53         '/System/Library/Frameworks/SDL_ttf.framework/Headers'       => '../../lib',
54         '/System/Library/Frameworks/libogg.framework/Headers'        => '../../lib',
55         '/System/Library/Frameworks/libvorbis.framework/Headers'     => '../../lib',
56         '/System/Library/Frameworks/libvorbisfile.framework/Headers' => '../../lib',
57         '/System/Library/Frameworks/libvorbisenc.framework/Headers'  => '../../lib',
58         '../../include'                                              => '../../lib',
59         '/System/Library/Frameworks/OpenGL.framework/Headers'        =>
60                 '/System/Library/Frameworks/OpenGL.framework/Libraries',
61         );
62 }
63
64 sub build_c_sources 
65 {
66         return [qw/ 
67                 launcher.m
68         /];
69 }
70
71 sub build_c_source
72 {
73         return 'MacOSX';
74 }
75
76 sub build_install_base
77 {
78         return "SDL Perl.app/Contents/Resources";       
79 }
80
81 sub build_bundle
82 {
83         $bundle_contents="SDL Perl.app/Contents";
84         system "mkdir -p \"$bundle_contents\"";
85         mkdir "$bundle_contents/MacOS",0755;
86         $libs = `sdl-config --libs`;
87         chomp($libs);
88         $libs =~ s/-lSDLmain//g;
89         system "gcc $libs -framework Cocoa `perl -MExtUtils::Embed -e ldopts` MacOSX/launcher.o -o \"$bundle_contents/MacOS/SDL Perl\"";
90
91         mkdir "$bundle_contents/Resources",0755;
92         system "echo \"APPL????\" > \"$bundle_contents/PkgInfo\"";
93         system "cp MacOSX/Info.plist \"$bundle_contents/\"";
94         system "cp \"MacOSX/SDL Perl.icns\" \"$bundle_contents/Resources\"";
95 }
96
97 1;