diff --git a/libraries/opencv/opencv-gcc4.4.patch b/libraries/opencv/opencv-gcc4.4.patch new file mode 100644 index 0000000000..9621b32bcc --- /dev/null +++ b/libraries/opencv/opencv-gcc4.4.patch @@ -0,0 +1,12 @@ +diff -U 3 -H -d -r -N -- opencv-1.1.0.old/cxcore/include/cxmisc.h opencv-1.1.0/cxcore/include/cxmisc.h +--- opencv-1.1.0.old/cxcore/include/cxmisc.h 2008-07-29 15:05:04.000000000 -0400 ++++ opencv-1.1.0/cxcore/include/cxmisc.h 2010-05-23 17:23:44.000000000 -0400 +@@ -130,7 +130,7 @@ + #include + #elif defined HAVE_ALLOCA + #include +-#elif ++#else + #error + #endif + diff --git a/libraries/opencv/opencv-libpng14.patch b/libraries/opencv/opencv-libpng14.patch new file mode 100644 index 0000000000..fa57f5e115 --- /dev/null +++ b/libraries/opencv/opencv-libpng14.patch @@ -0,0 +1,12 @@ +diff -U 3 -H -d -r -N -- opencv-1.1.0.old/otherlibs/highgui/grfmt_png.cpp opencv-1.1.0/otherlibs/highgui/grfmt_png.cpp +--- opencv-1.1.0.old/otherlibs/highgui/grfmt_png.cpp 2006-10-11 12:51:43.000000000 -0400 ++++ opencv-1.1.0/otherlibs/highgui/grfmt_png.cpp 2010-05-23 17:46:19.232028822 -0400 +@@ -215,7 +215,7 @@ + png_set_palette_to_rgb( png_ptr ); + + if( m_color_type == PNG_COLOR_TYPE_GRAY && m_bit_depth < 8 ) +- png_set_gray_1_2_4_to_8( png_ptr ); ++ png_set_expand_gray_1_2_4_to_8( png_ptr ); + + if( m_iscolor && color ) + png_set_bgr( png_ptr ); // convert RGB to BGR diff --git a/libraries/opencv/opencv.SlackBuild b/libraries/opencv/opencv.SlackBuild index 3cb0e52b94..11d977e9af 100644 --- a/libraries/opencv/opencv.SlackBuild +++ b/libraries/opencv/opencv.SlackBuild @@ -24,10 +24,19 @@ PRGNAM=opencv VERSION=1.1pre1 -ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM @@ -42,6 +51,9 @@ elif [ "$ARCH" = "i686" ]; then elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" fi rm -rf $PKG @@ -54,6 +66,10 @@ cd $PRGNAM-$VERSION || exit 1 chown -R root:root . chmod -R u+w,go+r-w,a-s . +# Patch to build with libpng14 and gcc4.4. +patch -p1 < $CWD/opencv-gcc4.4.patch +patch -p1 < $CWD/opencv-libpng14.patch + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \