On Tue, 2004-03-23 at 00:22, Andy Bakun wrote:

> I'm not quite sure what needs to be done about this.
> 
> Build.PL properly detects that OpenGL headers are in
> /usr/X11R6/include/GL, so it generates a command line to compile with
> 
>   -I/usr/X11R6/include/GL
> 
> on it.  When including gl.h from OpenGL.xs, it finds it in
> /usr/X11R6/include/GL, of course.  Unfortunately, gl.h contains the
> line:
> 
>   #include <GL/glext.h>
> 
> which is relative to /usr/X11R6/include, but /usr/X11R6/include isn't
> specified as a include search path on the command line.  And thus the
> build dies when trying to parse gl.h.
> 
> I was able to work around this by editing _build/notes and adding
> 
>   '-I/usr/X11R6/include',
> 
> in the 'extra_compiler_flags' value of 'src/SDL/OpenGL.xs'.
> 
> I think the fix might be to have OpenGL.xs do
> 
>   #include <GL/gl.h>
> 
> and search for GL/gl.h instead of just gl.h when running Build.PL. I
> don't know much about OpenGL, but this seems to be what a lot of other
> programs do (include relative to the directory that contains the GL
> directory).  But I think this might break the header search algorithm,
> which appears to try to do things in a case-insentitive manner (looking
> for gl/gl.h and GL/gl.h), so this is most likely not the best thing to
> do.

Ahh, the latest snapshot (still lagging behind the release) does use
GL/gl.h in the XS files, but 2.1.0 does not.  I think you're right about
the relative include.

Here's a patch against the latest snapshot that makes the build process
slightly smarter.  Does it fix your problem?  The latest snapshot is
here:

        http://wgz.org/chromatic/perl/sdl/

Thanks for the report,
-- c


Index: build_lib/SDL/Build/Darwin.pm
===================================================================
--- build_lib/SDL/Build/Darwin.pm	(revision 165)
+++ build_lib/SDL/Build/Darwin.pm	(working copy)
@@ -5,16 +5,12 @@
 sub fetch_includes
 {
 	return 
-	'/usr/local/include/SDL'   => '/usr/local/lib',
-	'/usr/local/include'       => '/usr/local/lib',
-	'/usr/local/include/smpeg' => '/usr/local/lib',
-	'/usr/include/SDL'         => '/usr/lib',
 	'/usr/include'             => '/usr/lib',
 	'/usr/include/smpeg'       => '/usr/lib',
-	'/usr/local/include/GL'    => '/usr/local/lib',
-	'/usr/local/include/gl'    => '/usr/local/lib',
-	'/usr/include/GL'          => '/usr/lib', 
-	'/usr/include/gl'          => '/usr/lib', 
+	'/usr/include/SDL'         => '/usr/lib',
+	'/usr/local/include'       => '/usr/local/lib',
+	'/usr/local/include/SDL'   => '/usr/local/lib',
+	'/usr/local/include/smpeg' => '/usr/local/lib',
 
 	'/System/Library/Frameworks/SDL_mixer.framework/Headers'     => '../../lib',
 	'/System/Library/Frameworks/SDL_image.framework/Headers'     => '../../lib',
Index: build_lib/SDL/Build/Freebsd.pm
===================================================================
--- build_lib/SDL/Build/Freebsd.pm	(revision 165)
+++ build_lib/SDL/Build/Freebsd.pm	(working copy)
@@ -8,21 +8,16 @@
 	'/usr/local/include/SDL11' => '/usr/local/lib',
 
 	'/usr/local/include'       => '/usr/local/lib',
-	'/usr/local/include/gl'    => '/usr/local/lib',
-	'/usr/local/include/GL'    => '/usr/local/lib',
 	'/usr/local/include/SDL'   => '/usr/local/lib',
 	'/usr/local/include/smpeg' => '/usr/local/lib',
 
 	'/usr/include'              => '/usr/lib',
-	'/usr/include/gl'           => '/usr/lib',
-	'/usr/include/GL'           => '/usr/lib',
 	'/usr/include/SDL'          => '/usr/lib',
 	'/usr/include/smpeg'        => '/usr/lib',
 
 	'/usr/X11R6/include'        => '/usr/X11R6/lib',
-	'/usr/X11R6/include/gl'     => '/usr/X11R6/lib',
-	'/usr/X11R6/include/GL'     => '/usr/X11R6/lib',
-
+	'/usr/X11R6/include'        => '/usr/X11R6/lib',
+	'/usr/X11R6/include'        => '/usr/X11R6/lib',
 	);
 }
 
