Commit | Line | Data |
bfd90409 |
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 | |
49 | '/System/Library/Frameworks/SDL_mixer.framework/Headers' => '../../lib', |
50 | '/System/Library/Frameworks/SDL_image.framework/Headers' => '../../lib', |
51 | '/System/Library/Frameworks/SDL_ttf.framework/Headers' => '../../lib', |
52 | '/System/Library/Frameworks/libogg.framework/Headers' => '../../lib', |
53 | '/System/Library/Frameworks/libvorbis.framework/Headers' => '../../lib', |
54 | '/System/Library/Frameworks/libvorbisfile.framework/Headers' => '../../lib', |
55 | '/System/Library/Frameworks/libvorbisenc.framework/Headers' => '../../lib', |
56 | '../../include' => '../../lib', |
57 | '/System/Library/Frameworks/OpenGL.framework/Headers' => |
58 | '/System/Library/Frameworks/OpenGL.framework/Libraries', |
59 | ); |
60 | } |
61 | |
62 | sub build_c_sources |
63 | { |
64 | return [qw/ |
65 | launcher.m |
66 | /]; |
67 | } |
68 | |
69 | sub build_c_source |
70 | { |
71 | return 'MacOSX'; |
72 | } |
73 | |
74 | sub build_install_base |
75 | { |
76 | return "SDL Perl.app/Contents/Resources"; |
77 | } |
78 | |
79 | sub build_bundle |
80 | { |
81 | $bundle_contents="SDL Perl.app/Contents"; |
82 | system "mkdir -p \"$bundle_contents\""; |
83 | mkdir "$bundle_contents/MacOS",0755; |
84 | $libs = `sdl-config --libs`; |
85 | chomp($libs); |
86 | $libs =~ s/-lSDLmain//g; |
87 | system "gcc $libs -framework Cocoa `perl -MExtUtils::Embed -e ldopts` MacOSX/launcher.o -o \"$bundle_contents/MacOS/SDL Perl\""; |
88 | |
89 | mkdir "$bundle_contents/Resources",0755; |
90 | system "echo \"APPL????\" > \"$bundle_contents/PkgInfo\""; |
91 | system "cp MacOSX/Info.plist \"$bundle_contents/\""; |
92 | system "cp \"MacOSX/SDL Perl.icns\" \"$bundle_contents/Resources\""; |
93 | } |
94 | |
95 | 1; |