Alien-SDL

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

      print "directory '$ENV{SDL_INST_DIR}' does not exist";
    }
  }
  print "no\n";

  # sdl-config script
  push @candidates, $rv if $rv = check_config_script("sdl-config");

  if( $build->can_build_binaries_from_sources || scalar(@candidates) ) {
    for(qw(pthread SDL
           z jpeg tiff png SDL_image
           ogg vorbis vorbisfile SDL_mixer
           freetype SDL_ttf
           SDL_gfx
           pangoft2 pango gobject gmodule glib fontconfig expat SDL_Pango)) {
      $have_libs{$_} = check_prereqs_libs($_);
    }
  }

  $perl_libs{pthread} = check_perl_buildlibs('pthread') if $have_libs{pthread} && $^O eq 'openbsd';

Changes  view on Meta::CPAN

     - readding source build sets that got lost [FROGGS]
     - adding extra PATH for make command like we do for configure on solaris [FROGGS]
     - setting LD_LIBRARY_PATH for GNU/kFreeBSD too so libs like SDL_image will find libSDL [FROGGS]
     - new Win/64bit binaries (from strawberryperl 5.14+) + gccversion detection magic [KMX]
     - new Win/32bit binaries (the same lib versions as 64bit, set as "secondary" option) [KMX]

1.428 Wed Jul 20 2011
     - added Capture::Tiny to build_requires [FROGGS]
     - added search paths for command ar on solaris [FROGGS]
     - 'movq' bugfix: http://hg.libsdl.org/SDL/rev/32f0f603a0c8 [FROGGS]
     - added 'RELEASE' to get_header_version (e.g. png.h has it) [FROGGS]
     - libpng15 bugfix: https://bugs.gentoo.org/show_bug.cgi?id=354675 [FROGGS]
     - added support for (authenticating) proxies when running from within CPAN shell [FROGGS]

1.427 Sun Jun 18 2011
     - SDL_Pango needs newer libtool to process ld scripts (like on ubuntu), patch added [FROGGS]
     - using `uname -a` to detect sparc systems to disable MMX [FROGGS]

1.426 Sun Apr 24 2011
     - added '--disable-sdltest' to SDL_mixer|ttf|gfx|Pango's configure for darwin [FROGGS]
     - fixing 'Use of uninitialized value ..' warnings in ACTION_install [kmx]
     - disabled MMX for SDL_gfx on ARMv5 machines [FROGGS]

1.425 Thu Feb 03 2011
     - setting --disable-video-x11-xv and -DNO_SHARED_MEMORY when XShm.h is missing #221 [FROGGS]

1.424 Wed Feb 02 2011
     - adding '--disable-sdltest' to SDL_image's configure for darwin #222 [FROGGS]
     - added patch for SDL_image/libpng-flags for netbsd #232 [FROGGS]

1.423 Tue Jan 25 2011
     - now '--with-sdl-config' is the same as '--with-sdl-config=sdl-config' [kmx]
     - added Build.PL option --with-sdl-config=... [madsen,kmx]

1.422 Wed Jan 19 2011
     - the same as latest dev release
     - added paths /usr/pkg/include and /usr/pkg/lib for dragonfly [FROGGS]
     - patch for SDL's configure script, -Wl,-rpath,LIBDIR for openbsd [FROGGS]
     - updated check_header() to use gcc on cygwin [FROGGS]

Changes  view on Meta::CPAN

1.414  Tue Sep 28 2010
     - new Win64 binaries [kmx]
     - new repo URL http://github.com/PerlGameDev/Alien-SDL [kmx]
     - Output of header testing is a one-liner now #203 [FROGGS]
     - Removed SDL_net from build system as it isnt needed [FROGGS]

1.413  Fri Aug 06 2010
     - Searching for lib<xxx>.dll.a libs (cygwin needs this) [kmx]
     - New src build set: SDL-1.2.14 & co. (builds only SDL+SDL_*) [kmx]
     - Using File::Fetch 0.24 [FROGGS]
     - Fixed path of libpng-1.4.1 (has changed due to release of libpng-1.5) [FROGGS]
     - Added fixes for fink and get_path uses in Mac [kthakore]

1.412  Mon July 19 2010
     - Searching for dynamic and static libs [FROGGS]

1.411  Fri July 16 2010
     - Cygwin fix [kmx, FROGGS]

