# New Ticket Created by  Geoffrey Broadwell 
# Please include the string:  [perl #55978]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55978 >


The attached patch is courtesy of donaldh++.  It has been tested on
cygwin and Debian/i686.  Please someone test on Mac OS X, so that I can
commit it.


-'f

Index: src/dynext.c
===================================================================
--- src/dynext.c	(revision 28459)
+++ src/dynext.c	(working copy)
@@ -276,12 +276,10 @@
     /* And on cygwin replace a leading "lib" by "cyg". */
 #ifdef __CYGWIN__
     if (!STRING_IS_EMPTY(lib) && memcmp(lib->strstart, "lib", 3) == 0) {
-        strcpy(path->strstart, lib->strstart);
+        path = string_append(interp, 
+            string_from_cstring(interp, "cyg", 3),
+            string_substr(interp, lib, 3, lib->strlen - 3, NULL, 0));
 
-        path->strstart[0] = 'c';
-        path->strstart[1] = 'y';
-        path->strstart[2] = 'g';
-
         *handle           = Parrot_dlopen(path->strstart);
 
         if (*handle)
Index: lib/Parrot/Configure/Step/Methods.pm
===================================================================
--- lib/Parrot/Configure/Step/Methods.pm	(revision 28459)
+++ lib/Parrot/Configure/Step/Methods.pm	(working copy)
@@ -198,7 +198,8 @@
     my $args = shift;
     croak "_add_to_libs() takes hashref: $!" unless ref($args) eq 'HASH';
     my $platform =
-          ($args->{osname} =~ /mswin32/i &&
+          (($args->{osname} =~ /mswin32/i ||
+	    $args->{osname} =~ /cygwin/i) &&
            $args->{cc} =~ /^gcc/i)          ? 'win32_gcc'
         :  $args->{osname} =~ /mswin32/i    ? 'win32_nongcc'
         :  $args->{osname} =~ /darwin/i     ? 'darwin'
Index: config/gen/opengl.pm
===================================================================
--- config/gen/opengl.pm	(revision 28459)
+++ config/gen/opengl.pm	(working copy)
@@ -410,6 +410,9 @@
         '/System/Library/Frameworks/OpenGL.framework/Headers/*.h',
         '/System/Library/Frameworks/GLUT.framework/Headers/*.h',
 
+        # Cygwin
+        '/usr/include/w32api/GL/*.h',
+
         # Windows/MSVC
         (map "$_/gl/*.h" => @include_paths_win32),
 
@@ -444,11 +447,19 @@
 #         "$ENV{HOME}/src/osx-insane/usr/X11R6 1/include/GL/*.h",
     );
 
+    print "\nChecking for OpenGL headers using the following globs:\n\t",
+        join("\n\t", @header_globs), "\n"
+        if $verbose;
+
     my @header_files = sort map {File::Glob::bsd_glob($_)} @header_globs;
 
     my %skip = map {($_ => 1)} @SKIP;
     @header_files = grep {my ($file) = m{([^/]+)$}; !$skip{$file}} @header_files;
 
+    print "\nFound the following OpenGL headers:\n\t",
+        join("\n\t", @header_files), "\n"
+        if $verbose;
+
     die "OpenGL enabled and detected, but no OpenGL headers found!"
         unless @header_files;
 

Reply via email to