Index: build_lib/SDL/Build/Linux.pm
===================================================================
--- build_lib/SDL/Build/Linux.pm	(revision 165)
+++ build_lib/SDL/Build/Linux.pm	(working copy)
@@ -6,20 +6,14 @@
 {
 	return (
 	'/usr/local/include'       => '/usr/local/lib',
-	'/usr/local/include/gl'    => '/usr/local/lib',
-	'/usr/local/include/GL'    => '/usr/local/lib',
 	'/usr/local/include/SDL'   => '/usr/local/lib',
 	'/usr/local/include/smpeg' => '/usr/local/lib',
 
-	'/usr/include'              => '/usr/lib',
-	'/usr/include/gl'           => '/usr/lib',
-	'/usr/include/GL'           => '/usr/lib',
-	'/usr/include/SDL'          => '/usr/lib',
-	'/usr/include/smpeg'        => '/usr/lib',
+	'/usr/include'             => '/usr/lib',
+	'/usr/include/SDL'         => '/usr/lib',
+	'/usr/include/smpeg'       => '/usr/lib',
 
-	'/usr/X11R6/include'        => '/usr/X11R6/lib',
-	'/usr/X11R6/include/gl'     => '/usr/X11R6/lib',
-	'/usr/X11R6/include/GL'     => '/usr/X11R6/lib',
+	'/usr/X11R6/include'       => '/usr/X11R6/lib',
 	);
 }
 
Index: build_lib/SDL/Build/Netbsd.pm
===================================================================
--- build_lib/SDL/Build/Netbsd.pm	(revision 165)
+++ build_lib/SDL/Build/Netbsd.pm	(working copy)
@@ -10,20 +10,14 @@
 	'/usr/pkg/include/smpeg'   => '/usr/local/lib',
 
 	'/usr/local/include'       => '/usr/local/lib',
-	'/usr/local/include/gl'    => '/usr/local/lib',
-	'/usr/local/include/GL'    => '/usr/local/lib',
 	'/usr/local/include/SDL'   => '/usr/local/lib',
 	'/usr/local/include/smpeg' => '/usr/local/lib',
 
-	'/usr/include'              => '/usr/lib',
-	'/usr/include/gl'           => '/usr/lib',
-	'/usr/include/GL'           => '/usr/lib',
-	'/usr/include/SDL'          => '/usr/lib',
-	'/usr/include/smpeg'        => '/usr/lib',
+	'/usr/include'             => '/usr/lib',
+	'/usr/include/SDL'         => '/usr/lib',
+	'/usr/include/smpeg'       => '/usr/lib',
 
-	'/usr/X11R6/include'        => '/usr/X11R6/lib',
-	'/usr/X11R6/include/gl'     => '/usr/X11R6/lib',
-	'/usr/X11R6/include/GL'     => '/usr/X11R6/lib',
+	'/usr/X11R6/include'       => '/usr/X11R6/lib',
 	);
 }
 
Index: build_lib/SDL/Build.pm
===================================================================
--- build_lib/SDL/Build.pm	(revision 165)
+++ build_lib/SDL/Build.pm	(working copy)
@@ -3,7 +3,7 @@
 use strict;
 use base 'Module::Build';
 
-use File::Spec;
+use File::Spec::Functions;
 use Data::Dumper;
 
 # Module::Build doesn't seem to have a way to use separate flags for separate
@@ -25,8 +25,7 @@
 sub get_arch
 {
 	my ($self, $os)   = @_;
-	my $modpath       = File::Spec->catfile(
-		'SDL', 'Build', ucfirst( $os ) . '.pm' );
+	my $modpath       = catfile( 'SDL', 'Build', ucfirst( $os ) . '.pm' );
 	my $module        = 'SDL::Build::' . ucfirst( $os );
 
 	eval { require $modpath } or die "No module for $os platform\n";
@@ -116,11 +115,11 @@
 		},
 		GL          => {
 			define => 'HAVE_GL',  
-			header => 'gl.h'
+			header => catfile( 'GL', 'gl.h' ),
 		},
 		GLU         => {
 			define => 'HAVE_GLU', 
-			header => 'glu.h'
+			header => catfile( 'GL', 'glu.h' ),
 		},
 	};
 }
@@ -250,7 +249,7 @@
 
 	for my $inc_dir (keys %$includes)
 	{
-		next unless -e File::Spec->catfile( $inc_dir, $header );
+		next unless -e catfile( $inc_dir, $header );
 		return ($inc_dir, $includes->{$inc_dir});
 	}
 }
@@ -282,7 +281,7 @@
 sub write_sdl_config
 {
 	my ($self, $config) = @_;
-	my $path            = File::Spec->catfile(qw( lib SDL Config.pm ));
+	my $path            = catfile(qw( lib SDL Config.pm ));
 	my $dd              = Data::Dumper->new( [ $config ], [ 'sdl_config' ] );
 	my $hash            = $dd->Dump();
 	(my $text           = <<'	END_HEADER' . $hash . <<'	END_FOOTER');

Reply via email to