1.410  Mon July 12 2010
     - SDL_ttf 2.0.10 is released, changed url [FROGGS]

1.409  Fri July 09 2010
     - Fixed regex for mmx disable

1.408  Thr July 01 2010 -Yay Canada Day!
     - Messed up release version
     - skip building libpng in case it is already installed [#129] [FROGGS]

1.407  Thu June 30 2010
     - Confirm archname as 64 before using /usr/lib64 as a ld path [kthakore]

1.406  Sun June 13 2010
     - Added conditional ld path check for 64 bit libraries

1.405  Wed June 2nd 2010
     - searching more ld paths for libs [kthakore] {ticket #153}
     - removes old share dirs installs of Alien [kthakore]

Changes  view on Meta::CPAN

     - Build-script is not created when choosing quit [FROGGS]
     - there should be no cpantester result (NA/UNKNOWN) sent when choosing quit [kmx]

1.4  Tue Apr 27 2010
     - alternative locations/hosts for fetching libs [FROGGS]
     - reenabling option #1 (using already installed libs) [FROGGS]

1.3  Fri Apr 23 2010
     - additional libs can be specyfied via Alien::SDL->config('libs', [-lAdd_Lib]) [FROGGS]
     - checking for required shared libs, disabling options if missing [FROGGS]
     - png, jpeg and tiff are build always [FROGGS]
     - building zlib-1.2.5 instead of 1.2.4 [FROGGS]
     - making the RECOMMENDED option default [FROGGS]

1.2
     - build_requires fixed (now contains also modules needed for ./Build test)
     - Win32 patch - proper handling of spaces in dirname [FROGGS]
     - Better detection of patch utility (now works with old patch on bsd systems) [kmx]
     - GNU make autodetection (on bsd systems make!=GNU-make) [kmx]
     - SDL_Pango special patch now defines SDL_PANGO_FB [kthakore]
     - more diagnostics in t/001_load.t
     - improved patching mechanism (better CRLF/LF handling) [FROGGS]
     - Win/32bit binaries (with SDL_Pango patch) [FROGGS]
     - MacOSx file find bug fixed

1.1
     - Powerpc fixes [ioanrogers]
     - fix for many failing MacOS CPAN tester reports [kmx]
     - updated packages (zlib-1.2.4, jpeg-8a, libpng-1.4.1, freetype-2.3.12) in src build [kmx]
     - new Win32 binaries by FROGGS (now works well on WinXP & Win7)
     - typo fixes [dorkfish]

1.0
     - TODO for 1.0 release has been met so incrementing

0.9.1
     - extended Windows/32bit binaries made a default option
     - additional src build set added (no preinstalled jpeg, freetype2, png required)
     - cygwin related patches [http://rt.cpan.org/Ticket/Display.html?id=55202]

0.9
     - An updated windows pack [kmx]
     - Dependencies of SHA fixed [kmx]

0.8.2
     - Local sharedir building [kmx, FROGGS]
     - 64bit building [kthakore, kmx]
     - Darwin testing [Mike Stok, Stuart Watt, Chas Owens] and fixing [kthakore, kmx]

MANIFEST  view on Meta::CPAN

patches/SDL-1.2.14-openbsd-rldflags.patch
patches/SDL-1.2.14-SDL_platform_h.patch
patches/SDL-1.2.14-SDL_x11gl_c.patch
patches/SDL-1.2.14-video_mmx.patch
patches/SDL-1.2.15-Makefile.in-OBJECTS.patch
patches/SDL-1.2.15-mavericks-cgdirectpallete.patch
patches/SDL-1.2.15-openbsd-rldflags.patch
patches/SDL-1.2.15-PIC-in-CFLAGS.patch
patches/SDL_config_win32.h
patches/SDL_gfx-2.0.20-configure.patch
patches/SDL_image-1.2.10-libpng-flags.patch
patches/SDL_image-1.2.10-libpng15.patch
patches/SDL_image-1.2.11-CGFloat.patch
patches/SDL_image-1.2.11-libpng-flags.patch
patches/SDL_mixer-1.2.10-cygwin.patch
patches/SDL_mixer-1.2.12-cygwin.patch
patches/SDL_mixer-1.2.12-native-midi-win32.patch
patches/SDL_mixer-1.2.8-native-midi-win32.patch
patches/SDL_Pango-0.1.2-API-adds.1.patch
patches/SDL_Pango-0.1.2-API-adds.2.patch
patches/SDL_Pango-0.1.2-config-tools.1.patch
patches/SDL_Pango-0.1.2-config-tools.2.patch
patches/SDL_Pango-0.1.2-config-tools.3.patch
patches/SDL_Pango-0.1.2-include-ft2build.h.patch

README  view on Meta::CPAN


    Returns a list of full paths to directories with shared libraries (*.so,
    *.dll) that will be required for running the resulting binaries you have
    linked with SDL libs.

        Alien::SDL->config('ld_shlib_map');

    Returns a reference to hash of value pairs '<libnick>' =>
    '<full_path_to_shlib'>, where '<libnick>' is shortname for SDL related
    library like: SDL, SDL_gfx, SDL_net, SDL_sound ... + some non-SDL
    shortnames e.g. smpeg, jpeg, png.

    NOTE: config('ld_<something>') return an empty list/hash if you have
    decided to use SDL libraries already installed on your system. This
    concerns 'sdl-config' detection and detection via
    '$SDL_INST_DIR/bin/sdl-config'.

  check_header()
    This function checks the availability of given header(s) when using
    compiler options provided by "Alien::SDL->config('cflags')".

README.md  view on Meta::CPAN


    Returns a list of full paths to directories with shared libraries (*.so,
    *.dll) that will be required for running the resulting binaries you have
    linked with SDL libs.

        Alien::SDL->config('ld_shlib_map');

    Returns a reference to hash of value pairs '<libnick>' =>
    '<full_path_to_shlib'>, where '<libnick>' is shortname for SDL related
    library like: SDL, SDL_gfx, SDL_net, SDL_sound ... + some non-SDL
    shortnames e.g. smpeg, jpeg, png.

    NOTE: config('ld_<something>') return an empty list/hash if you have
    decided to use SDL libraries already installed on your system. This
    concerns 'sdl-config' detection and detection via
    '$SDL_INST_DIR/bin/sdl-config'.

  check_header()
    This function checks the availability of given header(s) when using
    compiler options provided by "Alien::SDL->config('cflags')".

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

  # set ld_paths and ld_shlib_map
  my %tmp = ();
  my %shlib_map = ();
  foreach my $full (@shlibs) {
    my ($v, $d, $f) = splitpath($full);
    $tmp{ catpath($v, $d, '') } = 1;
    # available shared libs detection
    if ($f =~ /smpeg/) {
      $shlib_map{smpeg} = $full unless $shlib_map{smpeg};
    }
    elsif ($f =~ /^(lib)?(png12)/) {
      $shlib_map{png12} = $full unless $shlib_map{png12}; # what if it isnt png12?
    }
    elsif ($f =~ /^(lib)?(intl|z|tiff|jpeg|png|ogg|vorbis|vorbisfile|freetype|FLAC|mikmod)[^a-zA-Z]/) {
      $shlib_map{$2} = $full unless $shlib_map{$2};
    }
    elsif ($f =~ /^(lib)?(SDL_[a-zA-Z]{2,8})[^a-zA-Z0-9]/) {
      # sort of dark magic how to detect SDL_<something> related shlib
      $shlib_map{$2} = $full unless $shlib_map{$2};
    }
    elsif ($f =~ /^(lib)?(SDL)/) {
      # '*SDL*' that did not pass previous test is probably core 'SDL'
      $shlib_map{SDL} = $full unless $shlib_map{SDL};
    }
  };

  $cfg->{ld_shared_libs} = [ @shlibs ];
  $cfg->{ld_paths}       = [ keys %tmp ];
  $cfg->{ld_shlib_map}   = \%shlib_map;

  my $have_libs = $self->notes('have_libs');
  for(qw(pthread  z jpeg tiff png ogg vorbis vorbisfile freetype
         pangoft2 pango gobject gmodule glib fontconfig expat )) {
    if( !$shlib_map{$_} && $have_libs->{$_}->[0] ) {
      next unless defined $have_libs->{$_}->[1];
      if ($_ eq 'pthread' && $^O eq 'openbsd') {
        my $osver = `uname -r 2>/dev/null`;
        if ($self->notes('perl_libs')->{pthread} || ($osver && $osver < 5.0)) {
          push @{ $cfg->{ld_shared_libs} }, $have_libs->{$_}->[1];
          $shlib_map{$_} = $have_libs->{$_}->[1];
        }
      }

inc/My/Builder/Unix.pm  view on Meta::CPAN


sub can_build_binaries_from_sources {
  my $self = shift;
  return 1; # yes we can
}

sub build_binaries {
  my( $self, $build_out, $build_src ) = @_;
  my $bp = $self->notes('build_params');
  foreach my $pack (@{$bp->{members}}) {
    if($pack->{pack} =~ m/^png|ogg|vorbis|z$/ && check_prereqs_libs($pack->{pack})->[0]) {
      print "SKIPPING package '" . $pack->{dirname} . "' (already installed)...\n";
    }
    elsif($pack->{pack} =~ m/^(SDL_mixer)$/ && !$self->_is_gnu_make($self->_get_make)) {
      print "SKIPPING package '" . $pack->{dirname} . "' (GNU Make needed)...\n";
    }
    elsif($pack->{pack} =~ m/^(SDL_Pango)$/ && !check_prereqs_tools('pkg-config')) {
      print "SKIPPING package '" . $pack->{dirname} . "' (pkg-config needed)...\n";
    }
    elsif($pack->{pack} =~ m/^(SDL_ttf)$/ && $^O eq 'cygwin') {
      print "SKIPPING package '" . $pack->{dirname} . "' (we cant use libfreetype)...\n";

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

          'http://froggs.de/libtiff/tiff-3.9.1.tar.gz',
          'ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.1.tar.gz',
        ],
        sha1sum  => '675ad1977023a89201b80cd5cd4abadea7ba0897',
        patches => [ ],
        prereqs => {
          libs => [ ]
        }
      },
      {
        pack => 'png',
        version => '1.4.1',
        dirname => 'libpng-1.4.1',
        url => [
          'http://froggs.de/libpng/libpng-1.4.1.tar.gz',
        ],
        sha1sum  => '7a3488f5844068d67074f2507dd8a7ed9c69ff04',
        prereqs => {
          libs => [
            'z',
          ]
        }
      },
      {
        pack => 'freetype',

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

        pack => 'SDL_image',
        version => '1.2.11',
        dirname => 'SDL_image-1.2.11',
        url => [
          'http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.11.tar.gz',
          'http://froggs.de/libsdl/SDL_image-1.2.11.tar.gz',
        ],
        sha1sum  => 'dd384ff87848595fcc0691833431ec5029f973c7',
        patches => [
          'SDL_image-1.2.11-CGFloat.patch',
          'SDL_image-1.2.11-libpng-flags.patch',
        ],
        prereqs => {
          libs => [
            'jpeg', 'tiff', 'png',
          ]
        }
      },
      {
        pack => 'ogg',
        version => '1.3.0',
        dirname => 'libogg-1.3.0',
        url => [
          'http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz',
          'http://froggs.de/libsdl/libogg-1.3.0.tar.gz',

lib/Alien/SDL.pm  view on Meta::CPAN

    Alien::SDL->config('ld_paths');

Returns a list of full paths to directories with shared libraries (*.so, *.dll)
that will be required for running the resulting binaries you have linked with
SDL libs.

    Alien::SDL->config('ld_shlib_map');

Returns a reference to hash of value pairs '<libnick>' => '<full_path_to_shlib'>,
where '<libnick>' is shortname for SDL related library like: SDL, SDL_gfx, SDL_net,
SDL_sound ... + some non-SDL shortnames e.g. smpeg, jpeg, png.

NOTE: config('ld_<something>') return an empty list/hash if you have decided to
use SDL libraries already installed on your system. This concerns 'sdl-config'
detection and detection via '$SDL_INST_DIR/bin/sdl-config'.

=head2 check_header()

This function checks the availability of given header(s) when using compiler
options provided by "Alien::SDL->config('cflags')".

patches/SDL-1.2.14-configure  view on Meta::CPAN

            have_joystick=yes
        fi
        # Set up files for the timer library
        if test x$enable_timers = xyes; then
            $as_echo "#define SDL_TIMER_RISCOS 1" >>confdefs.h

            SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
            have_timers=yes
        fi
        # The RISC OS platform requires special setup.
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
        ;;
    *)
        as_fn_error $? "
*** Unsupported host:  Please add to configure.in
        " "$LINENO" 5
        ;;
esac

# Verify that we have all the platform specific files we need

patches/SDL_image-1.2.10-libpng-flags.patch  view on Meta::CPAN

--- SDL_image-1.2.10/configure	Thu Nov 12 06:42:10 2009
+++ SDL_image-1.2.10/configure	Wed Feb  2 14:35:00 2011
@@ -13554,7 +13554,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
+LIBS="$LIBPNG_LIBS -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13757,7 +13757,7 @@
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
+LIBS="$LIBPNG_LIBS -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14192,7 +14192,7 @@
 _ACEOF
 
     else
-        IMG_LIBS="-lpng -lz $IMG_LIBS"
+        IMG_LIBS="$LIBPNG_LIBS -lz $IMG_LIBS"
     fi
 fi
 

patches/SDL_image-1.2.10-libpng15.patch  view on Meta::CPAN

--- SDL_image-1.2.10/IMG_png.c
+++ SDL_image-1.2.10/IMG_png.c
@@ -71,6 +71,10 @@
 #endif
 #include <png.h>
 
+/* Check for the older version of libpng */
+#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR < 4)
+#define LIBPNG_VERSION_12
+#endif
 
 static struct {
 	int loaded;
@@ -80,6 +84,8 @@
 	void (*png_destroy_read_struct) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr);
 	png_uint_32 (*png_get_IHDR) (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method);
 	png_voidp (*png_get_io_ptr) (png_structp png_ptr);
+	png_byte (*png_get_channels) (png_structp png_ptr, png_infop info_ptr);
+	png_uint_32 (*png_get_PLTE) (png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette);
 	png_uint_32 (*png_get_tRNS) (png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values);
 	png_uint_32 (*png_get_valid) (png_structp png_ptr, png_infop info_ptr, png_uint_32 flag);
 	void (*png_read_image) (png_structp png_ptr, png_bytepp image);
@@ -91,6 +97,9 @@
 	void (*png_set_read_fn) (png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);
 	void (*png_set_strip_16) (png_structp png_ptr);
 	int (*png_sig_cmp) (png_bytep sig, png_size_t start, png_size_t num_to_check);
+#ifndef LIBPNG_VERSION_12
+	jmp_buf* (*png_set_longjmp_fn) (png_structp, png_longjmp_ptr, size_t);
+#endif
 } lib;
 
 #ifdef LOAD_PNG_DYNAMIC
@@ -129,6 +138,13 @@
 			SDL_UnloadObject(lib.handle);
 			return -1;
 		}
+		lib.png_get_channels =
+			(png_byte (*) (png_structp, png_infop))
+			SDL_LoadFunction(lib.handle, "png_get_channels");
+		if ( lib.png_get_channels == NULL ) {
+			SDL_UnloadObject(lib.handle);
+			return -1;
+		}
 		lib.png_get_io_ptr =
 			(png_voidp (*) (png_structp))
 			SDL_LoadFunction(lib.handle, "png_get_io_ptr");
@@ -136,6 +152,13 @@
 			SDL_UnloadObject(lib.handle);
 			return -1;
 		}
+		lib.png_get_PLTE =
+			(png_uint_32 (*) (png_structp, png_infop, png_colorp *, int *))
+			SDL_LoadFunction(lib.handle, "png_get_PLTE");
+		if ( lib.png_get_PLTE == NULL ) {
+			SDL_UnloadObject(lib.handle);
+			return -1;
+		}
 		lib.png_get_tRNS =
 			(png_uint_32 (*) (png_structp, png_infop, png_bytep *, int *, png_color_16p *))
 			SDL_LoadFunction(lib.handle, "png_get_tRNS");
@@ -213,6 +236,15 @@
 			SDL_UnloadObject(lib.handle);
 			return -1;
 		}
+#ifndef LIBPNG_VERSION_12
+		lib.png_set_longjmp_fn =
+			(jmp_buf * (*) (png_structp, png_longjmp_ptr, size_t))
+			SDL_LoadFunction(lib.handle, "png_set_longjmp_fn");
+		if ( lib.png_set_longjmp_fn == NULL ) {
+			SDL_UnloadObject(lib.handle);
+			return -1;
+		}
+#endif
 	}
 	++lib.loaded;
 
@@ -236,7 +268,9 @@
 		lib.png_create_read_struct = png_create_read_struct;
 		lib.png_destroy_read_struct = png_destroy_read_struct;
 		lib.png_get_IHDR = png_get_IHDR;
+		lib.png_get_channels = png_get_channels;
 		lib.png_get_io_ptr = png_get_io_ptr;
+		lib.png_get_PLTE = png_get_PLTE;
 		lib.png_get_tRNS = png_get_tRNS;
 		lib.png_get_valid = png_get_valid;
 		lib.png_read_image = png_read_image;
@@ -248,6 +282,9 @@
 		lib.png_set_read_fn = png_set_read_fn;
 		lib.png_set_strip_16 = png_set_strip_16;
 		lib.png_sig_cmp = png_sig_cmp;
+#ifndef LIBPNG_VERSION_12
+		lib.png_set_longjmp_fn = png_set_longjmp_fn;
+#endif
 	}
 	++lib.loaded;
 
@@ -347,7 +384,12 @@
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in png_create_read_struct() earlier.
 	 */
-	if ( setjmp(png_ptr->jmpbuf) ) {
+#ifndef LIBPNG_VERSION_12
+	if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) )
+#else
+	if ( setjmp(png_ptr->jmpbuf) )
+#endif
+	{
 		error = "Error reading the PNG file.";
 		goto done;
 	}
