summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-07-06 07:31:31 +0200
committerRemi Collet <remi@remirepo.net>2020-07-06 07:31:31 +0200
commit31f228704d37774d18a96b4f2cf010ea91a59823 (patch)
tree7c8ea244c633d22a8bc3b03353d3ef53629f355b
parent05698f70edcd3106021425ac36023964e527e72e (diff)
update to 1.0.1
drop patches merged upstream
-rw-r--r--27.patch35
-rw-r--r--29.patch181
-rw-r--r--REFLECTION32
-rw-r--r--php-pdlib.spec17
4 files changed, 22 insertions, 243 deletions
diff --git a/27.patch b/27.patch
deleted file mode 100644
index 495aecc..0000000
--- a/27.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From b70ff4eb17468da206745e890f479eee7522bc63 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Mon, 22 Jun 2020 11:20:55 +0200
-Subject: [PATCH] display extension and library version in phpinfo
-
----
- pdlib.cc | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/pdlib.cc b/pdlib.cc
-index 76bf514..c1db7e4 100644
---- a/pdlib.cc
-+++ b/pdlib.cc
-@@ -33,6 +33,7 @@ extern "C" {
- #include "src/face_recognition.h"
- #include "src/cnn_face_detection.h"
- #include "src/face_landmark_detection.h"
-+#include <dlib/revision.h>
-
- /* If you declare any globals in php_pdlib.h uncomment this:
- ZEND_DECLARE_MODULE_GLOBALS(pdlib)
-@@ -245,8 +246,13 @@ PHP_RSHUTDOWN_FUNCTION(pdlib)
- */
- PHP_MINFO_FUNCTION(pdlib)
- {
-+ char buf[32];
-+
- php_info_print_table_start();
- php_info_print_table_header(2, "pdlib support", "enabled");
-+ php_info_print_table_row(2, "pdlib extension version", PHP_PDLIB_VERSION);
-+ snprintf(buf, sizeof(buf), "%d.%d.%d", DLIB_MAJOR_VERSION, DLIB_MINOR_VERSION, DLIB_PATCH_VERSION);
-+ php_info_print_table_row(2, "dlib library version", buf);
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
diff --git a/29.patch b/29.patch
deleted file mode 100644
index fb4103c..0000000
--- a/29.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From ba797b3c50e3746649cdd39f17a4f875227dff15 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Mon, 22 Jun 2020 12:46:30 +0200
-Subject: [PATCH 1/3] hounours system CXXFLAGS
-
----
- config.m4 | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/config.m4 b/config.m4
-index 5b3872c..d51d38e 100644
---- a/config.m4
-+++ b/config.m4
-@@ -18,8 +18,6 @@ dnl Make sure that the comment is aligned:
- [ --with-pdlib Include pdlib support])
-
- if test "$PHP_PDLIB" != "no"; then
-- dnl using C++11
-- CXXFLAGS="-std=c++11"
- PHP_REQUIRE_CXX()
- PHP_ADD_LIBRARY(stdc++, 1, PDLIB_SHARED_LIBADD)
- PHP_SUBST(PDLIB_SHARED_LIBADD)
-@@ -49,5 +47,6 @@ if test "$PHP_PDLIB" != "no"; then
- PHP_EVAL_LIBLINE($LIBDLIB_LIBDIR, PDLIB_SHARED_LIBADD)
- PHP_EVAL_INCLINE($LIBDLIB_CFLAGS)
-
-- PHP_NEW_EXTENSION(pdlib, $pdlib_src_files, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, cxx)
-+ dnl using C++11
-+ PHP_NEW_EXTENSION(pdlib, $pdlib_src_files, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++11, cxx)
- fi
-
-From 8f424195e0ca1bd27c5d711f74d9357cd4a1a4bc Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Mon, 22 Jun 2020 12:47:43 +0200
-Subject: [PATCH 2/3] fix unused variables
-
----
- pdlib.cc | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/pdlib.cc b/pdlib.cc
-index 76bf514..b2afe4c 100644
---- a/pdlib.cc
-+++ b/pdlib.cc
-@@ -38,9 +38,6 @@ extern "C" {
- ZEND_DECLARE_MODULE_GLOBALS(pdlib)
- */
-
--/* True global resources - no need for thread safety here */
--static int le_pdlib;
--
- static zend_class_entry *cnn_face_detection_ce = nullptr;
- static zend_object_handlers cnn_face_detection_obj_handlers;
-
-@@ -70,7 +67,7 @@ PHP_INI_END()
- PHP_FUNCTION(confirm_pdlib_compiled)
- {
- char *arg = NULL;
-- size_t arg_len, len;
-+ size_t arg_len;
- zend_string *strg;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
-
-From 912ab43641cb0d9530f2e501358c48e9fe1cf608 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Mon, 22 Jun 2020 12:54:12 +0200
-Subject: [PATCH 3/3] fix [-Werror=format-security]
-
----
- src/chinese_whispers.cc | 2 +-
- src/cnn_face_detection.cc | 5 ++---
- src/face_landmark_detection.cc | 8 ++++----
- src/face_recognition.cc | 4 ++--
- 4 files changed, 9 insertions(+), 10 deletions(-)
-
-diff --git a/src/chinese_whispers.cc b/src/chinese_whispers.cc
-index 026ef13..0653f9b 100644
---- a/src/chinese_whispers.cc
-+++ b/src/chinese_whispers.cc
-@@ -97,7 +97,7 @@ PHP_FUNCTION(dlib_chinese_whispers)
- }
- } catch (exception& e)
- {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-diff --git a/src/cnn_face_detection.cc b/src/cnn_face_detection.cc
-index 83ea66f..a989e80 100644
---- a/src/cnn_face_detection.cc
-+++ b/src/cnn_face_detection.cc
-@@ -42,7 +42,7 @@ PHP_METHOD(CnnFaceDetection, __construct)
- deserialize(cnn_face_detection_model_path) >> *pnet;
- cfd->net = pnet;
- } catch (exception& e) {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-@@ -77,7 +77,6 @@ PHP_METHOD(CnnFaceDetection, detect)
-
- net_type *pnet = cfd->net;
- auto dets = (*pnet)(img);
-- int rect_count = 0;
- array_init(return_value);
-
- // Scale the detection locations back to the original image size
-@@ -101,7 +100,7 @@ PHP_METHOD(CnnFaceDetection, detect)
- }
- catch (exception& e)
- {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-diff --git a/src/face_landmark_detection.cc b/src/face_landmark_detection.cc
-index 8336964..51139f6 100644
---- a/src/face_landmark_detection.cc
-+++ b/src/face_landmark_detection.cc
-@@ -52,7 +52,7 @@ PHP_FUNCTION(dlib_face_landmark_detection)
-
- zval ARRAY_NAME_WITH_INDEX(face, j);
- array_init(&ARRAY_NAME_WITH_INDEX(face, j));
-- for (int k = 0; k < shape.num_parts(); k++) {
-+ for (unsigned int k = 0; k < shape.num_parts(); k++) {
- zval ARRAY_NAME_WITH_INDEX(part, k);
- array_init(&ARRAY_NAME_WITH_INDEX(part, k));
- dlib::point p = shape.part(k);
-@@ -95,7 +95,7 @@ PHP_METHOD(FaceLandmarkDetection, __construct)
- fld->sp = new shape_predictor;
- deserialize(shape_predictor_file_path) >> *(fld->sp);
- } catch (exception& e) {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-@@ -151,7 +151,7 @@ PHP_METHOD(FaceLandmarkDetection, detect)
- array_init(&rect_arr);
- array_init(&parts_arr);
-
-- for (int i = 0; i < shape.num_parts(); i++) {
-+ for (unsigned int i = 0; i < shape.num_parts(); i++) {
- zval part;
- array_init(&part);
- dlib::point p = shape.part(i);
-@@ -169,7 +169,7 @@ PHP_METHOD(FaceLandmarkDetection, detect)
- add_assoc_zval(return_value, "rect", &rect_arr);
- add_assoc_zval(return_value, "parts", &parts_arr);
- } catch (exception& e) {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-diff --git a/src/face_recognition.cc b/src/face_recognition.cc
-index 99a3d97..401e964 100644
---- a/src/face_recognition.cc
-+++ b/src/face_recognition.cc
-@@ -37,7 +37,7 @@ PHP_METHOD(FaceRecognition, __construct)
- fr->net = new anet_type;
- deserialize(face_recognition_model_path) >> *(fr->net);
- } catch (exception& e) {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
-@@ -183,7 +183,7 @@ PHP_METHOD(FaceRecognition, computeDescriptor)
- add_next_index_double(return_value, d);
- }
- } catch (exception& e) {
-- zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, e.what());
-+ zend_throw_exception_ex(zend_ce_exception, 0 TSRMLS_CC, "%s", e.what());
- return;
- }
- }
diff --git a/REFLECTION b/REFLECTION
index 01fa628..35124a3 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,26 +1,24 @@
Extension [ <persistent> extension #90 pdlib version 1.0.1 ] {
- Functions {
- Function [ <internal:pdlib> function confirm_pdlib_compiled ] {
- }
Function [ <internal:pdlib> function dlib_chinese_whispers ] {
- Parameters [1] {
- Parameter #0 [ <required> $edges ]
+ Parameter #0 [ <required> array $edges ]
}
}
Function [ <internal:pdlib> function dlib_face_detection ] {
- Parameters [2] {
- Parameter #0 [ <required> $img_path ]
- Parameter #1 [ <optional> $upsample_num ]
+ Parameter #0 [ <required> string $img_path ]
+ Parameter #1 [ <optional> int $upsample_num ]
}
}
Function [ <internal:pdlib> function dlib_face_landmark_detection ] {
- Parameters [2] {
- Parameter #0 [ <required> $shape_predictor_file_path ]
- Parameter #1 [ <optional> $img_path ]
+ Parameter #0 [ <required> string $shape_predictor_file_path ]
+ Parameter #1 [ <required> string $img_path ]
}
}
}
@@ -44,15 +42,15 @@ Extension [ <persistent> extension #90 pdlib version 1.0.1 ] {
Method [ <internal:pdlib, ctor> public method __construct ] {
- Parameters [1] {
- Parameter #0 [ <required> $cnn_face_detection_model_path ]
+ Parameter #0 [ <required> string $cnn_face_detection_model_path ]
}
}
Method [ <internal:pdlib> public method detect ] {
- Parameters [2] {
- Parameter #0 [ <required> $img_path ]
- Parameter #1 [ <required> $upsample_num ]
+ Parameter #0 [ <required> string $img_path ]
+ Parameter #1 [ <optional> int $upsample_num ]
}
}
}
@@ -76,15 +74,15 @@ Extension [ <persistent> extension #90 pdlib version 1.0.1 ] {
Method [ <internal:pdlib, ctor> public method __construct ] {
- Parameters [1] {
- Parameter #0 [ <required> $shape_predictor_file_path ]
+ Parameter #0 [ <required> string $shape_predictor_file_path ]
}
}
Method [ <internal:pdlib> public method detect ] {
- Parameters [2] {
- Parameter #0 [ <required> $img_path ]
- Parameter #1 [ <required> $bounding_box ]
+ Parameter #0 [ <required> string $img_path ]
+ Parameter #1 [ <required> array $bounding_box ]
}
}
}
@@ -108,16 +106,16 @@ Extension [ <persistent> extension #90 pdlib version 1.0.1 ] {
Method [ <internal:pdlib, ctor> public method __construct ] {
- Parameters [1] {
- Parameter #0 [ <required> $face_recognition_model_path ]
+ Parameter #0 [ <required> string $face_recognition_model_path ]
}
}
Method [ <internal:pdlib> public method computeDescriptor ] {
- Parameters [3] {
- Parameter #0 [ <required> $img_path ]
- Parameter #1 [ <required> $landmarks ]
- Parameter #2 [ <required> $num_jitters ]
+ Parameter #0 [ <required> string $img_path ]
+ Parameter #1 [ <required> array $landmarks ]
+ Parameter #2 [ <optional> int $num_jitters ]
}
}
}
diff --git a/php-pdlib.spec b/php-pdlib.spec
index eda6711..0f8f6e9 100644
--- a/php-pdlib.spec
+++ b/php-pdlib.spec
@@ -13,12 +13,11 @@
%global pkg_name %{name}
%endif
-# use master, see https://github.com/goodspb/pdlib/issues/28
-%global gh_commit 45c0b7441aa1f4348996d0f5ca55a2c8b072a381
+%global gh_commit c7d57a7a1b12865096e98c08e6eb2b6daed1dc52
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner goodspb
%global gh_project pdlib
-%global gh_date 20200620
+#global gh_date 20200620
%global pecl_name pdlib
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global ini_name 40-%{pecl_name}.ini
@@ -37,7 +36,7 @@ BuildRequires: devtoolset-7-toolchain
Summary: A PHP extension for Dlib
Name: %{?sub_prefix}php-%{pecl_name}
-Version: 1.0
+Version: 1.0.1
%if 0%{?gh_date:1}
Release: 1.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%else
@@ -47,9 +46,6 @@ License: MIT
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
-Patch0: https://patch-diff.githubusercontent.com/raw/goodspb/pdlib/pull/27.patch
-Patch1: https://patch-diff.githubusercontent.com/raw/goodspb/pdlib/pull/29.patch
-
BuildRequires: %{?scl_prefix}php-devel > 7
BuildRequires: dlib-devel
@@ -91,9 +87,6 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
mv %{gh_project}-%{gh_commit} NTS
cd NTS
-%patch0 -p1 -b .pr27
-%patch1 -p1 -b .pr29
-
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_PDLIB_VERSION/{s/.* "//;s/".*$//;p}' php_pdlib.h)
if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then
@@ -196,6 +189,10 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \
%changelog
+* Mon Jul 6 2020 Remi Collet <remi@remirepo.net> - 1.0.1-1
+- update to 1.0.1
+- drop patches merged upstream
+
* Mon Jun 22 2020 Remi Collet <remi@remirepo.net> - 1.0-1.20200620git45c0b74
- new package
- open https://github.com/goodspb/pdlib/pull/25 fix linker command