Alien-SDL2

 view release on metacpan or  search on metacpan

inc/My/Utility.pm  view on Meta::CPAN

          'http://zlib.net/zlib-1.2.8.tar.gz'
        ],
        sha1sum  => 'a4d316c404ff54ca545ea71a27af7dbc29817088',
        patches => [],
        prereq_libs => [],
      },
      {
        pack => 'jpeg',
        version => '9',
        dirname => 'jpeg-9',
        url => [
          'http://www.ijg.org/files/jpegsrc.v9.tar.gz'
        ],
        sha1sum  => '724987e7690ca3d74d6ab7c1f1b6854e88ca204b',
        patches => [],
        prereq_libs => [],
      },
      {
        pack => 'tiff',
        version => '4.0.3',
        dirname => 'tiff-4.0.3',
        url => [
          'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz',
        ],
        sha1sum  => '652e97b78f1444237a82cbcfe014310e776eb6f0',
        patches => ['libtiff.4.0.3.tiffio.h.patch'],
        prereq_libs => [],
      },
      {
        pack => 'png',
        version => '1.6.3',
        dirname => 'libpng-1.6.3',
        url => [
          'http://downloads.sourceforge.net/libpng/libpng-1.6.3.tar.gz',
        ],
        sha1sum  => 'b8b7b911909c09d71324536aaa7750104d170c77',
        patches => ['libpng-1.6.3-hack.patch'],
        prereq_libs => ['z'],
      },
      {
        pack => 'freetype',
        version => '2.5.0.1',
        dirname => 'freetype-2.5.0.1',
        url => [
          'http://www.mirrorservice.org/sites/download.savannah.gnu.org/releases/freetype/freetype-2.5.0.1.tar.gz',
        ],
        sha1sum  => '2d539b375688466a8e7dcc4260ab21003faab08c',
        patches => [],
        prereq_libs => ['SDL2', 'freetype'],
      },
      {
        pack => 'SDL2',
        version => '2.0.0',
        dirname => 'SDL2-2.0.0',
        url => [
          'http://www.libsdl.org/release/SDL2-2.0.0.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/SDL2-2.0.0.tar.gz',
        ],
        sha1sum  => 'a907eb5203abad6649c1eae0120d96c0a1931350',
        patches => [],
        prereq_libs => ['pthread'],
      },
      {
        pack => 'SDL2_image',
        version => '2.0.0',
        dirname => 'SDL2_image-2.0.0',
        url => [
          'http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/SDL2_image-2.0.0.tar.gz',
        ],
        sha1sum  => '20b1b0db9dd540d6d5e40c7da8a39c6a81248865',
        patches => [],
        prereq_libs => ['SDL2', 'jpeg', 'tiff', 'png'],
      },
      {
        pack => 'ogg',
        version => '1.3.1',
        dirname => 'libogg-1.3.1',
        url => [
          'http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/libogg-1.3.1.tar.gz',
        ],
        sha1sum  => '270685c2a3d9dc6c98372627af99868aa4b4db53',
        patches => [],
        prereq_libs => [],
      },
      {
        pack => 'vorbis',
        version => '1.3.3',
        dirname => 'libvorbis-1.3.3',
        url => [
          'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/libvorbis-1.3.3.tar.gz',
          'http://froggs.de/libsdl/libvorbis-1.3.3.tar.gz',
        ],
        sha1sum  => '8dae60349292ed76db0e490dc5ee51088a84518b',
        patches => [
          'libvorbis-1.3.3-configure.patch',
        ],
        prereq_libs => [],
      },
      {
        pack => 'SDL2_mixer',
        version => '2.0.0',
        dirname => 'SDL2_mixer-2.0.0',
        url => [
          'http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.0.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/SDL2_mixer-2.0.0.tar.gz',
        ],
        sha1sum  => '9ed975587f09a1776ba9776dcc74a58e695aba6e',
        patches => [],
        prereq_libs => ['SDL2', 'ogg', 'vorbis', 'smpeg'],
      },
      {
        pack => 'SDL2_ttf',
        version => '2.0.12',
        dirname => 'SDL2_ttf-2.0.12',
        url => [
          'http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.12.tar.gz',
          'http://strawberryperl.com/package/kmx/sdl/src/SDL2_ttf-2.0.12.tar.gz',
        ],

inc/My/Utility.pm  view on Meta::CPAN

  print "checking for prebuilt binaries... ";
  my @good = ();
  foreach my $b (@{$prebuilt_binaries}) {
    if ($b->{match} && &{$b->{match}}) {
      $b->{buildtype} = 'use_prebuilt_binaries';
      delete $b->{match}; #avoid later warnings
      push @good, $b;
    }
  }
  scalar(@good)
    ? print "yes, " . scalar(@good) . " option(s)\n"
    : print "no\n";
  #returning ARRAY of HASHREFs (sometimes more than one value)
  return \@good;
}

