pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

graphics/opencv cmake patch for ffmpeg libraries



Hi again,

On OS X, the OpenCV build scripts look for static FFmpeg libraries.

The following patch adds a patch to the CMake build scripts so OpenCV
can build with either static or dynamic FFmpeg libraries.  I also
sent a pull request upstream based on their stable branch.

(It's very verbose, sorry, but is basically just one patch file and
the rest is lines numbers and checksums.)

Yours,
Mansour


Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/distinfo,v
retrieving revision 1.27
diff -u -p -u -r1.27 distinfo
--- distinfo	24 Jul 2014 17:16:02 -0000	1.27
+++ distinfo	1 Feb 2015 21:46:05 -0000
@@ -3,11 +3,12 @@ $NetBSD: distinfo,v 1.27 2014/07/24 17:1
 SHA1 (opencv-2.4.9.zip) = 4f5166e2bd22bd6167cb56dd04f2c6ed68148b2c
 RMD160 (opencv-2.4.9.zip) = 1b0b80ecb50270fa7e4b1dea6f075982b5d15d81
 Size (opencv-2.4.9.zip) = 91684751 bytes
-SHA1 (patch-modules_contrib_src_inputoutput.cpp) = dc3413182c94b670823d509ab38f21ce36d4f432
-SHA1 (patch-modules_contrib_src_spinimages.cpp) = b3e465700059616be991d597230bc8dc42f15be1
-SHA1 (patch-modules_core_include_opencv2_core_types_c.h) = c056068c01c417dc262f21c00324da7f86c0cd8e
-SHA1 (patch-modules_core_src_system.cpp) = 3b7ac545585a430d28c7077f360357079f127580
-SHA1 (patch-modules_flann_include_opencv2_flann_defines.h) = ab848e67c4e03219670598ac2d21071a617a5c33
-SHA1 (patch-modules_legacy_src_calibfilter.cpp) = a388e646cd0b09af1b9ad4844f1097855808f316
+SHA1 (patch-cmake_OpenCVFindLibsVideo.cmake) = f3153700f3197bbd62f582a4ebdc87ac098c4478
+SHA1 (patch-modules_contrib_src_inputoutput.cpp) = b50f57523acccb7d9e102cfb4ac981ef980101f3
+SHA1 (patch-modules_contrib_src_spinimages.cpp) = faa6d4f3fbb6ac2e1d55662884fae615207c583f
+SHA1 (patch-modules_core_include_opencv2_core_types_c.h) = 72a3a7feb72b9abffbd10a3c6a809a715bf7d9e8
+SHA1 (patch-modules_core_src_system.cpp) = 6025a7931a49c7e0f08474069f54f43c2b990699
+SHA1 (patch-modules_flann_include_opencv2_flann_defines.h) = f9a6b5c4ffb410b5c8d3ce476d5dbfbd7dae25e2
+SHA1 (patch-modules_legacy_src_calibfilter.cpp) = 91c5b84f58c52edc06bd17d02fcaf1e3ec813b6a
 SHA1 (patch-modules_ocl_src_gftt.cpp) = fe1107c1613881d050ec5a87fad12b916ac8b8fc