@@ -416,9 +458,9 @@
 			Rmask = 0x000000FF;
 			Gmask = 0x0000FF00;
 			Bmask = 0x00FF0000;
-			Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
+			Amask = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
 		} else {
-		        int s = (info_ptr->channels == 4) ? 0 : 8;
+		        int s = (lib.png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
 			Rmask = 0xFF000000 >> s;
 			Gmask = 0x00FF0000 >> s;
 			Bmask = 0x0000FF00 >> s;
@@ -426,7 +468,7 @@
 		}
 	}
 	surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
-			bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask);
+			bit_depth*lib.png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask);
 	if ( surface == NULL ) {
 		error = "Out of memory";
 		goto done;
@@ -467,6 +509,9 @@
 	/* Load the palette, if any */
 	palette = surface->format->palette;
 	if ( palette ) {
+	    int png_num_palette;
+	    png_colorp png_palette;
+	    lib.png_get_PLTE(png_ptr, info_ptr, &png_palette, &png_num_palette);
 	    if(color_type == PNG_COLOR_TYPE_GRAY) {
 		palette->ncolors = 256;
 		for(i = 0; i < 256; i++) {
@@ -474,12 +519,12 @@
 		    palette->colors[i].g = i;
 		    palette->colors[i].b = i;
 		}
-	    } else if (info_ptr->num_palette > 0 ) {
-		palette->ncolors = info_ptr->num_palette; 
-		for( i=0; i<info_ptr->num_palette; ++i ) {
-		    palette->colors[i].b = info_ptr->palette[i].blue;
-		    palette->colors[i].g = info_ptr->palette[i].green;
-		    palette->colors[i].r = info_ptr->palette[i].red;
+	    } else if (png_num_palette > 0 ) {
+		palette->ncolors = png_num_palette; 
+		for( i=0; i<png_num_palette; ++i ) {
+		    palette->colors[i].b = png_palette[i].blue;
+		    palette->colors[i].g = png_palette[i].green;
+		    palette->colors[i].r = png_palette[i].red;
 		}
 	    }
 	}

patches/SDL_image-1.2.11-libpng-flags.patch  view on Meta::CPAN

--- SDL_image-1.2.11/configure	2012-01-06 05:12:29.000000000 +0100
+++ SDL_image-1.2.11/configure	2012-01-06 10:06:05.000000000 +0100
@@ -13875,7 +13875,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
+LIBS="$LIBPNG_LIBS -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -14072,7 +14072,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
+LIBS="$LIBPNG_LIBS -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15008,7 +15008,7 @@
 _ACEOF
 
     else
-        IMG_LIBS="-lpng -lz $IMG_LIBS"
+        IMG_LIBS="$LIBPNG_LIBS -lz $IMG_LIBS"
     fi
 fi
 



( run in 2.228 seconds using v1.01-cache-2.11-cpan-df04353d9ac )