sub check_prereqs_libs {
  my @libs = @_;
  my $ret  = 1;

  foreach my $lib (@libs) {
    print "checking for $lib... ";
    my $found_dll          = '';
    my $found_lib          = '';
    my $found_inc          = '';
    my $header_map         = {
      'z'       => 'zlib',
      'jpeg'    => 'jpeglib',
      'vorbis'  => 'vorbisenc',
      'SDL2_gfx' => 'SDL2_gfxPrimitives',
      'SDL2'     => 'SDL_version',
    };
    my $header             = (defined $header_map->{$lib}) ? $header_map->{$lib} : $lib;
    my $dlext = get_dlext();
    foreach (keys %$inc_lib_candidates) {
      my $inc = $_;
      my $ld = $inc_lib_candidates->{$inc};
      next unless -d $_ && (-d $ld || ref $ld eq 'ARRAY');
	if( ref $ld eq 'ARRAY' ) {
		   my $ld_size = scalar( @{ $ld } );
		   foreach ( 0..$ld_size ) {
			next unless (defined $ld->[$_] && -d $ld->[$_]);
			  ($found_dll, $found_lib, $found_inc) = find_dll_lib_inc($inc, $ld->[$_], $lib, $dlext, $header );
			last if $found_lib;
		}
	}
	else {
	  ($found_dll, $found_lib, $found_inc) = find_dll_lib_inc($inc, $ld, $lib, $dlext, $header,);
	}
      last if $found_lib && $found_inc;
    }

    if($found_lib && $found_inc) {
      print "yes\n";
      $ret &= 1;
    }
    else {
      print "no\n";
      $ret = 0;
    }
  warn "###ERROR### Can't find $lib, will not compile libSDL2" if ($lib =~ 'pthread' && $ret == 0);

    if( scalar(@libs) == 1 ) {
      return $ret
        ? [(get_header_version($found_inc) || 'found'), $found_dll]
        : [0, undef];
    }
  }

  return $ret;
}

sub check_prereqs {
  my $bp  = shift;
  my $ret = 1;
  $ret   &= check_prereqs_libs(@{$bp->{prereq_libs}}) if defined $bp->{prereq_libs};

  return $ret;
}

sub check_prereqs_tools {
  my @tools = @_;
  my $ret   = 1;

  foreach my $tool (@tools) {

    if((File::Which::which($tool) && -x File::Which::which($tool))
    || ('pkg-config' eq $tool && defined $ENV{PKG_CONFIG} && $ENV{PKG_CONFIG}
                              && File::Which::which($ENV{PKG_CONFIG})
                              && -x File::Which::which($ENV{PKG_CONFIG}))) {
      $ret &= 1;
    }
    else {
      $ret = 0;
    }
  }

  return $ret;
}

sub find_file {
  my ($dir, $re) = @_;
  my @files;
  $re ||= qr/.*/;
  {
    #hide warning "Can't opendir(...): Permission denied - fix for http://rt.cpan.org/Public/Bug/Display.html?id=57232
    no warnings;
    find({ wanted => sub { push @files, rel2abs($_) if /$re/ }, follow => 1, no_chdir => 1 , follow_skip => 2}, $dir);
  };
  return @files;
}

sub find_SDL2_dir {
  my $root = shift;
  my ($version, $prefix, $incdir, $libdir);
  return unless $root;

  # try to find SDL_version.h
  my ($found) = find_file($root, qr/SDL_version\.h$/i ); # take just the first one
  return unless $found;



( run in 0.995 second using v1.01-cache-2.11-cpan-cd2fffc590a )