From 23e939947346b4b0389f6b47879c62841d459472 Mon Sep 17 00:00:00 2001 From: Sérgio M. Basto Date: May 28 2016 15:07:41 +0000 Subject: Update php-facedetect to 1.1.0 --- diff --git a/.gitignore b/.gitignore index 9ba1dad..671d892 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ facedetect-1.0.0.tar.gz /facedetect-1.0.1.tar.gz +/facedetect-1.1.0.tar.gz diff --git a/facedetect-1.0.1-opencv-2.2.0.patch b/facedetect-1.0.1-opencv-2.2.0.patch deleted file mode 100644 index 44b279b..0000000 --- a/facedetect-1.0.1-opencv-2.2.0.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -up facedetect/config.m4.BAD facedetect/config.m4 ---- facedetect/config.m4.BAD 2011-05-10 15:20:16.295313177 -0400 -+++ facedetect/config.m4 2011-05-10 15:20:36.292054317 -0400 -@@ -27,10 +27,7 @@ if test "$PHP_FACEDETECT" != "no"; then - AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/cv.h], [], AC_MSG_ERROR('opencv/cv.h' header not found)) - AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/highgui.h], [], AC_MSG_ERROR('opencv/highgui.h' header not found)) - -- PHP_ADD_LIBRARY_WITH_PATH(cv, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(cvaux, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(highgui, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(cxcore, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(opencv_objdetect, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) - - PHP_SUBST(FACEDETECT_SHARED_LIBADD) - AC_DEFINE(HAVE_FACEDETECT, 1, [ ]) -diff -up facedetect/facedetect.c.BAD facedetect/facedetect.c ---- facedetect/facedetect.c.BAD 2011-05-10 15:15:04.603349547 -0400 -+++ facedetect/facedetect.c 2011-05-10 15:19:31.982886849 -0400 -@@ -18,6 +18,7 @@ - #include "config.h" - #endif - #include "php.h" -+#include - #include "php_facedetect.h" - - #include -@@ -102,7 +103,7 @@ static void php_facedetect(INTERNAL_FUNC - - storage = cvCreateMemStorage(0); - -- faces = cvHaarDetectObjects(gray, cascade, storage, 1.1, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(0, 0)); -+ faces = cvHaarDetectObjects(gray, cascade, storage, 1.1, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(0, 0), cvSize(0, 0)); - - if(return_type) { - diff --git a/facedetect-dso-link-workaround.patch b/facedetect-dso-link-workaround.patch deleted file mode 100644 index 715c5ae..0000000 --- a/facedetect-dso-link-workaround.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff -ruN facedetect.orig/config.m4 facedetect/config.m4 ---- facedetect.orig/config.m4 2010-03-15 02:07:12.000000000 +0200 -+++ facedetect/config.m4 2011-01-11 13:03:47.794020008 +0200 -@@ -25,20 +25,12 @@ - PHP_ADD_INCLUDE($FACEDETECT_DIR/include) - - AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/cv.h], [], AC_MSG_ERROR('opencv/cv.h' header not found)) -- AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/cvver.h], [], AC_MSG_ERROR('opencv/cvver.h' header not found)) - AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/highgui.h], [], AC_MSG_ERROR('opencv/highgui.h' header not found)) - -- PHP_CHECK_LIBRARY(cv, cvLoad, -- [ -- PHP_ADD_LIBRARY_WITH_PATH(cv, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(cvaux, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(highgui, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(cxcore, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -- AC_DEFINE(HAVE_FACEDETECT, 1, [ ]) -- ],[ -- AC_MSG_ERROR([wrong OpenCV version or OpenCV not found]) -- ],[ -- ]) -+ PHP_ADD_LIBRARY_WITH_PATH(cv, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(cvaux, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(highgui, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(cxcore, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD) - - PHP_SUBST(FACEDETECT_SHARED_LIBADD) - AC_DEFINE(HAVE_FACEDETECT, 1, [ ]) -diff -ruN facedetect.orig/facedetect.c facedetect/facedetect.c ---- facedetect.orig/facedetect.c 2010-03-15 02:07:12.000000000 +0200 -+++ facedetect/facedetect.c 2011-01-11 13:03:09.466030640 +0200 -@@ -21,7 +21,6 @@ - #include "php_facedetect.h" - - #include --#include - #include - - /* {{{ facedetect_functions[] -@@ -66,7 +65,6 @@ - php_info_print_table_start(); - php_info_print_table_row(2, "facedetect support", "enabled"); - php_info_print_table_row(2, "facedetect version", PHP_FACEDETECT_VERSION); -- php_info_print_table_row(2, "OpenCV version", CV_VERSION); - php_info_print_table_end(); - } - /* }}} */ diff --git a/facedetect-php54.patch b/facedetect-php54.patch deleted file mode 100644 index 62730ed..0000000 --- a/facedetect-php54.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up facedetect/facedetect.c.php54 facedetect/facedetect.c ---- facedetect/facedetect.c.php54 2011-12-28 16:07:45.167341320 +0100 -+++ facedetect/facedetect.c 2011-12-28 16:08:01.979341725 +0100 -@@ -28,7 +28,7 @@ - * - * Every user visible function must have an entry in facedetect_functions[]. - */ --static function_entry facedetect_functions[] = { -+static zend_function_entry facedetect_functions[] = { - PHP_FE(face_detect, NULL) - PHP_FE(face_count, NULL) - {NULL, NULL, NULL} diff --git a/php-facedetect.spec b/php-facedetect.spec index c675b3d..f2d2030 100644 --- a/php-facedetect.spec +++ b/php-facedetect.spec @@ -6,19 +6,15 @@ %endif Name: php-facedetect -Version: 1.0.1 -Release: 15%{?dist} +Version: 1.1.0 +Release: 1%{?dist} Summary: PHP extension to access the OpenCV library Group: Development/Languages -License: PHP +License: BSD URL: http://www.xarg.org/project/php-facedetect/ -Source0: http://www.xarg.org/download/facedetect-%{version}.tar.gz -# patch to work around DSOlinkage issues introduced in F-13 -Patch1: facedetect-dso-link-workaround.patch -# Fix code to work with opencv 2.2.0 -Patch2: facedetect-1.0.1-opencv-2.2.0.patch -# https://github.com/infusion/PHP-Facedetect/pull/5 -Patch3: facedetect-php54.patch +Source0: https://github.com/infusion/PHP-Facedetect/archive/v%{version}/facedetect-%{version}.tar.gz +Patch4: v1.1.0...f1c9d0f_part1.diff +Patch5: v1.1.0...f1c9d0f_part2.diff BuildRequires: php-devel opencv-devel >= 2.2.0 Requires: opencv Requires: php(zend-abi) = %{php_zend_api} @@ -41,10 +37,11 @@ of their coordinates. %prep -%setup -q -n facedetect -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -b .php54 +%setup -q -n PHP-Facedetect-%{version} +%patch4 -p1 -b .license +%if 0%{?fedora} >= 25 +%patch5 -p1 -b .opencv3 +%endif %{__cat} <<'EOF' >%{ini_name} extension=facedetect.so @@ -69,10 +66,19 @@ php --no-php-ini \ %files %doc CREDITS +%license LICENSE %config(noreplace) %{_sysconfdir}/php.d/%{ini_name} %{php_extdir}/facedetect.so %changelog +* Sat May 07 2016 Sérgio Basto - 1.1.0-1 +- Update php-facedetect to 1.1.0 +- Drop patch 3 is upstreamed. +- Drop patch 1 and 2 looks like that is fixed. +- Add last 8 commits from GIT upstream (change license and add opencv3 support + which drop opencv2 support so we need just apply part2 when we have opencv3 + in buildroot) + * Thu Feb 04 2016 Fedora Release Engineering - 1.0.1-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 877f613..c3014c3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7b566742020e54bc5938d766f698001a facedetect-1.0.1.tar.gz +4ce5e01bf0933957b37f0d0c5735393a facedetect-1.1.0.tar.gz diff --git a/v1.1.0...f1c9d0f_part1.diff b/v1.1.0...f1c9d0f_part1.diff new file mode 100644 index 0000000..f70b7f6 --- /dev/null +++ b/v1.1.0...f1c9d0f_part1.diff @@ -0,0 +1,83 @@ +diff --git a/LICENSE b/LICENSE +new file mode 100644 +index 0000000..d8662fc +--- /dev/null ++++ b/LICENSE +@@ -0,0 +1,24 @@ ++Copyright (c) 2009, Robert Eisele ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/facedetect.c b/facedetect.c +index ab49c9d..6bc73f6 100644 +--- a/facedetect.c ++++ b/facedetect.c +@@ -2,21 +2,18 @@ + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | ++ | This source file is subject to BSD 3-Clause license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | ++ | http://opensource.org/licenses/BSD-3-Clause. | ++ | If you did not receive a copy of the BSD license and are unable to | + | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | ++ | robert@xarg.org so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Robert Eisele | + +----------------------------------------------------------------------+ + */ +-// http://www.santyago.pl/files/facedetect-1.0.1-opencv-2.2.0.patch +-// - face recog lib embedden http://libface.sourceforge.net/file/Examples.html +-// - http://www.cognotics.com/opencv/servo_2007_series/part_5/index.html +-// - opencv 2.2 kompatibel ++ + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif +diff --git a/php_facedetect.h b/php_facedetect.h +index 171006e..95d598d 100644 +--- a/php_facedetect.h ++++ b/php_facedetect.h +@@ -2,13 +2,13 @@ + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | ++ | This source file is subject to BSD 3-Clause license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | ++ | http://opensource.org/licenses/BSD-3-Clause. | ++ | If you did not receive a copy of the BSD license and are unable to | + | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | ++ | robert@xarg.org so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Robert Eisele | + +----------------------------------------------------------------------+ diff --git a/v1.1.0...f1c9d0f_part2.diff b/v1.1.0...f1c9d0f_part2.diff new file mode 100644 index 0000000..bda5979 --- /dev/null +++ b/v1.1.0...f1c9d0f_part2.diff @@ -0,0 +1,127 @@ +diff --git a/README.md b/README.md +new file mode 100644 +index 0000000..c34e086 +--- /dev/null ++++ b/README.md +@@ -0,0 +1,4 @@ ++# PHP-Facedetect ++A simple OpenCV wrapper for PHP to detect faces on images ++ ++OpenCV 3 Support +diff --git a/config.m4 b/config.m4 +index 1b58b07..2e6ffd7 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -2,7 +2,7 @@ PHP_ARG_WITH(facedetect, for facedetect support, [ --with-facedetect Enable + + if test "$PHP_FACEDETECT" != "no"; then + SEARCH_PATH="/usr/local /usr /opt/local" +- SEARCH_FOR="/include/opencv/cv.h" ++ SEARCH_FOR="/include/opencv2/core/core_c.h" + + if test -r $PHP_FACEDETECT/$SEARCH_FOR; then + FACEDETECT_DIR=$PHP_FACEDETECT +@@ -24,8 +24,10 @@ if test "$PHP_FACEDETECT" != "no"; then + + PHP_ADD_INCLUDE($FACEDETECT_DIR/include) + +- AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/cv.h], [], AC_MSG_ERROR('opencv/cv.h' header not found)) +- AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv/highgui.h], [], AC_MSG_ERROR('opencv/highgui.h' header not found)) ++ AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/core/core_c.h], [], AC_MSG_ERROR('opencv/core/core_c.h' header not found)) ++ AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/imgproc/imgproc_c.h], [], AC_MSG_ERROR('opencv/imgproc/imgproc_c.h' header not found)) ++ AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/photo/photo_c.h], [], AC_MSG_ERROR('opencv/photo/photo_c.h' header not found)) ++ AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/objdetect/objdetect_c.h], [], AC_MSG_ERROR('opencv/objdetect/objdetect_c.h' header not found)) + + PHP_CHECK_LIBRARY(opencv_core, cvLoad, + [ +@@ -37,7 +39,7 @@ if test "$PHP_FACEDETECT" != "no"; then + ],[ + AC_MSG_ERROR([Wrong OpenCV version or OpenCV not found]) + ],[ +- ]), ++ ]) + ],[ + AC_MSG_ERROR([wrong OpenCV version or OpenCV not found]) + ],[ +diff --git a/config.w32 b/config.w32 +index 1a79f55..78306d1 100644 +--- a/config.w32 ++++ b/config.w32 +@@ -8,7 +8,7 @@ if (PHP_FACEDETECT == "yes") { + CHECK_LIB("opencv_core*.lib", "facedetect", PHP_FACEDETECT) && + CHECK_LIB("opencv_imgproc*.lib", "facedetect", PHP_FACEDETECT) && + CHECK_LIB("opencv_highgui*.lib", "facedetect", PHP_FACEDETECT) && +- CHECK_HEADER_ADD_INCLUDE("opencv/cv.h", "CFLAGS_FFACEDETECT")) { ++ CHECK_HEADER_ADD_INCLUDE("opencv2/core/core_c.h", "CFLAGS_FFACEDETECT")) { + + AC_DEFINE("HAVE_FACEDETECT", 1); + +diff --git a/facedetect.c b/facedetect.c +index ab49c9d..6bc73f6 100644 +--- a/facedetect.c ++++ b/facedetect.c +@@ -24,8 +21,12 @@ + #include "ext/standard/info.h" + #include "php_facedetect.h" + +-#include +-#include ++#include "opencv2/core/core_c.h" ++#include "opencv2/imgproc/imgproc_c.h" ++#include "opencv2/photo/photo_c.h" ++#include "opencv2/objdetect/objdetect_c.h" ++ ++#include "opencv2/core/version.hpp" + + /* {{{ facedetect_functions[] + * +@@ -74,12 +75,19 @@ PHP_MINFO_FUNCTION(facedetect) + } + /* }}} */ + ++IplImage* cvLoadImage(char *file, int number); ++ + static void php_facedetect(INTERNAL_FUNCTION_PARAMETERS, int return_type) + { + char *file, *casc; + long flen, clen; + ++#ifdef ZEND_ENGINE_3 ++ zval array; ++#else + zval *array; ++#endif ++ zval *pArray; + + CvHaarClassifierCascade* cascade; + IplImage *img, *gray; +@@ -116,17 +124,23 @@ static void php_facedetect(INTERNAL_FUNCTION_PARAMETERS, int return_type) + if(faces && faces->total > 0) { + int i; + for(i = 0; i < faces->total; i++) { ++#ifdef ZEND_ENGINE_3 ++ ZVAL_NEW_ARR(&array); ++ pArray = &array; ++#else + MAKE_STD_ZVAL(array); +- array_init(array); ++ pArray = array; ++#endif ++ array_init(pArray); + + rect = (CvRect *)cvGetSeqElem(faces, i); + +- add_assoc_long(array, "x", rect->x); +- add_assoc_long(array, "y", rect->y); +- add_assoc_long(array, "w", rect->width); +- add_assoc_long(array, "h", rect->height); ++ add_assoc_long(pArray, "x", rect->x); ++ add_assoc_long(pArray, "y", rect->y); ++ add_assoc_long(pArray, "w", rect->width); ++ add_assoc_long(pArray, "h", rect->height); + +- add_next_index_zval(return_value, array); ++ add_next_index_zval(return_value, pArray); + } + } + } else {