Acme-MITHALDU-BleedingOpenGL

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

  delete($found_libs->{'GLUT32'});
  delete($found_libs->{'GLU32'});
  delete($found_libs->{'OPENGL32'});
}

if (0) { # May be not necessary now, see if removing makes a difference
   if (!$found_libs->{'GL'})
   {
      if ($found_libs->{'GLX'})
      {
         $found_libs->{'GL'} = $found_libs->{'GLX'};
      }
      elsif ($found_libs->{'MESA'})
      {
         $found_libs->{'GL'} = $found_libs->{'MESA'};
      }
   }
}

print "resulting libs:\n" if ($verbose);
foreach my $key (sort keys %$found_libs)
{
  next if (!$found_libs->{$key});
  $DEFS .= " -DHAVE_$key";
  print "    $key = '$found_libs->{$key}'\n" if ($verbose);
}

# Configure MakeMaker
my($LIBS,$OPTS,$CLEAN,$LDFROM);
my $EXES = [];
my $DYNS = {};
if ($IS_W32API || (($^O eq 'MSWin32') && !$IS_CYGWIN))		# Win32
{
  my $glut_lib = '-lopengl32 -lglu32 ';
  if ($interface_lib eq 'GLUT')
  {
    $glut_lib .= '-lglut32';
  }
  elsif ($interface_lib eq 'FREEGLUT' and $IS_STRAWBERRY)
  {
    $glut_lib .= '-lglut';
  }
  else
  {
    $glut_lib .= '-LFreeGLUT -lfreeglut';
  }

  if ($IS_MINGW)	# MINGW
  {
    $LDFROM = $glut_lib;
  }
  elsif ($IS_W32API)	# CYGWIN W32API
  {
     my $glut = ($found_libs->{FREEGLUT32}) ? $found_libs->{FREEGLUT32} : $found_libs->{GLUT32};

    $LIBS = "-L/usr/lib/w32api $glut_lib";
    $LDFROM = $glut_lib;
    ### $INCS = '-I/usr/include/w32api';
    $INCS = '-I/usr/include/opengl';
    $DEFS .= " -DHAVE_W32API";
    $DYNS = { OTHERLDFLAGS => '-Wl,--exclude-symbols,'."\x7F".$glut.'_NULL_THUNK_DATA' };
  }
  else			# Windows VC6
  {
    $LIBS = $glut_lib;
    $OPTS = "/ogity /GDs";
  }

  # Using a dll as EXES is incorrect for EU::MM, since the EXES here mean
  # perl scripts and not windows binaries or DLLs.  This puts the DLL in
  # blib/bin from whence it should be installed correctly.  It is not
  # clear that this step is even needed since the freeglut.dll is installed
  # by this Makefile.PL if no FreeGLUT is found.
  #
  ## $EXES = ['FreeGLUT/freeglut.dll'];
  {
     system $^X , qw[-MExtUtils::Command -e mkpath --], qw[blib/arch/auto/Acme/MITHALDU/BleedingOpenGL];
     system $^X , qw[-MExtUtils::Command -e cp --], qw[FreeGLUT/freeglut.dll blib/arch/auto/Acme/MITHALDU/BleedingOpenGL/freeglut.dll];
     my @other_installs = grep { -e "$_\\freeglut.dll" } split /;/, $ENV{PATH};
     if(@other_installs) {
      print "\n" ;
      print "XXX Other freeglut.dll installed in $_\n" for @other_installs;
      print "Please verify whether the other found dll(s) are from older OpenGL.pm installs, and delete them if so!\n\n\n";
      sleep 2;
     }
  }

}
elsif ($interface_lib eq 'AGL')					# Mac OS X
{
  $INCS = ""; # no include flags required: Apple gcc will automatically pick up the system frameworks
  $DEFS .= " -DHAVE_AGL_GLUT -Wno-deprecated-declarations ";  # So we know we have glutWMCloseFunc() and glutCheckLoop()
  $DYNS = { OTHERLDFLAGS => "-framework OpenGL -framework GLUT" };
}
else # Everyone else
{
  my @includes = qw
  {
    -I/usr/include
    -I/usr/include
    -I/usr/X11R6/include
    -I/opt/X11/include
    -I/usr/local/include
    -I/usr/openwin/include
    -I/opt/csw/include
    -I/usr/local/freeglut/include
  };
  $INCS = "@includes";


  # Test for obfuscated GLX
  # quite often GLX is in -lGL...  Test for GL/glx.h instead...
  my $out = cfile_text('GL/glx.h');

  # The cpp would not let this macro through. Check for something else
  # that still exists after the cpp pass. a typedef, or type would work
  my $has_glx = ($out =~ m|GLXContext|);

  if ($has_glx)
  {
    #delete($found_libs->{GLX});

Makefile.PL  view on Meta::CPAN

  my($lib,$def);
  if ($found->{FREEGLUT32} || $found->{FREEGLUT})
  {
    $lib = $found->{FREEGLUT32} || $found->{FREEGLUT};
    $def = "HAVE_FREEGLUT";
  }
  elsif ($found->{GLUT32} || $found->{GLUT})
  {
    $lib = $found->{GLUT32} || $found->{GLUT};
    $def = "HAVE_GLUT";
  }
  elsif ($verbose)
  {
    print "GLUT not found\n";
  }

  # Platform-specific makefiles for glversion
  my $make_ver;
  if ($IS_STRAWBERRY)
  {
    $make_ver = "&strawberry.bat";
    print "strawberry glversion: '$make_ver'\n" if $verbose>1;
  }
  elsif ($IS_MINGW)
  {
    $make_ver = "&mingw.bat";
    print "mingw glversion: '$make_ver'\n" if $verbose>1;
  }
  elsif ($IS_W32API)
  {
    $make_ver = ";make -f Makefile.cygwin " .  (length($lib) ? "GLUT_LIB=$lib " : "") . (length($def) ? "GLUT_DEF=$def " : "");
    print "cygwin glversion: '$make_ver'\n" if $verbose>1;
  }
  elsif ($^O eq 'MSWin32')
  {
    $make_ver = '&nmake -f makefile.mak ' . (length($def) ? "GLUT_DEF=$def " : "");
    print "MSWin32 glversion: '$make_ver'\n" if $verbose>1;
  }
  elsif ($^O eq 'darwin')
  {
    $make_ver = ";make -f Makefile.macosx " .  (length($lib) ? "GLUT_LIB=$lib " : "") . (length($def) ? "GLUT_DEF=$def " : "");
    print "MacOSX glversion: '$make_ver'\n" if $verbose>1;
  }
  else
  {
    if ($ENV{TERM} ne 'xterm')
    {
      print "\nIn order to test your GPU's capabilities, run this make under an X11 shell\n\n";
    }

    $make_ver = ";make -f Makefile " .  (length($lib) ? "GLUT_LIB=$lib " : "") . (length($def) ? "GLUT_DEF=$def " : "");
    print "glversion: '$make_ver'\n" if $verbose>1;
  }
  my $exec = 'cd utils'."$make_ver clean".$make_ver;
  print "glversion: $exec\n" if ($verbose);
  my $stat = `$exec`;
  print "\n$stat\n\n" if ($verbose);
  unlink "utils/freeglut.dll" or die "could not remove temporary freeglut: $!" if -f "utils/freeglut.dll";

  # Parse glversion.txt file
  open GLDATA, $glv_file or die "get_extensions: could not open $glv_file: $!\n";
  my $gldata = {};
  my @gldata = <GLDATA>;
  close(GLDATA);

  foreach my $line (@gldata)
  {
    $line =~ s|[\r\n]+||;
    my($key,$val) = split('=',$line);
    $gldata->{$key} = $val;
  }
  die "get_extensions: no extensions found in $glv_file\n" if !keys %$gldata;

  print "This looks like OpenGL Version: $gldata->{VERSION}\n";

  # Parse glext_procs.h file
  open GLEXT, "glext_procs.h" or die "get_extensions: could not open glext_procs.h: $!\n";
  my @lines = <GLEXT>;
  close(GLEXT);

  my $no_ext = {};
  foreach my $line (@lines)
  {
    next if ($line !~ m|\#ifndef NO_([^\s]+)|);
    my $ext = $1;
    next if ($ext =~ m|^GL_VERSION_|);
    $no_ext->{$ext}++;
  }


  # Create gl_exclude.h
  die "Unable to write to $exc_file\n" if (!open(GLEXC,">$exc_file"));
  print GLEXC "// OpenGL Extension Exclusions - may be modified before building.\n";
  print GLEXC "//\n";
  print GLEXC "// Generated for ".$gldata->{VENDOR}.", ".$gldata->{RENDERER}."\n";
  print GLEXC "// OpenGL v".$gldata->{VERSION}.", using ";

  # Fix GLUT flags based on results
  if ($gldata->{FREEGLUT})
  {
    print 'Found FreeGLUT v'.$gldata->{FREEGLUT}."\n";
    print GLEXC 'FreeGLUT v'.$gldata->{FREEGLUT}."\n";

    if (!$found->{FREEGLUT} && !$found->{FREEGLUT32})
    {
      $found->{FREEGLUT} = $lib;
    }
  }
  elsif ($gldata->{GLUT})
  {
    print "Found GLUT - Version: $gldata->{GLUT}\n";
  }
  else
  {
    print "Found no GLUT\n"
  }

  my $GL_VERSION;
  my($GL_VERSION_MAJOR, $GL_VERSION_MINOR);
  if ($gldata->{VERSION} =~ m|^(\d\.\d+)|)
  {
    $GL_VERSION = $1;
    ($GL_VERSION_MAJOR,$GL_VERSION_MINOR) = split('.', $GL_VERSION);
  }



( run in 0.373 second using v1.01-cache-2.11-cpan-140bd7fdf52 )