From 65c4dc9575e6e83f29d88e857162747eb64abc61 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 25 Jun 2010 16:50:54 +0000 Subject: [PATCH] - Move samples from main to -devel - Fix spurious permission - Add BR tbb-devel - Fix CFLAGS --- OpenCV-2.1-lapack.patch | 33 ++++++++++++++++ OpenCV-2.1-nointrernal.patch | 12 ++++++ OpenCV-2.1-rpath.patch | 12 ++++++ import.log | 1 + opencv.spec | 77 +++++++++++++++++++++++------------- 5 files changed, 107 insertions(+), 28 deletions(-) create mode 100644 OpenCV-2.1-lapack.patch create mode 100644 OpenCV-2.1-nointrernal.patch create mode 100644 OpenCV-2.1-rpath.patch diff --git a/OpenCV-2.1-lapack.patch b/OpenCV-2.1-lapack.patch new file mode 100644 index 0000000..b6d7a2a --- /dev/null +++ b/OpenCV-2.1-lapack.patch @@ -0,0 +1,33 @@ +diff -up OpenCV-2.1.0/CMakeLists.txt.lapack OpenCV-2.1.0/CMakeLists.txt +--- OpenCV-2.1.0/CMakeLists.txt.lapack 2010-06-25 15:59:47.000000000 +0200 ++++ OpenCV-2.1.0/CMakeLists.txt 2010-06-25 16:01:04.000000000 +0200 +@@ -839,7 +839,7 @@ IF(NOT BUILD_SHARED_LIBS) + set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++) + endif() + +- set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} flann zlib opencv_lapack) ++ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} flann z lapack) + endif() + + +diff -up OpenCV-2.1.0/src/cxcore/CMakeLists.txt.lapack OpenCV-2.1.0/src/cxcore/CMakeLists.txt +--- OpenCV-2.1.0/src/cxcore/CMakeLists.txt.lapack 2010-06-25 15:59:47.000000000 +0200 ++++ OpenCV-2.1.0/src/cxcore/CMakeLists.txt 2010-06-25 16:00:35.000000000 +0200 +@@ -53,7 +53,7 @@ set_target_properties(${the_target} PROP + ) + + # Add the required libraries for linking: +-target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} opencv_lapack zlib flann) ++target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} lapack z flann) + + # Linker flag needed for Windows Mobile 5 and 6 SDKs + if(MSVC) +@@ -67,7 +67,7 @@ if(MSVC) + ) + endif() + +-add_dependencies(${the_target} opencv_lapack zlib) ++add_dependencies(${the_target} lapack z) + + install(TARGETS ${the_target} + RUNTIME DESTINATION bin COMPONENT main diff --git a/OpenCV-2.1-nointrernal.patch b/OpenCV-2.1-nointrernal.patch new file mode 100644 index 0000000..88b0429 --- /dev/null +++ b/OpenCV-2.1-nointrernal.patch @@ -0,0 +1,12 @@ +diff -up OpenCV-2.1.0/3rdparty/CMakeLists.txt.nointernal OpenCV-2.1.0/3rdparty/CMakeLists.txt +--- OpenCV-2.1.0/3rdparty/CMakeLists.txt.nointernal 2010-04-06 03:24:34.000000000 +0200 ++++ OpenCV-2.1.0/3rdparty/CMakeLists.txt 2010-06-25 15:48:06.000000000 +0200 +@@ -1,6 +1,6 @@ + add_subdirectory(flann) +-add_subdirectory(lapack) +-add_subdirectory(zlib) ++#add_subdirectory(lapack) ++#add_subdirectory(zlib) + if(WITH_JASPER AND NOT JASPER_FOUND) + add_subdirectory(libjasper) + endif() diff --git a/OpenCV-2.1-rpath.patch b/OpenCV-2.1-rpath.patch new file mode 100644 index 0000000..b06e9ec --- /dev/null +++ b/OpenCV-2.1-rpath.patch @@ -0,0 +1,12 @@ +diff -up OpenCV-2.1.0/CMakeLists.txt.rpath OpenCV-2.1.0/CMakeLists.txt +--- OpenCV-2.1.0/CMakeLists.txt.rpath 2010-06-25 17:13:42.000000000 +0200 ++++ OpenCV-2.1.0/CMakeLists.txt 2010-06-25 17:13:55.000000000 +0200 +@@ -13,7 +13,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS tr + # Add these standard paths to the search paths for FIND_LIBRARY + # to find libraries from these locations first + if(UNIX) +- set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /usr/lib) ++ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib /lib64 /usr/lib /usr/lib64) + endif() + # it _must_ go before PROJECT(OpenCV) in order to work + if (NOT CMAKE_INSTALL_PREFIX) diff --git a/import.log b/import.log index 5a3994a..9e6b05b 100644 --- a/import.log +++ b/import.log @@ -1 +1,2 @@ opencv-2_1_0-1_fc11:HEAD:opencv-2.1.0-1.fc11.src.rpm:1273158513 +opencv-2_1_0-2_fc13:HEAD:opencv-2.1.0-2.fc13.src.rpm:1277484612 diff --git a/opencv.spec b/opencv.spec index 45c2616..a3f478e 100644 --- a/opencv.spec +++ b/opencv.spec @@ -4,7 +4,7 @@ Name: opencv Version: 2.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Collection of algorithms for computer vision Group: Development/Libraries @@ -15,10 +15,14 @@ Source0: http://prdownloads.sourceforge.net/opencvlibrary/%{tar_name}-%{v Source1: opencv-samples-Makefile # Fedora cmake macros define -DLIB_SUFFIX=64 on 64 bits platforms Patch0: opencv-cmake-libdir-2.1.0.patch +Patch1: OpenCV-2.1-nointrernal.patch +Patch2: OpenCV-2.1-lapack.patch +Patch3: OpenCV-2.1-rpath.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libtool BuildRequires: cmake >= 2.4 +BuildRequires: chrpath BuildRequires: gtk2-devel BuildRequires: imlib2-devel @@ -34,7 +38,8 @@ BuildRequires: lapack-devel BuildRequires: libpng-devel BuildRequires: libjpeg-devel BuildRequires: libtiff-devel -BuildRequires: libtool +BuildRequires: OpenEXR-devel +BuildRequires: tbb-devel BuildRequires: zlib-devel, pkgconfig BuildRequires: python-devel BuildRequires: python-imaging, numpy, swig >= 1.3.24 @@ -84,18 +89,37 @@ This package contains Python bindings for the OpenCV library. %prep %setup -q -n %{tar_name}-%{version} %patch0 -p1 +%patch1 -p1 -b .nointernal +%patch2 -p1 -b .lapack +%patch3 -p1 -b .rpath + +#Remove several bundled libraries. +rm -rf 3rdparty/lapack +rm -rf 3rdparty/zlib +rm -rf 3rdparty/libjasper +rm -rf 3rdparty/libpng +rm -rf 3rdparty/libjpeg +rm -rf 3rdparty/libtiff + +#Fix spurious perm: +find -perm 755 -name "*.cpp" -exec chmod -x {} ';' +find -perm 755 -name "*.c" -exec chmod -x {} ';' - -%build -%ifarch i386 -export CXXFLAGS="%{__global_cflags} -m32 -fasynchronous-unwind-tables" -%endif +# fix dos end of lines +sed -i 's|\r||g' samples/c/adaptiveskindetector.cpp +%build # enabled by default if libraries are presents at build time: # GTK, GSTREAMER, UNICAP, 1394, V4L # non available on Fedora: FFMPEG, XINE -%cmake -DENABLE_OPENMP=1\ +#BUILD_TEST is broken +%cmake -DENABLE_OPENMP=1 \ + -DUSE_O3=0 \ + -DUSE_FAST_MATH=0 \ + -DUSE_OMIT_FRAME_POINTER=0 \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTS=0 \ %{?_without_gstreamer:-DWITH_GSTREAMER=0} \ %{!?_with_ffmpeg:-DWITH_FFMPEG=0} \ %{!?_with_xine:-DWITH_XINE=0} \ @@ -103,6 +127,7 @@ export CXXFLAGS="%{__global_cflags} -m32 -fasynchronous-unwind-tables" -DINSTALL_C_EXAMPLES=1 \ -DINSTALL_PYTHON_EXAMPLES=1 \ . + make VERBOSE=1 %{?_smp_mflags} @@ -112,19 +137,13 @@ rm -rf $RPM_BUILD_ROOT __devel-doc make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" CPPROG="cp -p" find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' + rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/build_all.sh \ $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/cvsample.dsp \ $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/cvsample.vcproj \ $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/facedetect.cmd -install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/GNUmakefile -install -m644 cvconfig.h $RPM_BUILD_ROOT%{_includedir}/%{name}/cvconfig.h -mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/ -# install documentation -install -m644 doc/%{name}.pdf $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/%{name}.pdf -install -m644 doc/*.{htm,png,jpg} $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/ +install -pm644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/samples/c/GNUmakefile -# fix dos end of lines -sed -i 's|\r||g' $RPM_BUILD_ROOT/%{_datadir}/%{name}/samples/c/adaptiveskindetector.cpp # remove unnecessary documentation rm -rf $RPM_BUILD_ROOT%{_datadir}/opencv/{doc/,samples/octave/} @@ -133,16 +152,12 @@ chmod 0755 $RPM_BUILD_ROOT%{_datadir}/opencv/samples/python/*.py chmod 0755 $RPM_BUILD_ROOT%{python_sitearch}/cv.so chmod 0755 $RPM_BUILD_ROOT%{python_sitearch}/opencv/*.so -#Remove uneeded README.txt (howto install related) -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/opencv-%{version}/ -#Use appropriate _docdir -mkdir -p __devel-doc -cp -apR $RPM_BUILD_ROOT%{_datadir}/doc/opencv-doc-%{version}/ __devel-doc -rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/opencv-doc-%{version}/ - #This file is wrong - not redistributed rm -rf $RPM_BUILD_ROOT%{_datadir}/opencv/OpenCVConfig.cmake +# Remove Rpath in python shared objects: +find $RPM_BUILD_ROOT%{python_sitearch} -name "*.so" -exec chrpath -d {} ';' + %check @@ -168,6 +183,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/opencv_* %{_libdir}/lib*.so.* %dir %{_datadir}/opencv +%exclude %{_datadir}/opencv/samples %{_datadir}/opencv/haarcascades %{_datadir}/opencv/lbpcascades @@ -181,22 +197,27 @@ rm -rf $RPM_BUILD_ROOT %files devel-docs %defattr(-,root,root,-) -%doc __devel-doc/* -%{_datadir}/opencv/samples +%doc doc/%{name}.pdf +%doc doc/*.{htm,png,jpg} +%doc %{_datadir}/opencv/samples %files python %defattr(-,root,root,-) %{python_sitearch}/cv.so -%doc %dir %{_datadir}/opencv/samples -%doc %{_datadir}/opencv/samples/python # old SWIG wrappers %{python_sitearch}/opencv %changelog +* Fri Jun 25 2010 Nicolas Chauvet - 2.1.0-2 +- Move samples from main to -devel +- Fix spurious permission +- Add BR tbb-devel +- Fix CFLAGS + * Fri Apr 23 2010 Nicolas Chauvet - 2.1.0-1 - Update to 2.1.0 -- Update libdir patch +- Update libdir patch * Tue Apr 13 2010 Karel Klic - 2.0.0-10 - Fix nonstandard executable permissions