[irrlicht] fix compile against png15

Tom Callaway spot at fedoraproject.org
Tue Dec 6 20:25:02 UTC 2011


commit ac50c7757600482e3564fc0222041788adb99c55
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Tue Dec 6 15:24:51 2011 -0500

    fix compile against png15

 irrlicht-1.7.1-libaesgm.patch              |   15 +++---
 irrlicht-1.7.1-optflags.patch              |   22 +++++-----
 irrlicht-1.7.2-irrXML-shared-library.patch |   12 +++---
 irrlicht-1.7.2-png15.patch                 |   66 ++++++++++++++++++++++++++++
 irrlicht.spec                              |    9 +++-
 5 files changed, 99 insertions(+), 25 deletions(-)
---
diff --git a/irrlicht-1.7.1-libaesgm.patch b/irrlicht-1.7.1-libaesgm.patch
index faca504..fe9a96b 100644
--- a/irrlicht-1.7.1-libaesgm.patch
+++ b/irrlicht-1.7.1-libaesgm.patch
@@ -1,7 +1,7 @@
-diff -up irrlicht-1.7.1/source/Irrlicht/CZipReader.cpp.libaesgm irrlicht-1.7.1/source/Irrlicht/CZipReader.cpp
---- irrlicht-1.7.1/source/Irrlicht/CZipReader.cpp.libaesgm	2010-01-31 16:03:28.000000000 -0500
-+++ irrlicht-1.7.1/source/Irrlicht/CZipReader.cpp	2010-05-24 11:15:18.856512375 -0400
-@@ -20,7 +20,7 @@
+diff -up irrlicht-1.7.2/source/Irrlicht/CZipReader.cpp.libaesgm irrlicht-1.7.2/source/Irrlicht/CZipReader.cpp
+--- irrlicht-1.7.2/source/Irrlicht/CZipReader.cpp.libaesgm	2010-10-24 09:42:48.000000000 -0400
++++ irrlicht-1.7.2/source/Irrlicht/CZipReader.cpp	2011-12-06 15:03:16.314752255 -0500
+@@ -27,7 +27,7 @@ extern "C" void bz_internal_error(int er
  	#endif
  
  	#ifdef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
@@ -10,12 +10,13 @@ diff -up irrlicht-1.7.1/source/Irrlicht/CZipReader.cpp.libaesgm irrlicht-1.7.1/s
  	#endif
  	#ifdef _IRR_COMPILE_WITH_BZIP2_
  	#ifndef _IRR_USE_NON_SYSTEM_BZLIB_
---- irrlicht-1.7.1/source/Irrlicht/Makefile.libaesgm	2010-05-24 11:18:35.966512547 -0400
-+++ irrlicht-1.7.1/source/Irrlicht/Makefile	2010-05-24 11:18:10.368387943 -0400
+diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.libaesgm irrlicht-1.7.2/source/Irrlicht/Makefile
+--- irrlicht-1.7.2/source/Irrlicht/Makefile.libaesgm	2011-12-06 15:03:16.000000000 -0500
++++ irrlicht-1.7.2/source/Irrlicht/Makefile	2011-12-06 15:04:14.805199640 -0500
 @@ -54,7 +54,7 @@ LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRP
  ###############
  #Compiler flags
- CXXINCS = -I../../include
+ CXXINCS = -I../../include `libpng-config --cflags`
 -CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1 $(RPM_OPT_FLAGS)
 +CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1 -DUSE_SHA1 $(RPM_OPT_FLAGS)
  CXXFLAGS += $(RPM_OPT_FLAGS) -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
diff --git a/irrlicht-1.7.1-optflags.patch b/irrlicht-1.7.1-optflags.patch
index be343c9..034a368 100644
--- a/irrlicht-1.7.1-optflags.patch
+++ b/irrlicht-1.7.1-optflags.patch
@@ -1,6 +1,6 @@
-diff -up irrlicht-1.7.1/include/IrrCompileConfig.h.optflags irrlicht-1.7.1/include/IrrCompileConfig.h
---- irrlicht-1.7.1/include/IrrCompileConfig.h.optflags	2010-02-14 13:06:28.000000000 -0500
-+++ irrlicht-1.7.1/include/IrrCompileConfig.h	2010-02-18 13:05:49.965766292 -0500
+diff -up irrlicht-1.7.2/include/IrrCompileConfig.h.optflags irrlicht-1.7.2/include/IrrCompileConfig.h
+--- irrlicht-1.7.2/include/IrrCompileConfig.h.optflags	2010-10-24 12:26:28.000000000 -0400
++++ irrlicht-1.7.2/include/IrrCompileConfig.h	2011-12-06 15:01:10.114944711 -0500
 @@ -176,7 +176,7 @@ the engine will no longer read .jpeg ima
  //! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
  /** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
@@ -19,7 +19,7 @@ diff -up irrlicht-1.7.1/include/IrrCompileConfig.h.optflags irrlicht-1.7.1/inclu
  
  
  //! Define _IRR_D3D_NO_SHADER_DEBUGGING to disable shader debugging in D3D9
-@@ -348,7 +348,7 @@ ones. */
+@@ -348,7 +348,7 @@ ones. */
  /** If this is commented out, Irrlicht will try to compile using the zlib
  installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
  defined. */
@@ -28,7 +28,7 @@ diff -up irrlicht-1.7.1/include/IrrCompileConfig.h.optflags irrlicht-1.7.1/inclu
  //! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
  #define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
  //! Define _IRR_COMPILE_WITH_BZIP2_ if you want to support bzip2 compressed zip archives
-@@ -360,7 +360,7 @@ library. */
+@@ -360,7 +360,7 @@ library. */
  /** If this is commented out, Irrlicht will try to compile using the bzlib
  installed on the system. This is only used when _IRR_COMPILE_WITH_BZLIB_ is
  defined. */
@@ -37,9 +37,9 @@ diff -up irrlicht-1.7.1/include/IrrCompileConfig.h.optflags irrlicht-1.7.1/inclu
  //! Define _IRR_COMPILE_WITH_LZMA_ if you want to use LZMA compressed zip files.
  /** LZMA is a very efficient compression code, known from 7zip. Irrlicht
  currently only supports zip archives, though. */
-diff -up irrlicht-1.7.1/source/Irrlicht/Makefile.optflags irrlicht-1.7.1/source/Irrlicht/Makefile
---- irrlicht-1.7.1/source/Irrlicht/Makefile.optflags	2010-01-31 16:03:28.000000000 -0500
-+++ irrlicht-1.7.1/source/Irrlicht/Makefile	2010-02-18 13:07:28.699640760 -0500
+diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.optflags irrlicht-1.7.2/source/Irrlicht/Makefile
+--- irrlicht-1.7.2/source/Irrlicht/Makefile.optflags	2010-10-31 17:53:30.000000000 -0400
++++ irrlicht-1.7.2/source/Irrlicht/Makefile	2011-12-06 15:03:00.473901933 -0500
 @@ -49,18 +49,17 @@ BZIP2OBJ = bzip2/blocksort.o bzip2/huffm
  EXTRAOBJ =
  LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
@@ -53,7 +53,7 @@ diff -up irrlicht-1.7.1/source/Irrlicht/Makefile.optflags irrlicht-1.7.1/source/
 -CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
 -CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
 -CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
-+CXXINCS = -I../../include
++CXXINCS = -I../../include `libpng-config --cflags`
 +CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1 $(RPM_OPT_FLAGS)
 +CXXFLAGS += $(RPM_OPT_FLAGS) -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
  ifndef NDEBUG
@@ -64,12 +64,12 @@ diff -up irrlicht-1.7.1/source/Irrlicht/Makefile.optflags irrlicht-1.7.1/source/
  endif
  ifdef PROFILE
  CXXFLAGS += -pg
-@@ -82,7 +81,7 @@ LIB_PATH = ../../lib/$(SYSTEM)
+@@ -82,7 +81,7 @@ LIB_PATH = ../../lib/$(SYSTEM)
  INSTALL_DIR = /usr/local/lib
  sharedlib install: SHARED_LIB = libIrrlicht.so
  staticlib sharedlib: LDFLAGS += --no-export-all-symbols --add-stdcall-alias
 -sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
-+sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg -lpng -lbz2 -laesgm
++sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg `libpng-config --libs` -lbz2 -laesgm
  staticlib sharedlib: CXXINCS += -I/usr/X11R6/include
  
  #OSX specific options
diff --git a/irrlicht-1.7.2-irrXML-shared-library.patch b/irrlicht-1.7.2-irrXML-shared-library.patch
index 36ee9b4..a73e61e 100644
--- a/irrlicht-1.7.2-irrXML-shared-library.patch
+++ b/irrlicht-1.7.2-irrXML-shared-library.patch
@@ -1,6 +1,6 @@
 diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML irrlicht-1.7.2/source/Irrlicht/Makefile
---- irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML	2011-03-22 12:02:53.051759001 -0400
-+++ irrlicht-1.7.2/source/Irrlicht/Makefile	2011-03-22 12:05:04.885759001 -0400
+--- irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML	2011-12-06 15:04:38.435976299 -0500
++++ irrlicht-1.7.2/source/Irrlicht/Makefile	2011-12-06 15:06:23.308507556 -0500
 @@ -36,9 +36,10 @@ IRRIMAGEOBJ = CColorConverter.o CImage.o
  	CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o
  IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ)
