how-to compile SDL_Perl-2.1.0 on win32
(much thanks to randy simms of the Module-Build general mailing list)
First extract the package and change to right directory
G:\SDL> tar -zxvf SDL_Perl-2.1.0.tar.gz && cd SDL_Perl-2.1.0
apply my patch somehow (it's attached as SDL_Perl-2.1.0.patch)
set the environment appropriately
REM set to point where SDL.h is
set INCLUDE=G:\SDL\SDL-1.2.5\include;%INCLUDE%
REM set to point where SDL.dll is
set PATH=G:\SDL\SDL-1.2.5\VisualC\SDL\Release;%PATH%
REM set to point where SDL.lib is
set LIB=G:\SDL\SDL-1.2.5\VisualC\SDL\Release;%LIB%
Then run
G:\SDL\SDL_Perl-2.1.0>perl Build.PL
G:\SDL\SDL_Perl-2.1.0>perl Build
... you'll see a bunch of errors here ...
now edit src\SDL_perl.lds,
and add "SDL.lib" on a line by itself after msvcrt.lib
then execute
link @"src\SDL_perl.lds" -out:"blib\arch\auto\SDL_perl\SDL_perl.dll"
then run
perl Build test
at which point you should see something like
G:\SDL\SDL_Perl-2.1.0>perl Build test
rib SDL::SFont
rib SDL_perl
rib SDL::OpenGL
t\apppm............ok
t\cdrompm..........ok
t\colorpm..........ok
t\cursorpm.........ok
t\eventpm..........ok
t\fontpm...........ok
t\mixerpm..........ok 2/3Use of inherited AUTOLOAD for non-method SDL::MixOpenAudio()
is
deprecated at blib/lib/SDL/Mixe
r.pm line 28.
Can't locate auto/SDL/MixOpenAudi.al in @INC (@INC contains: blib/lib blib/arch
G:\SDL\SDL_Perl-2.1.0\blib\lib G:\SDL\SD
L_Perl-2.1.0\blib\arch G:\SDL\SDL_Perl-2.1.0\make\lib C:\Perl\lib C:\Perl\site\lib
G:\SDL\SDL_Perl-2.1.0 C:/Perl/lib C:/
Perl/site/lib .) at blib/lib/SDL/Mixer.pm line 28
# Looks like you planned 3 tests but only ran 2.
# Looks like your test died just after 2.
t\mixerpm..........dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED test 3
Failed 1/3 tests, 66.67% okay
t\mpegpm...........ok
t\musicpm..........ok
t\opengl...........NOK 2# Failed test (t\opengl.t at line 25)
# main->can('glBegin') failed
# main->can('glClear') failed
# main->can('glClearColor') failed
# main->can('glColor') failed
# main->can('glCullFace') failed
# main->can('glEnable') failed
# main->can('glEnd') failed
# main->can('glEvalCoord1') failed
# main->can('glEvalCoord2') failed
# main->can('glEvalMesh2') failed
# main->can('glFrontFace') failed
# main->can('glFrustum') failed
# main->can('glLight') failed
# main->can('glLoadIdentity') failed
# main->can('glMap1') failed
# main->can('glMap2') failed
# main->can('glMapGrid2') failed
# main->can('glMaterial') failed
# main->can('glMatrixMode') failed
# main->can('glPointSize') failed
# main->can('glPopMatrix') failed
# main->can('glPushMatrix') failed
# main->can('glRotate') failed
# main->can('glScale') failed
# main->can('glShadeModel') failed
# main->can('glTranslate') failed
# main->can('glVertex') failed
# main->can('glVertex') failed
# main->can('glViewport') failed
t\opengl...........NOK 3# Failed test (t\opengl.t at line 56)
# main->can('gluPerspective') failed
# main->can('gluBeginSurface') failed
# main->can('gluBeginTrim') failed
# main->can('gluEndSurface') failed
# main->can('gluEndTrim') failed
# main->can('gluNewNurbsRenderer') failed
# main->can('gluNurbsCurve') failed
# main->can('gluNurbsProperty') failed
# main->can('gluNurbsSurface') failed
# main->can('gluPwlCurve') failed
# Looks like you failed 2 tests of 3.
t\opengl...........dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 2-3
Failed 2/3 tests, 33.33% okay
t\palettepm........ok
t\rectpm...........ok
t\sdlpm............ok
t\soundpm..........ok
t\surfacepm........ok
t\timerpm..........NOK 4# Failed test (t\timerpm.t at line 36)
# got: '0'
# expected: '1'
# Looks like you failed 1 tests of 4.
t\timerpm..........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 4
Failed 1/4 tests, 75.00% okay
t\toolfontpm.......Use of inherited AUTOLOAD for non-method SDL::TTFInit() is
deprecated at
blib/lib/SDL/TTFont.pm line
153.
t\toolfontpm.......NOK 1# Failed test (t\toolfontpm.t at line 30)
# Tried to use 'SDL::Tool::Font'.
# Error: Can't locate auto/SDL/TTFInit.al in @INC (@INC contains: blib/lib
blib/arch
G:\SDL\SDL_Perl-2.1.0\blib\lib
G:\SDL\SDL_Perl-2.1.0\blib\arch G:\SDL\SDL_Perl-2.1.0\make\lib C:\Perl\lib
C:\Perl\site\lib
G:\SDL\SDL_Perl-2.1.0 C:/Pe
rl/lib C:/Perl/site/lib .) at blib/lib/SDL/TTFont.pm line 153
# Compilation failed in require at blib/lib/SDL/Tool/Font.pm line 10.
# BEGIN failed--compilation aborted at blib/lib/SDL/Tool/Font.pm line 10.
# Compilation failed in require at (eval 1) line 2.
t\toolfontpm.......NOK 2# Failed test (t\toolfontpm.t at line 32)
# SDL::Tool::Font->can('new') failed
# SDL::Tool::Font->can('print') failed
# Looks like you failed 2 tests of 2.
t\toolfontpm.......dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-2
Failed 2/2 tests, 0.00% okay
t\toolgraphicpm....ok
t\ttfontpm.........Use of inherited AUTOLOAD for non-method SDL::TTFInit() is
deprecated at
blib/lib/SDL/TTFont.pm line
153.
t\ttfontpm.........NOK 1# Failed test (t\ttfontpm.t at line 23)
# Tried to use 'SDL::TTFont'.
# Error: Can't locate auto/SDL/TTFInit.al in @INC (@INC contains: blib/lib
blib/arch
G:\SDL\SDL_Perl-2.1.0\blib\lib
G:\SDL\SDL_Perl-2.1.0\blib\arch G:\SDL\SDL_Perl-2.1.0\make\lib C:\Perl\lib
C:\Perl\site\lib
G:\SDL\SDL_Perl-2.1.0 C:/Pe
rl/lib C:/Perl/site/lib .) at blib/lib/SDL/TTFont.pm line 153
# Compilation failed in require at (eval 1) line 2.
t\ttfontpm.........ok 2/2# Looks like you failed 1 tests of 2.
t\ttfontpm.........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 1
Failed 1/2 tests, 50.00% okay
t\videopm..........ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t\mixerpm.t 255 65280 3 2 66.67% 3
t\opengl.t 2 512 3 2 66.67% 2-3
t\timerpm.t 1 256 4 1 25.00% 4
t\toolfontpm.t 2 512 2 2 100.00% 1-2
t\ttfontpm.t 1 256 2 1 50.00% 1
Failed 5/20 test scripts, 75.00% okay. 7/75 subtests failed, 90.67% okay.
G:\SDL\SDL_Perl-2.1.0>
__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/toolsdiff -ubr G:\SDL\orig\SDL_Perl-2.1.0/Build.PL G:\SDL\SDL_Perl-2.1.0/Build.PL
--- G:\SDL\orig\SDL_Perl-2.1.0/Build.PL 2004-02-23 17:55:44.000000000 -0800
+++ G:\SDL\SDL_Perl-2.1.0/Build.PL 2004-02-25 00:51:24.687500000 -0800
@@ -13,7 +13,7 @@
my $sdl_compile_flags = `sdl-config --cflags`;
my $sdl_link_flags = `sdl-config --libs`;
-if ($? >> 8)
+if ($^O !~ /win32/i and $? >> 8)
{
die "SDL doesn't appear to be installed.\n" .
"Please check that sdl-config is in your path and try again.\n";
Only in G:\SDL\SDL_Perl-2.1.0/lib/SDL: Config.pm
Only in G:\SDL\SDL_Perl-2.1.0/make/lib/SDL/Build: MSWin32.pm
diff -ubr G:\SDL\orig\SDL_Perl-2.1.0/make/lib/SDL/Build.pm
G:\SDL\SDL_Perl-2.1.0/make/lib/SDL/Build.pm
--- G:\SDL\orig\SDL_Perl-2.1.0/make/lib/SDL/Build.pm 2004-02-23 17:55:44.000000000
-0800
+++ G:\SDL\SDL_Perl-2.1.0/make/lib/SDL/Build.pm 2004-02-25 01:51:53.046875000 -0800
@@ -12,6 +12,39 @@
use Data::Dumper;
use Config;
+
+sub link_c {
+# podmaster
+#use Data::Dumper;local $Data::Dumper::Indent=1;warn Dumper([EMAIL PROTECTED]);
+ my $self = shift;
+
+ my( $blib, $rib ) = @_;
+
+# TODO: the actual flags at the moment are not ok for link.exe (ok for cl.exe)
+# the transformation attemp (-libpath/-l) can't exactly work (order matters)
+if(0){
+ my $extra = "$rib.xs";
+ $extra =~ s{\\}{/}g;
+
+ local $self->{properties}{extra_linker_flags} =
+ [EMAIL
PROTECTED]>{phash}{notes}{disk}{file_flags}{$extra}{extra_linker_flags}}];
+ for( @{$self->{properties}{extra_linker_flags}} ){
+ s/^-L/-libpath:/ and next;
+ s/^-l([^B])/$1/;
+ }
+}
+
+# until ExtUtils::ParseXS is patched, to avoid warnings from cl.exe
+ $_[-1] =~ s{\\}{/}g;
+
+ $rib =~ s{^src[\\/]}{};
+ $rib =~ s{[\\/]}{::}g;
+ warn "$/ rib $rib $/";
+ local $self->{properties}{module_name} = $rib;
+
+ $self->SUPER::link_c(@_);
+}
+
# Module::Build doesn't seem to have a way to use separate flags for separate
# XS files, so here's the override that makes separate files build correctly:
sub process_xs
@@ -138,22 +171,22 @@
my $sub_file = $subsystems->{$subsystem}{file}{to};
my $sub_includes = join(' ', @{ $includes->{$subsystem} } );
- $file_flags{ $sub_file } =
- {
+$file_flags{ $sub_file } =
+{
extra_compiler_flags =>
[
- @{ $includes->{$subsystem} },
+ ( $includes->{$subsystem} ? @{ $includes->{$subsystem} } : () ),
$sdl_compile,
- @{ $defines->{$subsystem} },
- ( defined $Config{usethreads} ? ('-DUSE_THREADS',
'-fPIC') : '-fPIC' ),
+ ( $defines->{$subsystem} ? @{ $defines->{$subsystem} } : () ),
+ '-fPIC',
],
extra_linker_flags =>
[
- @{ $links->{$subsystem}{paths} },
+ ( $links->{$subsystem}{paths} ? @{ $links->{$subsystem}{paths} } : () ),
$sdl_link,
- @{ $links->{$subsystem}{libs} },
+ ( $links->{$subsystem}{libs} ? @{ $links->{$subsystem}{libs} } : () ),
],
- },
+},
}
$self->notes( 'file_flags' => \%file_flags );
Only in G:\SDL\SDL_Perl-2.1.0: setenv.bat