Debian Codegraph @

Build.PL

raw
1 #!perl
2 use 5.008;
3 use strict;
4 use warnings FATAL => 'all';
5 use lib 'inc';
6 use Alien::SDL qw();
7 use SDL::Config;
8 use File::Spec;
9 use Config qw(%Config);
10 use My::Builder;
11 use ExtUtils::CBuilder qw();
12
13 use lib 'lib';
14 use Games::FrozenBubble;
15
16 my $prefix = Alien::SDL->config('prefix');
17 my $cflags = '-I'
18 . File::Spec->catfile( $prefix, 'include' )
19 ;
20 $cflags .= ' -fnested-functions' if $^O =~ /darwin/;
21 ###!!! this looks strange, you perhaps meant "$cflags .= ..."
22 ###!!! I intended Alien::SDL to add -I$prefix/include automatically, please tell me when it does not work (kmx)
23 my $devnull = File::Spec->devnull();
24 my @cflags = ExtUtils::CBuilder->new->split_like_shell( $cflags );
25 my @linkers = ( ExtUtils::CBuilder->new->split_like_shell( Alien::SDL->config('libs', '-lSDL_mixer', '-lSDL_Pango') ) );
26 push @linkers, '-liconv'
27 if $^O =~ /win/i; ###!!! really only Win needs this? ; BEWARE this matches also 'darwin', 'cygwin'!!!!
28
29 my $CPAN_test_NA;
30
31 $CPAN_test_NA = "Cannot find 'iconv.h'" unless Alien::SDL->check_header('iconv.h');
32 $CPAN_test_NA = "Cannot find 'math.h'" unless Alien::SDL->check_header('math.h');
33 $CPAN_test_NA = "Cannot find 'SDL.h'" unless Alien::SDL->check_header('SDL.h');
34 $CPAN_test_NA = "Cannot find 'SDL_mixer.h'" unless Alien::SDL->check_header('SDL_mixer.h');
35
36 $CPAN_test_NA = "SDL_perl need to be built with SDL_image (png) support" unless SDL::Config->has('SDL_image');
37 $CPAN_test_NA = "SDL_perl need to be built with SDL_mixer (ogg) support" unless SDL::Config->has('SDL_mixer');
38 $CPAN_test_NA = "SDL_perl need to be built with SDL_Pango support" unless SDL::Config->has('SDL_Pango');
39 $CPAN_test_NA = "SDL_perl need to be built with SDL_ttf support" unless SDL::Config->has('SDL_ttf');
40
41 if( $CPAN_test_NA ){ warn $CPAN_test_NA; exit(0) }
42
43
44 My::Builder->new(
45 add_to_cleanup => [
46 'lib/Games/FrozenBubble/CStuff.c',
47 'lib/Games/FrozenBubble/CStuff.o',
48 'server/fb-server.c', #preprocessed by perl from $cfile_tmp
49 'server/net.c',
50 'server/fb-server.o',
51 'server/game.o',
52 'server/log.o',
53 'server/net.o',
54 'server/tools.o',
55 'bin/fb-server',
56 ],
57 dist_abstract => 'Puzzle with Bubbles', # taken from openSUSE rpm spec file
58 dynamic_config => 1,
59 extra_compiler_flags => \@cflags ,
60 extra_linker_flags => \@linkers,
61 license => 'gpl2',
62 meta_merge => {
63 resources => {
64 repository => 'http://github.com/kthakore/frozen-bubble',
65 bugtracker => 'http://sdlperl.ath.cx/projects/SDLPerl/query?component=FrozenBubble',
66 },
67 },
68 module_name => 'Games::FrozenBubble',
69 dist_version => $Games::FrozenBubble::VERSION,
70 share_dir => 'share',
71 no_index => { directory => [ 'server' ] }, # tell PAUSE to not index 'server' subdirectory
72 configure_requires => { #need to have for running: perl Buil.PL
73 'perl' => '5.008',
74 'Errno' => 0,
75 'Data::Dumper' => 0,
76 'Getopt::Long' => 0,
77 'IO::Socket' => '1.24', # part od IO distribution
78 'Math::Trig' => 0,
79 'parent' => 0,
80 'Alien::SDL' => '1.412',
81 'SDL' => '2.511',
82 'ExtUtils::CBuilder' => 0,
83 'Time::HiRes' => 0,
84 'Locale::Maketext::Simple' => 0,
85 'Module::Build' => '0.36', # for share_dir
86 'Locale::Maketext::Extract' => 0,
87 'autodie' => 0,
88 'ExtUtils::ParseXS' => '2.16',
89 'File::Basename' => 0,
90 'File::Spec::Functions' => 0,
91 'ExtUtils::CBuilder' => 0,
92 'File::Copy' => 0,
93 'File::Slurp' => 0,
94 'IPC::System::Simple' => 0,
95 },
96 build_requires => { #need to have for running: ./Build (install|test), basically should be a superset of 'requires' as we run testsuite
97 'perl' => '5.008',
98 'Errno' => 0,
99 'Data::Dumper' => 0,
100 'Getopt::Long' => 0,
101 'IO::Socket' => '1.24', # part od IO distribution
102 'Math::Trig' => 0,
103 'parent' => 0,
104 'Alien::SDL' => '1.413',
105 'SDL' => '2.511',
106 'Time::HiRes' => 0,
107 'Locale::Maketext::Simple' => 0,
108 'Module::Build' => '0.36', # for share_dir
109 'Locale::Maketext::Extract' => 0,
110 'autodie' => 0,
111 'ExtUtils::ParseXS' => '2.16',
112 'File::Basename' => 0,
113 'File::Spec::Functions' => 0,
114 'ExtUtils::CBuilder' => 0,
115 'File::Copy' => 0,
116 'File::Slurp' => 0,
117 'Compress::Bzip2' => 0,
118 'IPC::System::Simple' => 0,
119
120 },
121 requires => {
122 'perl' => '5.008',
123 'POSIX' => 0,
124 'Carp' => 0,
125 'DynaLoader' => 0,
126 'Fcntl' => 0,
127 # now non-core modules
128 'Errno' => 0,
129 'Data::Dumper' => 0,
130 'Getopt::Long' => 0,
131 'IO::Socket' => '1.24', # part of IO distribution
132 'Math::Trig' => 0,
133 'parent' => 0,
134 'Alien::SDL' => '1.413',
135 'SDL' => '2.511',
136 'Time::HiRes' => 0,
137 'Locale::Maketext::Simple' => 0,
138 'Locale::Maketext::Extract' => 0,
139 'File::Glob' => 0,
140 'File::Which' => 0,
141 'Compress::Bzip2' => 0,
142 'IPC::System::Simple' => 0,
143
144 },
145 )->create_build_script;