File: Makefile.win32

package info (click to toggle)
sdlperl 1.20.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,804 kB
  • ctags: 2,169
  • sloc: perl: 7,397; ansic: 232; makefile: 72; sh: 1
file content (163 lines) | stat: -rw-r--r-- 3,544 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env perl -w

use ExtUtils::MakeMaker;
use strict;
use Config;

#
# Configure SDL proper
#


my @defs;
my $sdl_cflags;
my $sdl_libs;
my @dirs;
my $inc_flags;
my $sdl_image;
my $sdl_mixer;
my $sdl_ttf;
my $sdl_net;
my $png;
my $jpeg;
my $gl;
my $glu;
my $smpeg;
my $gfx;
my $sound;
my @libDirs;
my $glLib;
my $gluLib;
my $glVendorFlags;


#
# Windows configuration detection
#  ( Cywin for unsupported, currently only VC++ 6 )
#

if ($^O eq "MSWin32") {

	warn "Warning: Env var INCLUDE should be set."  unless exists $ENV{INCLUDE};
	warn "Warning: Env var LIB should be set."  unless exists $ENV{LIB};

	my @incDirs = grep {$_} map {$_} split ';', $ENV{INCLUDE};
	my @libDirs = grep {$_} map {$_} split ';', $ENV{LIB};

	my $glVendor = $ENV{SDL_GL_VENDOR} || "MS";
	
	my $mesagl = ( $glVendor eq "MESA" ? 1 : ( $glVendor eq "MS" ? 0 : 
		die "Unrecognized SDL_GL_VENDOR: $glVendor\n" ) );

	($glLib,$gluLib,$glVendorFlags) =  $mesagl ?
		( '-lmesagl', '-lmesaglu -losmesa', '-DOPENGL_VENDOR_MESA -DCOMMON_OGL_SUPPORT') :
		( '-lopengl32', '-lglu32', '-DOPENGL_VENDOR_MS -DCOMMON_OGL_SUPPORT');

	@dirs=@incDirs;
	$sdl_libs = '-lsdl';
	my @dllDirs = (@libDirs, split ';', '"' . $ENV{PATH} . '"');

	for ( @dllDirs ) {
		$png = '-DHAVE_PNG' if -e "$_/libpng1.dll";
		$jpeg = '-DHAVE_JPEG' if -e "$_/jpeg.dll";
		$gl = '-DHAVE_GL $glVendorFlags' if -e "$_/gl.h";
		$sound = '-DHAVE_SDL_SOUND' if -e "$_/SDL_sound.h";
	}
	

} else {

	die <<EOT;
	Your current configuration is unsupported by this experimental Makefile.
	Please submit your bug to sdlperl\@sdlperl.org 
		
	Thank You
EOT

}

#
# Locate optional packages
#

for ( @dirs ) {
  print "Scanning Include Dirs: $_\n";
	$sdl_image = '-DHAVE_SDL_IMAGE' if -e "$_/SDL_image.h";
	$sdl_mixer = '-DHAVE_SDL_MIXER' if -e "$_/SDL_mixer.h";
	$sdl_net = '-DHAVE_SDL_NET' if -e "$_/SDL_net.h";
	$sdl_ttf = '-DHAVE_SDL_TTF' if -e "$_/SDL_ttf.h";
	$png = '-DHAVE_PNG' if -e "$_/png.h";
	$jpeg = '-DHAVE_JPEG' if -e "$_/jpeglib.h";
	$gl = '-DHAVE_GL' if -e "$_/GL/gl.h";
	$glu = '-DHAVE_GLU' if -e "$_/GL/glu.h";	
	$smpeg = '-DHAVE_SMPEG' if -e "$_/smpeg.h";
	$gfx = '-DHAVE_SDL_GFX' if -e "$_/SDL_gfxPrimitives.h";
	$sound = '-DHAVE_SDL_SOUND' if -e "$_/SDL_sound.h";
}

sub found_mod {
        printf "%-24s%s\n","Found $_[0]",( $_[1] ? "yes" : "no" );
}

found_mod ("SDL_image",$sdl_image );
found_mod ("SDL_mixer",$sdl_mixer );
found_mod ("SDL_net",$sdl_net);
found_mod ("SDL_ttf",$sdl_ttf);
found_mod ("libpng",$png);
found_mod ("jpeg",$jpeg);
found_mod ("OpenGL",$gl);
found_mod ("GLUT",$glu);
found_mod ("SMPEG",$smpeg);
found_mod ("SDL_gfx",$gfx);
found_mod ("SDL_sound",$sound);

#
# Test For thread support
#

if ( $Config{usethreads} ) {
	push @defs, "-DUSE_THREADS";
}



#
# Specify Makefile options
#

my %options = (
    'NAME'	=> 'SDL_perl',
    'VERSION_FROM' => 'lib/SDL.pm', 
    'LIBS'	=> [ join( " ",	"$sdl_libs", 
			($sdl_image) ? '-lSDL_image' : "", 
			($png) ? '-lpng' : "",
			($jpeg) ? '-ljpeg' : "", 
			($sdl_mixer) ? '-lSDL_mixer' : "", 
			($sdl_net) ? '-lSDL_net' : "",
			($sdl_ttf) ? '-lSDL_ttf' : "",
			($gl) ? $glLib : "", 
			($glu) ? $gluLib : "", 
			($smpeg) ? '-lsmpeg' : "",
			($gfx) ? '-lsdl_gfx' : "",
			($sound) ? '-lsdl_sound' : "",
			)
			],  
    'DEFINE'	=> "$sdl_image $png $jpeg $sdl_mixer $sdl_net $sdl_ttf $gl $glu $smpeg $gfx $sound", 
    'INC'	=> "$inc_flags $sdl_cflags",
    'OBJECT'	=> ($sdl_image ? 'SFont.o' : "" ) . " SDL_perl.o " . ($gl ? 'OpenGL.o' : "" ),
);
    
#
# Write Makefile 
#

WriteMakefile(%options );