-SHA1 (patch-modules_ts_src_ts.cpp) = 61e4ab59f2ca57f75212743bf869616dfc9e5f13
+SHA1 (patch-modules_ts_src_ts.cpp) = bd68ec31a78392400362039596d89806e0976745
Index: patches/patch-cmake_OpenCVFindLibsVideo.cmake
===================================================================
RCS file: patches/patch-cmake_OpenCVFindLibsVideo.cmake
diff -N patches/patch-cmake_OpenCVFindLibsVideo.cmake
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-cmake_OpenCVFindLibsVideo.cmake	1 Feb 2015 21:46:05 -0000
@@ -0,0 +1,54 @@
+$NetBSD$
+
+Use the CMake find_library command to find the FFmpeg libraries.
+See: <https://github.com/Itseez/opencv/pull/3663>
+
+--- cmake/OpenCVFindLibsVideo.cmake.orig	2014-04-11 10:15:26.000000000 +0000
++++ cmake/OpenCVFindLibsVideo.cmake
+@@ -188,28 +188,27 @@ if(WITH_FFMPEG)
+     if(FFMPEG_INCLUDE_DIR)
+       set(HAVE_GENTOO_FFMPEG TRUE)
+       set(FFMPEG_LIB_DIR "${FFMPEG_INCLUDE_DIR}/../lib" CACHE PATH "Full path of FFMPEG library directory")
+-      if(EXISTS "${FFMPEG_LIB_DIR}/libavcodec.a")
+-        set(HAVE_FFMPEG_CODEC 1)
+-        set(ALIASOF_libavcodec_VERSION "Unknown")
+-        if(EXISTS "${FFMPEG_LIB_DIR}/libavformat.a")
+-          set(HAVE_FFMPEG_FORMAT 1)
+-          set(ALIASOF_libavformat_VERSION "Unknown")
+-          if(EXISTS "${FFMPEG_LIB_DIR}/libavutil.a")
+-            set(HAVE_FFMPEG_UTIL 1)
+-            set(ALIASOF_libavutil_VERSION "Unknown")
+-            if(EXISTS "${FFMPEG_LIB_DIR}/libswscale.a")
+-              set(HAVE_FFMPEG_SWSCALE 1)
+-              set(ALIASOF_libswscale_VERSION "Unknown")
+-              set(HAVE_FFMPEG 1)
+-            endif()
+-          endif()
+-        endif()
++      find_library(FFMPEG_CODEC_LIB
++                   NAMES "libavcodec.a" "libavcodec.dylib"
++                   PATHS "${FFMPEG_LIB_DIR}")
++      find_library(FFMPEG_FORMAT_LIB
++                   NAMES "libavformat.a" "libavformat.dylib"
++                   PATHS "${FFMPEG_LIB_DIR}")
++      find_library(FFMPEG_UTIL_LIB
++                   NAMES "libavutil.a" "libavutil.dylib"
++                   PATHS "${FFMPEG_LIB_DIR}")
++      find_library(FFMPEG_SWSCALE_LIB
++                   NAMES "libswscale.a" "libswscale.dylib"
++                   PATHS "${FFMPEG_LIB_DIR}")
++      if(FFMPEG_CODEC_LIB AND FFMPEG_FORMAT_LIB AND
++         FFMPEG_UTIL_LIB AND FFMPEG_SWSCALE_LIB)
++        set(HAVE_FFMPEG 1)
+       endif()
+     endif(FFMPEG_INCLUDE_DIR)
+     if(HAVE_FFMPEG)
+-      set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} "${FFMPEG_LIB_DIR}/libavcodec.a"
+-          "${FFMPEG_LIB_DIR}/libavformat.a" "${FFMPEG_LIB_DIR}/libavutil.a"
+-          "${FFMPEG_LIB_DIR}/libswscale.a")
++      set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES}
++          ${FFMPEG_CODEC_LIB} ${FFMPEG_FORMAT_LIB}
++          ${FFMPEG_UTIL_LIB} ${FFMPEG_SWSCALE_LIB})
+       ocv_include_directories(${FFMPEG_INCLUDE_DIR})
+     endif()
+   endif(APPLE)
Index: patches/patch-modules_contrib_src_inputoutput.cpp
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_contrib_src_inputoutput.cpp,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_contrib_src_inputoutput.cpp
--- patches/patch-modules_contrib_src_inputoutput.cpp	12 Jun 2013 10:13:58 -0000	1.1
+++ patches/patch-modules_contrib_src_inputoutput.cpp	1 Feb 2015 21:46:05 -0000
@@ -2,9 +2,9 @@ $NetBSD: patch-modules_contrib_src_input
 
 SunOS does not have dirent d_type.
 
---- modules/contrib/src/inputoutput.cpp.orig	2012-10-17 22:55:38.000000000 +0000
+--- modules/contrib/src/inputoutput.cpp.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/contrib/src/inputoutput.cpp
-@@ -5,6 +5,9 @@
+@@ -6,6 +6,9 @@
      #include <windows.h>
      #include <tchar.h>
  #else
@@ -14,7 +14,7 @@ SunOS does not have dirent d_type.
      #include <dirent.h>
  #endif
  
-@@ -47,6 +50,10 @@ namespace cv
+@@ -72,6 +75,10 @@ namespace cv
              (void)addPath;
              DIR *dp;
              struct dirent *dirp;
