[mingw-cximage/f17: 1/5] Initial import

Marc-André Lureau elmarco at fedoraproject.org
Tue May 29 12:52:56 UTC 2012


commit b6fea9292d7e70124b248fd21446b8189930b3be
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Tue May 22 15:16:09 2012 +0200

    Initial import

 cximage-6.0.0-disable-some-formats.patch |   16 +++
 cximage-6.0.0-fix-include-name.patch     |   13 ++
 cximage-6.0.0-std_min_max.patch          |   34 ++++++
 mingw-cximage.spec                       |  179 ++++++++++++++++++++++++++++++
 4 files changed, 242 insertions(+), 0 deletions(-)
---
diff --git a/cximage-6.0.0-disable-some-formats.patch b/cximage-6.0.0-disable-some-formats.patch
new file mode 100644
index 0000000..3fb62b5
--- /dev/null
+++ b/cximage-6.0.0-disable-some-formats.patch
@@ -0,0 +1,16 @@
+diff --git a/CxImage/ximacfg.h b/CxImage/ximacfg.h
+index 784976c..4d21425 100644
+--- a/CxImage/ximacfg.h
++++ b/CxImage/ximacfg.h
+@@ -35,9 +35,9 @@
+ 
+ #define CXIMAGE_SUPPORT_JBG 0		// GPL'd see ../jbig/copying.txt & ../jbig/patents.htm
+ 
+-#define CXIMAGE_SUPPORT_MNG 1
++#define CXIMAGE_SUPPORT_MNG 0
+ #define CXIMAGE_SUPPORT_SKA 1
+-#define CXIMAGE_SUPPORT_RAW 1
++#define CXIMAGE_SUPPORT_RAW 0
+ 
+ /////////////////////////////////////////////////////////////////////////////
+ #define	CXIMAGE_MAX_MEMORY 268435456
diff --git a/cximage-6.0.0-fix-include-name.patch b/cximage-6.0.0-fix-include-name.patch
new file mode 100644
index 0000000..b6631ca
--- /dev/null
+++ b/cximage-6.0.0-fix-include-name.patch
@@ -0,0 +1,13 @@
+diff --git a/CxImage/CxImageDLL/CxImageCrtDll.cpp b/CxImage/CxImageDLL/CxImageCrtDll.cpp
+index ad468ed..957f232 100644
+--- a/CxImage/CxImageDLL/CxImageCrtDll.cpp
++++ b/CxImage/CxImageDLL/CxImageCrtDll.cpp
+@@ -1,7 +1,7 @@
+ // CxImageCrtDll.cpp : Defines the entry point for the CxImageCrtDll application.
+ //
+ 
+-#include "stdcrt.h"
++#include "StdCrt.h"
+ 
+ BOOL APIENTRY DllMain( HANDLE /*hModule*/, 
+                        DWORD  /*ul_reason_for_call*/, 
diff --git a/cximage-6.0.0-std_min_max.patch b/cximage-6.0.0-std_min_max.patch
new file mode 100644
index 0000000..1183f9b
--- /dev/null
+++ b/cximage-6.0.0-std_min_max.patch
@@ -0,0 +1,34 @@
+diff --git a/CxImage/ximadsp.cpp b/CxImage/ximadsp.cpp
+index 68695db..a485ef3 100644
+--- a/CxImage/ximadsp.cpp
++++ b/CxImage/ximadsp.cpp
+@@ -3504,8 +3504,8 @@ bool CxImage::FloodFill(const long xStart, const long yStart, const RGBQUAD cFil
+ 	if (IsIndexed()){ //--- Generic indexed image, no tolerance OR Grayscale image with tolerance
+ 		BYTE idxRef = GetPixelIndex(xStart,yStart);
+ 		BYTE idxFill = GetNearestIndex(cFillColor);
+-		BYTE idxMin = (BYTE)min(255, max(0,(int)(idxRef - nTolerance)));
+-		BYTE idxMax = (BYTE)min(255, max(0,(int)(idxRef + nTolerance)));
++		BYTE idxMin = (BYTE)std::min(255, std::max(0,(int)(idxRef - nTolerance)));
++		BYTE idxMax = (BYTE)std::min(255, std::max(0,(int)(idxRef + nTolerance)));
+ 
+ 		while(!q.empty())
+ 		{
+@@ -3541,12 +3541,12 @@ bool CxImage::FloodFill(const long xStart, const long yStart, const RGBQUAD cFil
+ 	} else { //--- RGB image
+ 		RGBQUAD cRef = GetPixelColor(xStart,yStart);
+ 		RGBQUAD cRefMin, cRefMax;
+-		cRefMin.rgbRed   = (BYTE)min(255, max(0,(int)(cRef.rgbRed   - nTolerance)));
+-		cRefMin.rgbGreen = (BYTE)min(255, max(0,(int)(cRef.rgbGreen - nTolerance)));
+-		cRefMin.rgbBlue  = (BYTE)min(255, max(0,(int)(cRef.rgbBlue  - nTolerance)));
+-		cRefMax.rgbRed   = (BYTE)min(255, max(0,(int)(cRef.rgbRed   + nTolerance)));
+-		cRefMax.rgbGreen = (BYTE)min(255, max(0,(int)(cRef.rgbGreen + nTolerance)));
+-		cRefMax.rgbBlue  = (BYTE)min(255, max(0,(int)(cRef.rgbBlue  + nTolerance)));
++		cRefMin.rgbRed   = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbRed   - nTolerance)));
++		cRefMin.rgbGreen = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbGreen - nTolerance)));
++		cRefMin.rgbBlue  = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbBlue  - nTolerance)));
++		cRefMax.rgbRed   = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbRed   + nTolerance)));
++		cRefMax.rgbGreen = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbGreen + nTolerance)));
++		cRefMax.rgbBlue  = (BYTE)std::min(255, std::max(0,(int)(cRef.rgbBlue  + nTolerance)));
+ 
+ 		while(!q.empty())
+ 		{
diff --git a/mingw-cximage.spec b/mingw-cximage.spec
new file mode 100644
index 0000000..61a9be1
--- /dev/null
+++ b/mingw-cximage.spec
@@ -0,0 +1,179 @@
+%{?mingw_package_header}
+
+%global versionmajor 6
+%global versionminor 0
+%global versionsuffix 0
+
+Name:           mingw-cximage
+Version:        %{versionmajor}%{versionminor}%{versionsuffix}
+Release:        3%{?dist}
+Summary:        MinGW Windows CxImage manipulation library
+
+Group:          Development/Libraries
+License:        zlib
+URL:            http://sourceforge.net/projects/cximage
+Source0:        http://sourceforge.net/projects/cximage/files/%{versionmajor}.%{versionminor}%{versionsuffix}/cximage%{version}_full.7z
+Source1:        cximage.pc
+Patch0:         cximage-6.0.0-disable-some-formats.patch
+Patch1:         cximage-6.0.0-std_min_max.patch
+Patch2:         cximage-6.0.0-fix-include-name.patch
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 95
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-jasper
+BuildRequires:  mingw32-libjpeg-turbo
+BuildRequires:  mingw32-libpng
+BuildRequires:  mingw32-libtiff
+BuildRequires:  mingw32-zlib
+BuildRequires:  mingw32-pkg-config
+
+BuildRequires:  mingw64-filesystem >= 95
+BuildRequires:  mingw64-gcc
+BuildRequires:  mingw64-jasper
+BuildRequires:  mingw64-libjpeg-turbo
+BuildRequires:  mingw64-libpng
+BuildRequires:  mingw64-libtiff
+BuildRequires:  mingw64-zlib
+BuildRequires:  mingw64-pkg-config
+
+BuildRequires:  p7zip
+
+
+%description
+CxImage is a C++ image processing library. It can load, save, display,
+transform images in a very simple and fast way, with transparency, multiple
+layers and selections, support for BMP GIF JPG PNG MNG TIF ICO TGA PCX J2K
+JBG RAS PNM RAW PSD.
+
+
+# Mingw32
+%package -n mingw32-cximage
+Summary: MinGW Windows CxImage manipulation library
+
+%description -n mingw32-cximage
+Cross compiled CxImage library.
+
+%package -n mingw32-cximage-static
+Summary: MinGW Windows CxImage manipulation static library
+Requires: mingw32-cximage = %{version}-%{release}
+
+%description -n mingw32-cximage-static
+Cross compiled static CxImage library.
+
+# Mingw64
+%package -n mingw64-cximage
+Summary: MinGW Windows CxImage manipulation library
+
+%description -n mingw64-cximage
+MinGW Windows CxImage library.
+
+%package -n mingw64-cximage-static
+Summary: MinGW Windows CxImage manipulation static library
+Requires: mingw64-cximage = %{version}-%{release}
+
+%description -n mingw64-cximage-static
+Cross compiled static CxImage library.
+
+%{?mingw_debug_package}
+
+
+%prep
+rm -rf %{name}-%{version}
+mkdir %{name}-%{version}
+cd %{name}-%{version}
+7za x %{SOURCE0}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+
+%build
+%global cximage_cppflags -D_USRDLL -D_USRCxImageCrtDll -DCxImageCrtDll_EXPORTS
+%global cximage32_pkg_flags $(%{mingw32_pkg_config} --cflags --libs libpng15 zlib)
+%global cximage64_pkg_flags $(%{mingw64_pkg_config} --cflags --libs libpng15 zlib)
+%global cximage32_ldflags -lgdi32 -lws2_32 -ljpeg -ltiff -ljasper
+%global cximage64_ldflags -lgdi32 -lws2_32 -ljpeg -ltiff -ljasper
+cd %{name}-%{version}
+
+mkdir build_win32
+cd build_win32
+%{mingw32_cxx} %{mingw32_cflags} %{cximage_cppflags} \
+    -shared -o libcximage.dll -Wl,--out-implib,libcximage.dll.a \
+    ../CxImage/*.cpp ../CxImage/CxImageDLL/CxImageCrtDll.cpp \
+    %{cximage32_ldflags} %{cximage32_pkg_flags}
+%{mingw32_cxx} %{mingw32_cflags} %{cximage_cppflags} \
+    -c ../CxImage/*.cpp ../CxImage/CxImageDLL/CxImageCrtDll.cpp \
+    %{cximage32_ldflags} %{cximage32_pkg_flags}
+%{mingw32_ar} -cru libcximage.a *.o
+cd ..
+
+mkdir build_win64
+cd build_win64
+%{mingw64_cxx} %{mingw64_cflags} %{cximage_cppflags} \
+    -shared -o libcximage.dll -Wl,--out-implib,libcximage.dll.a \
+    ../CxImage/*.cpp ../CxImage/CxImageDLL/CxImageCrtDll.cpp \
+    %{cximage64_ldflags} %{cximage64_pkg_flags}
+%{mingw64_cxx} %{mingw64_cflags} %{cximage_cppflags} \
+    -c ../CxImage/*.cpp ../CxImage/CxImageDLL/CxImageCrtDll.cpp \
+    %{cximage64_ldflags} %{cximage64_pkg_flags}
+%{mingw64_ar} -cru libcximage.a *.o
+cd ..
+
+
+%install
+pushd %{name}-%{version}
+install -d $RPM_BUILD_ROOT/%{mingw32_bindir}
+install -d $RPM_BUILD_ROOT/%{mingw32_libdir}/pkgconfig
+install -m0644 %{SOURCE1} $RPM_BUILD_ROOT/%{mingw32_libdir}/pkgconfig
+sed -i s!@PREFIX@!%{mingw32_prefix}!g $RPM_BUILD_ROOT/%{mingw32_libdir}/pkgconfig/cximage.pc
+install -m0644 build_win32/libcximage.dll $RPM_BUILD_ROOT/%{mingw32_bindir}/libcximage.dll
+install -m0644 build_win32/libcximage.dll.a $RPM_BUILD_ROOT/%{mingw32_libdir}/libcximage.dll.a
+install -m0644 build_win32/libcximage.a $RPM_BUILD_ROOT/%{mingw32_libdir}/libcximage.a
+install -d $RPM_BUILD_ROOT/%{mingw32_includedir}/CxImage/
+install -m0644 CxImage/*.h $RPM_BUILD_ROOT/%{mingw32_includedir}/CxImage/
+
+install -d $RPM_BUILD_ROOT/%{mingw64_bindir}
+install -d $RPM_BUILD_ROOT/%{mingw64_libdir}/pkgconfig
+install -m0644 %{SOURCE1} $RPM_BUILD_ROOT/%{mingw64_libdir}/pkgconfig
+sed -i s!@PREFIX@!%{mingw64_prefix}!g $RPM_BUILD_ROOT/%{mingw64_libdir}/pkgconfig/cximage.pc
+install -m0644 build_win64/libcximage.dll $RPM_BUILD_ROOT/%{mingw64_bindir}/libcximage.dll
+install -m0644 build_win64/libcximage.dll.a $RPM_BUILD_ROOT/%{mingw64_libdir}/libcximage.dll.a
+install -m0644 build_win64/libcximage.a $RPM_BUILD_ROOT/%{mingw64_libdir}/libcximage.a
+install -d $RPM_BUILD_ROOT/%{mingw64_includedir}/CxImage/
+install -m0644 CxImage/*.h $RPM_BUILD_ROOT/%{mingw64_includedir}/CxImage/
+popd
+
+# FIXME: no idea why we need to call it ourself
+%mingw_debug_install_post
+
+
+%files -n mingw32-cximage
+%{mingw32_bindir}/libcximage.dll
+%{mingw32_includedir}/CxImage/
+%{mingw32_libdir}/libcximage.dll.a
+%{mingw32_libdir}/pkgconfig/cximage.pc
+
+%files -n mingw32-cximage-static
+%{mingw32_libdir}/libcximage.a
+
+%files -n mingw64-cximage
+%{mingw64_bindir}/libcximage.dll
+%{mingw64_includedir}/CxImage/
+%{mingw64_libdir}/libcximage.dll.a
+%{mingw64_libdir}/pkgconfig/cximage.pc
+
+%files -n mingw64-cximage-static
+%{mingw64_libdir}/libcximage.a
+
+
+%changelog
+* Thu May 10 2012 Marc-André Lureau <marcandre.lureau at redhat.com> - 6.0.0-3
+- Update to latest Fedora mingw64 guidelines, clean-up
+- Add debug package and static library building
+
+* Thu Feb 23 2012 Christophe Fergeau <cfergeau at redhat.com> - 6.0.0-2
+- Added 64 bit support
+
+* Wed Feb 22 2012 Christophe Fergeau <cfergeau at redhat.com> - 6.0.0-1
+- Initial mingw build of CxImage


More information about the scm-commits mailing list