From 795b1254d8fb4629d2ab99fc8ac382401cdefa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Sat, 7 May 2016 03:38:20 +0100 Subject: [PATCH] Remove SIFT/SURF from source tarball in opencv_contrib, due to legal concerns - Redo and readd OpenCV-2.4.4-pillow.patch . - Add OpenCV-3.1-pillow.patch to apply only opencv_contrib . - Add the %python_provide macro (Packaging:Python guidelines). --- .gitignore | 1 + OpenCV-2.4.4-pillow.patch | 13 ------------- OpenCV-3.1-pillow.patch | 13 +++++++++++++ opencv-2.4.9-ts_static.patch | 9 ++++----- opencv.spec | 33 +++++++++++++++++++++++---------- sources | 2 +- 6 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 OpenCV-3.1-pillow.patch diff --git a/.gitignore b/.gitignore index ff52b56..6be60dc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ OpenCV-2.1.0.tar.bz2 /opencv-clean-2.4.12.3.tar.xz /opencv_contrib-3.1.0.tar.gz /opencv-3.1.0.tar.gz +/opencv_contrib-clean-3.1.0.tar.gz diff --git a/OpenCV-2.4.4-pillow.patch b/OpenCV-2.4.4-pillow.patch index 33c07ad..3630b95 100644 --- a/OpenCV-2.4.4-pillow.patch +++ b/OpenCV-2.4.4-pillow.patch @@ -1,16 +1,3 @@ -diff -up OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py.pillow OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py ---- OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py.pillow 2013-01-28 00:00:47.000000000 +0100 -+++ OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py 2013-02-18 19:56:11.979405809 +0100 -@@ -31,7 +31,8 @@ - # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - # POSSIBILITY OF SUCH DAMAGE. - --import sys, math, Image -+import sys, math -+from PIL import Image - - def Distance(p1,p2): - dx = p2[0] - p1[0] diff -up OpenCV-2.4.4/modules/python/test/ticket_6.py.pillow OpenCV-2.4.4/modules/python/test/ticket_6.py --- OpenCV-2.4.4/modules/python/test/ticket_6.py.pillow 2013-01-28 00:00:48.000000000 +0100 +++ OpenCV-2.4.4/modules/python/test/ticket_6.py 2013-02-18 19:58:14.288877399 +0100 diff --git a/OpenCV-3.1-pillow.patch b/OpenCV-3.1-pillow.patch new file mode 100644 index 0000000..fcdf230 --- /dev/null +++ b/OpenCV-3.1-pillow.patch @@ -0,0 +1,13 @@ +diff -up OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py.pillow OpenCV-2.4.4/modules/contrib/doc/facerec/src/crop_face.py +--- ./modules/face/samples/etc/crop_face.py.pillow 2013-01-28 00:00:47.000000000 +0100 ++++ ./modules/face/samples/etc/crop_face.py 2013-02-18 19:56:11.979405809 +0100 +@@ -31,7 +31,8 @@ + # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + # POSSIBILITY OF SUCH DAMAGE. + +-import sys, math, Image ++import sys, math ++from PIL import Image + + def Distance(p1,p2): + dx = p2[0] - p1[0] diff --git a/opencv-2.4.9-ts_static.patch b/opencv-2.4.9-ts_static.patch index f1b1c81..7ee18a9 100644 --- a/opencv-2.4.9-ts_static.patch +++ b/opencv-2.4.9-ts_static.patch @@ -1,7 +1,6 @@ -diff -up opencv-2.4.9/modules/ts/CMakeLists.txt.ts_static opencv-2.4.9/modules/ts/CMakeLists.txt ---- opencv-2.4.9/modules/ts/CMakeLists.txt.ts_static 2014-04-11 05:15:26.000000000 -0500 -+++ opencv-2.4.9/modules/ts/CMakeLists.txt 2014-06-29 12:49:29.473910506 -0500 -@@ -4,7 +4,7 @@ if(IOS) +--- ./modules/ts/CMakeLists.txt.orig 2015-12-18 15:02:16.000000000 +0000 ++++ ./modules/ts/CMakeLists.txt 2016-05-06 06:15:36.157614551 +0100 +@@ -4,7 +4,7 @@ if(NOT BUILD_opencv_ts AND NOT BUILD_TES ocv_module_disable(ts) endif() @@ -9,4 +8,4 @@ diff -up opencv-2.4.9/modules/ts/CMakeLists.txt.ts_static opencv-2.4.9/modules/t +#set(OPENCV_MODULE_TYPE STATIC) set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE) - ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) + if(WINRT) diff --git a/opencv.spec b/opencv.spec index 31a2724..c4cd333 100644 --- a/opencv.spec +++ b/opencv.spec @@ -18,21 +18,25 @@ Group: Development/Libraries # This is normal three clause BSD. License: BSD URL: http://opencv.org -# Need to remove SIFT/SURF from source tarball, due to legal concerns -# No more sift.cpp or surf.cpp in source tarball. -# Removed because we don't use pre-built contribs -# rm -rf 3rdparty #Source0: %{version}.zip Source0: https://github.com/Itseez/opencv/archive/%{version}/opencv-%{version}.tar.gz -Source1: opencv-samples-Makefile -Source2: https://github.com/Itseez/opencv_contrib/archive/%{version}/opencv_contrib-%{version}.tar.gz +#Source1: opencv-samples-Makefile +# +# Need to remove SIFT/SURF from source tarball, due to legal concerns +# export VERSION=3.1.0 +# cd opencv_contrib-${VERSION}/ +# rm -rf modules/xfeatures2d/ +# cd ..; tar zcf opencv_contrib-clean-${VERSION}.tar.gz opencv_contrib-${VERSION}/ +Source2: opencv_contrib-clean-%{version}.tar.gz +#Source2: https://github.com/Itseez/opencv_contrib/archive/%%{version}/opencv_contrib-%%{version}.tar.gz #http://code.opencv.org/issues/2720 -#Patch2: OpenCV-2.4.4-pillow.patch +Patch2: OpenCV-2.4.4-pillow.patch #Patch3: opencv-2.4.9-ts_static.patch # fix/simplify cmake config install location (upstreamable) # https://bugzilla.redhat.com/1031312 Patch4: opencv-2.4.7-cmake_paths.patch Patch5: opencv-3.1.0-cmake_example.patch +Patch6: OpenCV-3.1-pillow.patch BuildRequires: libtool BuildRequires: cmake >= 2.6.3 @@ -143,6 +147,7 @@ Summary: Python bindings for apps which use OpenCV Group: Development/Libraries Requires: opencv%{_isa} = %{version}-%{release} Requires: numpy +%{?python_provide:%python_provide python2-%{srcname}} %description python This package contains Python bindings for the OpenCV library. @@ -152,6 +157,7 @@ Summary: Python3 bindings for apps which use OpenCV Group: Development/Libraries Requires: opencv%{_isa} = %{version}-%{release} Requires: numpy +%{?python_provide:%python_provide python3-%{srcname}} %description python3 This package contains Python3 bindings for the OpenCV library. @@ -172,10 +178,14 @@ to provide decent performance and stability. %setup -q -a2 # we don't use pre-built contribs rm -rf 3rdparty/ -#patch2 -p1 -b .pillow +%patch2 -p1 -b .pillow +#patch3 breaks build, need investigation #patch3 -p1 -b .ts_static %patch4 -p1 -b .cmake_paths %patch5 -p1 -b .cmake_example +pushd opencv_contrib-%{version} +%patch6 -p1 -b .pillow +popd # fix dos end of lines #sed -i 's|\r||g' samples/c/adaptiveskindetector.cpp @@ -340,15 +350,18 @@ popd %{_libdir}/libopencv_surface_matching.so.3.1* %{_libdir}/libopencv_text.so.3.1* %{_libdir}/libopencv_tracking.so.3.1* -%{_libdir}/libopencv_xfeatures2d.so.3.1* %{_libdir}/libopencv_ximgproc.so.3.1* %{_libdir}/libopencv_xobjdetect.so.3.1* %{_libdir}/libopencv_xphoto.so.3.1* %changelog -* Wed May 04 2016 Sérgio Basto - 3.1.0-4 +* Sat May 07 2016 Sérgio Basto - 3.1.0-4 - Put all idefs and ifarchs outside the scope of rpm conditional builds, rather than vice versa, as had organized some time ago, it seems to me more correct. +- Remove SIFT/SURF from source tarball in opencv_contrib, due to legal concerns +- Redo and readd OpenCV-2.4.4-pillow.patch . +- Add OpenCV-3.1-pillow.patch to apply only opencv_contrib . +- Add the %python_provide macro (Packaging:Python guidelines). * Fri Apr 22 2016 Sérgio Basto - 3.1.0-3 - Use always ON and OFF instead 0 and 1 in cmake command. diff --git a/sources b/sources index 8fc69c3..35f7a43 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -a822839ad3ab79ff837c16785ea9dd10 opencv_contrib-3.1.0.tar.gz 70e1dd07f0aa06606f1bc0e3fa15abd3 opencv-3.1.0.tar.gz +1ee4a56c13393f196ae7d8600c724a8d opencv_contrib-clean-3.1.0.tar.gz