@@ -25,7 +25,7 @@ SunOS does not have dirent d_type.
              if((dp = opendir(path.c_str())) == NULL)
              {
                  return list;
-@@ -54,7 +61,13 @@ namespace cv
+@@ -79,7 +86,13 @@ namespace cv
  
              while ((dirp = readdir(dp)) != NULL)
              {
@@ -39,7 +39,7 @@ SunOS does not have dirent d_type.
                  {
                      if (exten.compare("*") == 0)
                          list.push_back(static_cast<std::string>(dirp->d_name));
-@@ -105,6 +118,10 @@ namespace cv
+@@ -162,6 +175,10 @@ namespace cv
              (void)addPath;
              DIR *dp;
              struct dirent *dirp;
@@ -50,7 +50,7 @@ SunOS does not have dirent d_type.
              if((dp = opendir(path_f.c_str())) == NULL)
              {
                  return list;
-@@ -112,7 +129,13 @@ namespace cv
+@@ -169,7 +186,13 @@ namespace cv
  
              while ((dirp = readdir(dp)) != NULL)
              {
Index: patches/patch-modules_contrib_src_spinimages.cpp
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_contrib_src_spinimages.cpp,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_contrib_src_spinimages.cpp
--- patches/patch-modules_contrib_src_spinimages.cpp	6 May 2013 14:48:22 -0000	1.1
+++ patches/patch-modules_contrib_src_spinimages.cpp	1 Feb 2015 21:46:05 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-modules_contrib_src_spinimages.cpp,v 1.1 2013/05/06 14:48:22 joerg Exp $
 
---- modules/contrib/src/spinimages.cpp.orig	2013-05-05 18:32:00.000000000 +0000
+--- modules/contrib/src/spinimages.cpp.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/contrib/src/spinimages.cpp
 @@ -46,6 +46,7 @@
  #include <functional>
Index: patches/patch-modules_core_include_opencv2_core_types_c.h
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_core_include_opencv2_core_types_c.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_core_include_opencv2_core_types_c.h
--- patches/patch-modules_core_include_opencv2_core_types_c.h	7 Dec 2012 21:37:10 -0000	1.1
+++ patches/patch-modules_core_include_opencv2_core_types_c.h	1 Feb 2015 21:46:05 -0000
@@ -2,9 +2,9 @@ $NetBSD: patch-modules_core_include_open
 
 Define 'depth' as unsigned int, or IPL_DEPTH_SIGN=0x8000000 won't fit in int.
 
---- modules/core/include/opencv2/core/types_c.h.orig	2012-12-07 21:15:58.000000000 +0000
+--- modules/core/include/opencv2/core/types_c.h.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/core/include/opencv2/core/types_c.h
-@@ -473,7 +473,7 @@ typedef struct _IplImage
+@@ -468,7 +468,7 @@ typedef struct _IplImage
      int  ID;                /* version (=0)*/
      int  nChannels;         /* Most of OpenCV functions support 1,2,3 or 4 channels */
      int  alphaChannel;      /* Ignored by OpenCV */
Index: patches/patch-modules_core_src_system.cpp
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_core_src_system.cpp,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_core_src_system.cpp
--- patches/patch-modules_core_src_system.cpp	29 Apr 2013 21:31:12 -0000	1.1
+++ patches/patch-modules_core_src_system.cpp	1 Feb 2015 21:46:05 -0000
@@ -1,8 +1,8 @@
 $NetBSD: patch-modules_core_src_system.cpp,v 1.1 2013/04/29 21:31:12 joerg Exp $
 
---- modules/core/src/system.cpp.orig	2013-04-28 15:15:06.000000000 +0000
+--- modules/core/src/system.cpp.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/core/src/system.cpp
-@@ -79,6 +79,7 @@
+@@ -143,6 +143,7 @@ std::wstring GetTempFileNameWinRT(std::w
  #include <pthread.h>
  #include <sys/time.h>
  #include <time.h>
Index: patches/patch-modules_flann_include_opencv2_flann_defines.h
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_flann_include_opencv2_flann_defines.h,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_flann_include_opencv2_flann_defines.h
--- patches/patch-modules_flann_include_opencv2_flann_defines.h	12 Jun 2013 10:13:58 -0000	1.1
+++ patches/patch-modules_flann_include_opencv2_flann_defines.h	1 Feb 2015 21:46:05 -0000
@@ -2,7 +2,7 @@ $NetBSD: patch-modules_flann_include_ope
 
 Avoid CS conflict on SunOS.
 
---- modules/flann/include/opencv2/flann/defines.h.orig	2012-09-27 22:55:06.000000000 +0000
+--- modules/flann/include/opencv2/flann/defines.h.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/flann/include/opencv2/flann/defines.h
 @@ -71,6 +71,9 @@
  #define FLANN_PLATFORM_32_BIT
Index: patches/patch-modules_legacy_src_calibfilter.cpp
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_legacy_src_calibfilter.cpp,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-modules_legacy_src_calibfilter.cpp
--- patches/patch-modules_legacy_src_calibfilter.cpp	27 May 2014 09:57:21 -0000	1.1
+++ patches/patch-modules_legacy_src_calibfilter.cpp	1 Feb 2015 21:46:05 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-modules_legacy_src_calibfilter.cpp,v 1.1 2014/05/27 09:57:21 joerg Exp $
 
---- modules/legacy/src/calibfilter.cpp.orig	2014-05-22 13:56:04.000000000 +0000
+--- modules/legacy/src/calibfilter.cpp.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/legacy/src/calibfilter.cpp
 @@ -95,10 +95,12 @@ bool CvCalibFilter::SetEtalon( CvCalibEt
  
Index: patches/patch-modules_ts_src_ts.cpp
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/opencv/patches/patch-modules_ts_src_ts.cpp,v
retrieving revision 1.2
diff -u -p -u -r1.2 patch-modules_ts_src_ts.cpp
--- patches/patch-modules_ts_src_ts.cpp	19 Jun 2013 11:54:04 -0000	1.2
+++ patches/patch-modules_ts_src_ts.cpp	1 Feb 2015 21:46:05 -0000
@@ -2,7 +2,7 @@ $NetBSD: patch-modules_ts_src_ts.cpp,v 1
 
 Avoid std::foo conflict.
 
---- modules/ts/src/ts.cpp.orig	2013-04-05 09:00:20.000000000 +0000
+--- modules/ts/src/ts.cpp.orig	2014-04-11 10:15:26.000000000 +0000
 +++ modules/ts/src/ts.cpp
 @@ -562,7 +562,7 @@ void TS::vprintf( int streams, const cha
      for( int i = 0; i < MAX_IDX; i++ )


Home | Main Index | Thread Index | Old Index