@@ -19,10 +19,10 @@ diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML irrlicht-1.7.2/source/Ir
  INSTALL_DIR = /usr/local/lib
 -sharedlib install: SHARED_LIB = libIrrlicht.so
 -staticlib sharedlib: LDFLAGS += --no-export-all-symbols --add-stdcall-alias
--sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg -lpng -lbz2 -laesgm
+-sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg `libpng-config --libs` -lbz2 -laesgm
 +irrxml_sharedlib install: IRRXML_SHARED_LIB = libIrrXML.so
 +irrlicht_sharedlib install: SHARED_LIB = libIrrlicht.so
-+irrlicht_sharedlib irrxml_sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg -lpng -lbz2 -laesgm
++irrlicht_sharedlib irrxml_sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lz -ljpeg `libpng-config --libs` -lbz2 -laesgm
 +irrlicht_sharedlib: LDFLAGS += -L$(LIB_PATH) -lIrrXML
  staticlib sharedlib: CXXINCS += -I/usr/X11R6/include
  
@@ -55,7 +55,7 @@ diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML irrlicht-1.7.2/source/Ir
  	$(AR) rs $@ $^
  
  # Copies static lib into lib/Linux
-@@ -140,7 +152,8 @@ install install_osx:
+@@ -140,7 +152,8 @@ install install_osx:
  	mkdir -p $(INSTALL_DIR)/../include/irrlicht
  	cp ../../include/*.h $(INSTALL_DIR)/../include/irrlicht/
  	cp $(LIB_PATH)/$(SHARED_LIB).$(VERSION) $(INSTALL_DIR)
@@ -65,7 +65,7 @@ diff -up irrlicht-1.7.2/source/Irrlicht/Makefile.irrXML irrlicht-1.7.2/source/Ir
  #	ldconfig -n $(INSTALL_DIR)
  
  TAGS:
-@@ -164,8 +177,10 @@ endif
+@@ -164,8 +177,10 @@ endif
  
  help:
  	@echo "Available targets for Irrlicht"
diff --git a/irrlicht-1.7.2-png15.patch b/irrlicht-1.7.2-png15.patch
new file mode 100644
index 0000000..898902e
--- /dev/null
+++ b/irrlicht-1.7.2-png15.patch
@@ -0,0 +1,66 @@
+diff -up irrlicht-1.7.2/source/Irrlicht/CImageLoaderPNG.cpp.png15 irrlicht-1.7.2/source/Irrlicht/CImageLoaderPNG.cpp
+--- irrlicht-1.7.2/source/Irrlicht/CImageLoaderPNG.cpp.png15	2010-10-24 09:42:46.000000000 -0400
++++ irrlicht-1.7.2/source/Irrlicht/CImageLoaderPNG.cpp	2011-12-06 15:20:25.542576111 -0500
+@@ -28,7 +28,11 @@ namespace video
+ static void png_cpexcept_error(png_structp png_ptr, png_const_charp msg)
+ {
+ 	os::Printer::log("PNG FATAL ERROR", msg, ELL_ERROR);
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++	longjmp(png_jmpbuf(png_ptr),1);
++#else
+ 	longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ 
+ // PNG function for file reading
+@@ -37,7 +41,11 @@ void PNGAPI user_read_data_fcn(png_struc
+ 	png_size_t check;
+ 
+ 	// changed by zola {
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++	io::IReadFile* file=(io::IReadFile*)png_get_io_ptr(png_ptr);
++#else
+ 	io::IReadFile* file=(io::IReadFile*)png_ptr->io_ptr;
++#endif
+ 	check=(png_size_t) file->read((void*)data,(u32)length);
+ 	// }
+ 
+@@ -162,7 +170,11 @@ IImage* CImageLoaderPng::loadImage(io::I
+ 	if (BitDepth < 8)
+ 	{
+ 		if (ColorType==PNG_COLOR_TYPE_GRAY || ColorType==PNG_COLOR_TYPE_GRAY_ALPHA)
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++			png_set_expand_gray_1_2_4_to_8(png_ptr);
++#else
+ 			png_set_gray_1_2_4_to_8(png_ptr);
++#endif
+ 		else
+ 			png_set_packing(png_ptr);
+ 	}
+diff -up irrlicht-1.7.2/source/Irrlicht/CImageWriterPNG.cpp.png15 irrlicht-1.7.2/source/Irrlicht/CImageWriterPNG.cpp
+--- irrlicht-1.7.2/source/Irrlicht/CImageWriterPNG.cpp.png15	2011-12-06 15:20:54.476303641 -0500
++++ irrlicht-1.7.2/source/Irrlicht/CImageWriterPNG.cpp	2011-12-06 15:22:56.424155264 -0500
+@@ -35,7 +35,11 @@ IImageWriter* createImageWriterPNG()
+ static void png_cpexcept_error(png_structp png_ptr, png_const_charp msg)
+ {
+ 	os::Printer::log("PNG FATAL ERROR", msg, ELL_ERROR);
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++	longjmp(png_jmpbuf(png_ptr),1);
++#else
+ 	longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ 
+ // PNG function for file writing
+@@ -43,7 +47,11 @@ void PNGAPI user_write_data_fcn(png_stru
+ {
+ 	png_size_t check;
+ 
++#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
++	io::IWriteFile* file=(io::IWriteFile*)png_get_io_ptr(png_ptr);
++#else
+ 	io::IWriteFile* file=(io::IWriteFile*)png_ptr->io_ptr;
++#endif
+ 	check=(png_size_t) file->write((const void*)data,(u32)length);
+ 
+ 	if (check != length)
diff --git a/irrlicht.spec b/irrlicht.spec
index d91f4e9..0054da6 100644
--- a/irrlicht.spec
+++ b/irrlicht.spec
@@ -4,7 +4,7 @@
 Name:		irrlicht
 Summary: 	A high performance realtime 3D engine
 Version:	%{irrlicht_version}
-Release:	9%{?dist}
+Release:	10%{?dist}
 License:	zlib
 Group:		System Environment/Libraries
 Source0:	http://downloads.sourceforge.net/irrlicht/%{name}-%{irrlicht_version}.zip
@@ -19,6 +19,8 @@ Patch2:		irrlicht-1.7.1-libaesgm.patch
 Patch3:		irrlicht-1.7.2-fastatof-improvements-typefixes.patch
 # Make libIrrXML.so
 Patch4:		irrlicht-1.7.2-irrXML-shared-library.patch
+# Use png15
+Patch5:		irrlicht-1.7.2-png15.patch
 URL:		http://irrlicht.sourceforge.net/
 BuildRequires:	libXxf86vm-devel, mesa-libGL-devel, mesa-libGLU-devel
 BuildRequires:	libjpeg-devel, zlib-devel, libaesgm-devel
@@ -66,6 +68,7 @@ Development headers and libraries for irrXML.
 %patch2 -p1 -b .libaesgm
 %patch3 -p1 -b .fastatof
 %patch4 -p1 -b .irrXML
+%patch5 -p1 -b .png15
 
 sed -i 's/\r//' readme.txt
 iconv -o readme.txt.iso88591 -f iso88591 -t utf8 readme.txt
@@ -129,6 +132,10 @@ ln -s libIrrlicht.so.%{irrlicht_version} libIrrlicht.so.1.7
 %{_libdir}/libIrrXML*.so
 
 %changelog
+* Tue Dec 06 2011 Tom Callaway <spot at fedoraproject.org> - 1.7.2-10
+- fix irrlicht to use libpng-config for cflags/libs
+- patches for support for libpng15
+
 * Tue Dec 06 2011 Adam Jackson <ajax at redhat.com> - 1.7.2-9
 - Rebuild for new libpng
 


More information about the scm-commits mailing list