Acme-MITHALDU-BleedingOpenGL

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use strict;
use warnings;
use ExtUtils::MakeMaker;
use ExtUtils::Liblist;
use Data::Dumper;
use Config;
use Try::Tiny;

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

# Supported windowing interfaces
our $is_valid_interface =
{
  'AGL'       => 'Default GLUT framework on Mac OS X',
  'FREEGLUT'  => 'FreeGLUT, preferred over GLUT',
  'GLUT'      => 'GLUT; often really FreeGLUT on Linux',
  'GLX'       => 'Default GLX+X11 on Linux; use XQuartz on Mac OS X',
  'W32API'    => 'Uses WGL+FreeGLUT on CYGWIN, instead of GLX+FreeGLUT',
  'WGL'       => 'Same as W32API',
};


# Makefile.PL Usage
sub Usage
{
  print "\n@_\n\n";

  print qq
  {
    USAGE: perl Makefile.PL [OPTIONS]


    OPTIONS include:

    help                This help message

    verbose             Display additional status info, can be
                        repeated for more verbosity

    dist=NO_EXCLUSIONS  Build with no OpenGL Extension exclusions

    interface=XFACE     Build for a specific windowing interface
                        Currently supports:
  };

  print "\n";
  foreach my $xface (sort keys %$is_valid_interface)
  {
    print substr("      $xface                  ",0,24).
      "$is_valid_interface->{$xface}\n";
  }
  print "\n";
  exit(0);
}
if (@ARGV and $ARGV[0] =~ m|^([-/]*)?h(elp)?|i)
{
  Usage();
}
else
{
  print "\nrun as `perl Makefile.PL help` to show user options\n";
}

our $verbose = 0;

Makefile.PL  view on Meta::CPAN

  return $defines;
}

# Takes as input a INCS string ready for MakeMaker and cleans out
# non-existant directories produce a minimal configuration value
sub clean_incs {
   my $inincs = $_[0];
   return unless defined $inincs;
   print "clean_incs: got input INCS='$inincs'\n" if $verbose>1;

   my @inincs = split / /, $inincs;

   # clean out -I args with non-existent directories
   print "clean_incs: removing bad directories\n" if $verbose>1;
   my @outincs = grep { my $tmp = $_; $tmp =~ s/^-I// and ( -d $tmp or -l $tmp) } @inincs;
   my $outincs = join ' ', @outincs;

   print "clean_incs: returning INCS='$outincs'\n" if $verbose>1;
   $_[0] = $outincs;
}

# Takes as input a LIBS string ready for MakeMaker and cleans out
# non-existant directories and libraries to produce a better,
# minimal configuration value
sub clean_libs {
   my $inlibs = $_[0];
   return unless defined $inlibs;
   print "clean_libs: got input LIBS='$inlibs'\n" if $verbose>1;

   my @inlibs = split ' ', $inlibs;

   # clean out -L args with non-existent directories
   print "clean_libs: removing bad directories\n" if $verbose>1;
   my @outlibs = grep { my $tmp = $_; /^-l/ or $tmp =~ s/^-L// and ( -d $tmp or -l $tmp) } @inlibs;


   my $outlibs = join ' ', @outlibs;

   print "clean_libs: returning LIBS='$outlibs'\n" if $verbose>1;
   $_[0] = $outlibs;
}

# Dump Config.pm
sub WriteConfigPM
{
  my($config) = @_;

  die "Unable to write to Config.pm\n" if (!open(CONFIGPM, ">Config.pm"));

  print CONFIGPM q
{
# This is the Perl OpenGL build configuration file.
# It contains the final OpenGL build arguements from
# the configuration process.  Access the values by
# use OpenGL::Config which defines the variable
# $OpenGL::Config containing the hash arguments from
# the WriteMakefile() call.
#
};

  print CONFIGPM Data::Dumper->Dump( [$config], [qw(Acme::MITHALDU::BleedingOpenGL::Config)] );

  print CONFIGPM qq
{
1;
__END__
};

  close(CONFIGPM);
};



( run in 0.251 second using v1.01-cache-2.11-cpan-eab888a1d7d )