OpenCV: bump, introduce tools subpackage (#3010)

* OpenCV: bump, introduce tools subpackage

* libVersionCompat fix
This commit is contained in:
miqlas
2018-09-24 19:52:42 +02:00
committed by Scott McCreary
parent 973eca870a
commit 5da6c99826
3 changed files with 30 additions and 428 deletions

View File

@@ -9,33 +9,26 @@ COPYRIGHT="2000-2016, Intel Corporation
2015-2016, OpenCV Foundation
2015-2016, Itseez Inc."
LICENSE="BSD (3-clause)"
REVISION="5"
REVISION="1"
SOURCE_URI="https://github.com/opencv/opencv/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="f1b87684d75496a1054405ae3ee0b6573acaf3dad39eaf4f1d66fdd7e03dc852"
SOURCE_FILENAME="opencv-$portVersion.tar.gz"
PATCHES="opencv-$portVersion.patchset"
CHECKSUM_SHA256="4eef85759d5450b183459ff216b4c0fa43e87a4f6aa92c8af649f89336f002ec"
ARCHITECTURES="?x86 x86_64"
SECONDARY_ARCHITECTURES="?x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix="$secondaryArchSuffix"
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
fi
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
libVersionCompat="$libVersion compat >= ${libVersion%.*}"
PROVIDES="
opencv$secondaryArchSuffix = $portVersionCompat
cmd:opencv_annotation$commandSuffix = $portVersion
cmd:opencv_createsamples$commandSuffix = $portVersion
cmd:opencv_interactive_calibration$commandSuffix = $portVersion
cmd:opencv_traincascade$commandSuffix = $portVersion
cmd:opencv_version$commandSuffix = $portVersion
cmd:opencv_visualisation$commandSuffix = $portVersion
lib:libopencv_calib3d$secondaryArchSuffix = $libVersionCompat
lib:libopencv_core$secondaryArchSuffix = $libVersionCompat
lib:libopencv_dnn$secondaryArchSuffix = $libVersionCompat
@@ -110,13 +103,28 @@ REQUIRES_devel="
opencv$secondaryArchSuffix == $portVersion base
"
PROVIDES_tools="
cmd:opencv_annotation$commandSuffix = $portVersion
cmd:opencv_createsamples$commandSuffix = $portVersion
cmd:opencv_interactive_calibration$commandSuffix = $portVersion
cmd:opencv_traincascade$commandSuffix = $portVersion
cmd:opencv_version$commandSuffix = $portVersion
cmd:opencv_visualisation$commandSuffix = $portVersion
"
REQUIRES_tools="
haiku$secondaryArchSuffix
opencv$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:cblas$secondaryArchSuffix
devel:eigen$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavresample$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libexif$secondaryArchSuffix
devel:libgdal$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
@@ -132,6 +140,7 @@ BUILD_REQUIRES="
devel:liblapack$secondaryArchSuffix
devel:libopenblas$secondaryArchSuffix
devel:libopencl_headers$secondaryArchSuffix
devel:liborc_0.4$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libQt5Concurrent$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
@@ -183,9 +192,9 @@ BUILD()
{
mkdir -p build_haiku && cd build_haiku
local OPENBLAS_SUBDIR=
local ARCH_SUBDIR=
if [ -n "$secondaryArchSuffix" ]; then
OPENBLAS_SUBDIR="$secondaryArchSuffix/"
ARCH_SUBDIR="$secondaryArchSuffix/"
fi
cmake .. \
@@ -195,12 +204,12 @@ BUILD()
-DWITH_QT=ON \
-DWITH_EIGEN=ON \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_BUILD_HARDENING=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_PIC=OFF \
-DOPENCV_ENABLE_NONFREE=ON \
-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
-DOpenBLAS_INCLUDE_DIR="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/headers$OPENBLAS_SUBDIR" \
-DOpenBLAS_LIB="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/lib$OPENBLAS_SUBDIR"
-DOpenBLAS_INCLUDE_DIR="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/headers/$ARCH_SUBDIR" \
-DOpenBLAS_LIB="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/lib/$ARCH_SUBDIR"
make $jobArgs
}
@@ -217,7 +226,7 @@ INSTALL()
rmdir $prefix/share
mkdir -p $libDir/cmake/OpenCV
mv $dataDir/OpenCV/*.cmake $libDir/cmake/OpenCV/.
mv $dataDir/OpenCV/*.cmake $libDir/cmake/OpenCV/
prepareInstalledDevelLibs libopencv_calib3d \
libopencv_core \
@@ -258,6 +267,10 @@ INSTALL()
packageEntries devel \
$developDir \
$libDir/cmake
# tools package
packageEntries tools \
$binDir
}
TEST()

View File

@@ -1,271 +0,0 @@
SUMMARY="Open Source Computer Vision Library"
DESCRIPTION="A collection of algorithms and sample code for various \
computer vision problems."
HOMEPAGE="https://opencv.org/"
COPYRIGHT="2000-2016, Intel Corporation
2009-2011, Willow Garage Inc.
2009-2016, NVIDIA Corporation
2010-2013, Advanced Micro Devices, Inc.
2015-2016, OpenCV Foundation
2015-2016, Itseez Inc."
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/opencv/opencv/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="81dbd5e7e9f8a4c936b94629bf4765745942a1d634ae38ec08bc57b73b28ffc5"
SOURCE_FILENAME="opencv-$portVersion.tar.gz"
SOURCE_DIR="opencv-$portVersion"
ARCHITECTURES="?x86 x86_64"
SECONDARY_ARCHITECTURES="?x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix="$secondaryArchSuffix"
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
fi
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
opencv342$secondaryArchSuffix = $portVersionCompat
cmd:opencv_annotation$commandSuffix = $portVersion
cmd:opencv_createsamples$commandSuffix = $portVersion
cmd:opencv_interactive_calibration$commandSuffix = $portVersion
cmd:opencv_traincascade$commandSuffix = $portVersion
cmd:opencv_version$commandSuffix = $portVersion
cmd:opencv_visualisation$commandSuffix = $portVersion
lib:libopencv_calib3d$secondaryArchSuffix = $libVersionCompat
lib:libopencv_core$secondaryArchSuffix = $libVersionCompat
lib:libopencv_dnn$secondaryArchSuffix = $libVersionCompat
lib:libopencv_features2d$secondaryArchSuffix = $libVersionCompat
lib:libopencv_flann$secondaryArchSuffix = $libVersionCompat
lib:libopencv_highgui$secondaryArchSuffix = $libVersionCompat
lib:libopencv_imgcodecs$secondaryArchSuffix = $libVersionCompat
lib:libopencv_imgproc$secondaryArchSuffix = $libVersionCompat
lib:libopencv_ml$secondaryArchSuffix = $libVersionCompat
lib:libopencv_objdetect$secondaryArchSuffix = $libVersionCompat
lib:libopencv_photo$secondaryArchSuffix = $libVersionCompat
lib:libopencv_shape$secondaryArchSuffix = $libVersionCompat
lib:libopencv_stitching$secondaryArchSuffix = $libVersionCompat
lib:libopencv_superres$secondaryArchSuffix = $libVersionCompat
lib:libopencv_video$secondaryArchSuffix = $libVersionCompat
lib:libopencv_videoio$secondaryArchSuffix = $libVersionCompat
lib:libopencv_videostab$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavformat$secondaryArchSuffix
lib:libavresample$secondaryArchSuffix
lib:libavutil$secondaryArchSuffix
lib:libgdal$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libgphoto2$secondaryArchSuffix
lib:libgstapp_1.0$secondaryArchSuffix
lib:libgstreamer_1.0$secondaryArchSuffix
lib:libgstvideo_1.0$secondaryArchSuffix
lib:libilmimf$secondaryArchSuffix #openexr
lib:libintl$secondaryArchSuffix
lib:libjasper$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:liblapack$secondaryArchSuffix
lib:libopenblas$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libQt5Concurrent$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Test$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libtiff$secondaryArchSuffix
lib:libwebp$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
opencv342${secondaryArchSuffix}_devel = $portVersionCompat
devel:libopencv_calib3d$secondaryArchSuffix = $libVersionCompat
devel:libopencv_core$secondaryArchSuffix = $libVersionCompat
devel:libopencv_dnn$secondaryArchSuffix = $libVersionCompat
devel:libopencv_features2d$secondaryArchSuffix = $libVersionCompat
devel:libopencv_flann$secondaryArchSuffix = $libVersionCompat
devel:libopencv_highgui$secondaryArchSuffix = $libVersionCompat
devel:libopencv_imgcodecs$secondaryArchSuffix = $libVersionCompat
devel:libopencv_imgproc$secondaryArchSuffix = $libVersionCompat
devel:libopencv_ml$secondaryArchSuffix = $libVersionCompat
devel:libopencv_objdetect$secondaryArchSuffix = $libVersionCompat
devel:libopencv_photo$secondaryArchSuffix = $libVersionCompat
devel:libopencv_shape$secondaryArchSuffix = $libVersionCompat
devel:libopencv_stitching$secondaryArchSuffix = $libVersionCompat
devel:libopencv_superres$secondaryArchSuffix = $libVersionCompat
devel:libopencv_video$secondaryArchSuffix = $libVersionCompat
devel:libopencv_videoio$secondaryArchSuffix = $libVersionCompat
devel:libopencv_videostab$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
opencv342$secondaryArchSuffix == $portVersion base
"
CONFLICTS_devel="
opencv${secondaryArchSuffix}_devel
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:eigen$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavresample$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libexif$secondaryArchSuffix
devel:libgdal$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libGLU$secondaryArchSuffix
devel:libgphoto2$secondaryArchSuffix
devel:libgstapp_1.0$secondaryArchSuffix
devel:libgstreamer_1.0$secondaryArchSuffix
devel:libgstvideo_1.0$secondaryArchSuffix
devel:libilmimf$secondaryArchSuffix #openexr
devel:libintl$secondaryArchSuffix
devel:libjasper$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:liblapack$secondaryArchSuffix
devel:libopenblas$secondaryArchSuffix
devel:libopencl_headers$secondaryArchSuffix
devel:liborc_0.4$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libQt5Concurrent$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5Test$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libtiff$secondaryArchSuffix
devel:libwebp$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
# cmd:ant
cmd:cmake
cmd:doxygen
cmd:f2py2
cmd:f2py3
cmd:gcc$secondaryArchSuffix
# cmd:javac
# cmd:jni
cmd:ld$secondaryArchSuffix
cmd:make
# cmd:matlab # maybe later
cmd:pkg_config$secondaryArchSuffix
cmd:python2
cmd:python3
"
defineDebugInfoPackage opencv342$secondaryArchSuffix \
$libDir/libopencv_calib3d.so.$libVersion \
$libDir/libopencv_core.so.$libVersion \
$libDir/libopencv_dnn.so.$libVersion \
$libDir/libopencv_features2d.so.$libVersion \
$libDir/libopencv_flann.so.$libVersion \
$libDir/libopencv_highgui.so.$libVersion \
$libDir/libopencv_imgcodecs.so.$libVersion \
$libDir/libopencv_imgproc.so.$libVersion \
$libDir/libopencv_ml.so.$libVersion \
$libDir/libopencv_objdetect.so.$libVersion \
$libDir/libopencv_photo.so.$libVersion \
$libDir/libopencv_shape.so.$libVersion \
$libDir/libopencv_stitching.so.$libVersion \
$libDir/libopencv_superres.so.$libVersion \
$libDir/libopencv_video.so.$libVersion \
$libDir/libopencv_videoio.so.$libVersion \
$libDir/libopencv_videostab.so.$libVersion
BUILD()
{
mkdir -p build_haiku && cd build_haiku
local OPENBLAS_SUBDIR=
if [ -n "$secondaryArchSuffix" ]; then
OPENBLAS_SUBDIR="$secondaryArchSuffix/"
fi
cmake .. \
-DWITH_GDAL=ON \
-DWITH_IPP=OFF \
-DWITH_OPENGL=OFF \
-DWITH_QT=ON \
-DWITH_EIGEN=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_PIC=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
-DOpenBLAS_INCLUDE_DIR="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/headers$OPENBLAS_SUBDIR" \
-DOpenBLAS_LIB="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/lib$OPENBLAS_SUBDIR"
make $jobArgs
}
INSTALL()
{
cd build_haiku
make install
mkdir -p $developDir $dataDir
mv $prefix/include $includeDir
mv $prefix/share/* $dataDir
rmdir $prefix/share
mkdir -p $libDir/cmake/OpenCV
mv $dataDir/OpenCV/*.cmake $libDir/cmake/OpenCV/
prepareInstalledDevelLibs libopencv_calib3d \
libopencv_core \
libopencv_dnn \
libopencv_features2d \
libopencv_flann \
libopencv_highgui \
libopencv_imgcodecs \
libopencv_imgproc \
libopencv_ml \
libopencv_objdetect \
libopencv_photo \
libopencv_shape \
libopencv_stitching \
libopencv_superres \
libopencv_video \
libopencv_videoio \
libopencv_videostab
# Cleanup
# fixPkgconfig don't know about this variables
sed -i 's,^includedir_old=\(.*\),includedir_old=${prefix}/'${relativeIncludeDir}'/opencv,' \
$libDir/pkgconfig/opencv.pc
sed -i 's,^includedir_new=\(.*\),includedir_new=${prefix}/'${relativeIncludeDir}',' \
$libDir/pkgconfig/opencv.pc
fixPkgconfig
# fixCmake
sed -i 's,\/include,/'${relativeIncludeDir}',g' \
$libDir/cmake/OpenCV/OpenCVConfig.cmake
sed -i 's|/\.\./\.\./|&../|g' \
$libDir/cmake/OpenCV/OpenCVConfig.cmake
sed -i 's,\/lib\/,\/,g' \
$libDir/cmake/OpenCV/OpenCVModules-release.cmake
# devel package
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
LIBRARY_PATH="$sourceDir/build_haiku/lib${LIBRARY_PATH:+:$LIBRARY_PATH}" \
make -C build_haiku test $jobArgs
}

View File

@@ -1,140 +0,0 @@
From 1f8ba8b4e5cc4c7e6aa423fb3ffb88fd67d6e166 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sun, 4 Mar 2018 18:13:17 +0100
Subject: [PATCH] Haiku supporting patches
---
cmake/OpenCVCompilerDefenses.cmake | 6 +++++-
modules/core/include/opencv2/core/utils/filesystem.private.hpp | 2 +-
modules/core/src/parallel.cpp | 5 +++--
modules/core/src/utils/filesystem.cpp | 10 +++++-----
modules/videoio/src/cap_ffmpeg_impl.hpp | 4 ++--
5 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/cmake/OpenCVCompilerDefenses.cmake b/cmake/OpenCVCompilerDefenses.cmake
index f72f941..672c527 100644
--- a/cmake/OpenCVCompilerDefenses.cmake
+++ b/cmake/OpenCVCompilerDefenses.cmake
@@ -70,7 +70,11 @@ else()
# not supported
endif()
-set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+if(NOT HAIKU)
+ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+else()
+ set(CMAKE_POSITION_INDEPENDENT_CODE FALSE)
+endif()
if(CMAKE_COMPILER_IS_GNUCXX)
if(NOT CMAKE_CXX_FLAGS MATCHES "-fPIC")
ocv_add_defense_compiler_flag("-fPIC")
diff --git a/modules/core/include/opencv2/core/utils/filesystem.private.hpp b/modules/core/include/opencv2/core/utils/filesystem.private.hpp
index 73f56d4..deca4a4 100644
--- a/modules/core/include/opencv2/core/utils/filesystem.private.hpp
+++ b/modules/core/include/opencv2/core/utils/filesystem.private.hpp
@@ -12,7 +12,7 @@
# elif defined WINRT
/* not supported */
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
- defined __FreeBSD__ || defined __bsdi__
+ defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
# elif defined(__APPLE__)
# include <TargetConditionals.h>
diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp
index 93d4e6c..5739d3d 100644
--- a/modules/core/src/parallel.cpp
+++ b/modules/core/src/parallel.cpp
@@ -53,7 +53,8 @@
#undef abs
#endif
-#if defined __linux__ || defined __APPLE__ || defined __GLIBC__
+#if defined __linux__ || defined __APPLE__ || defined __GLIBC__ \
+ || defined __HAIKU__
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
@@ -721,7 +722,7 @@ int cv::getNumberOfCPUs(void)
#elif defined __ANDROID__
static int ncpus = getNumberOfCPUsImpl();
return ncpus;
-#elif defined __linux__ || defined __GLIBC__
+#elif defined __linux__ || defined __GLIBC__ || defined __HAIKU__
return (int)sysconf( _SC_NPROCESSORS_ONLN );
#elif defined __APPLE__
int numCPU=0;
diff --git a/modules/core/src/utils/filesystem.cpp b/modules/core/src/utils/filesystem.cpp
index 1aa0d3d..9af7e14 100644
--- a/modules/core/src/utils/filesystem.cpp
+++ b/modules/core/src/utils/filesystem.cpp
@@ -34,7 +34,7 @@
#include <errno.h>
#include <io.h>
#include <stdio.h>
-#elif defined __linux__ || defined __APPLE__
+#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -161,7 +161,7 @@ cv::String getcwd()
sz = GetCurrentDirectoryA((DWORD)buf.size(), (char*)buf);
return cv::String((char*)buf, (size_t)sz);
#endif
-#elif defined __linux__ || defined __APPLE__
+#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
for(;;)
{
char* p = ::getcwd((char*)buf, buf.size());
@@ -195,7 +195,7 @@ bool createDirectory(const cv::String& path)
#else
int result = _mkdir(path.c_str());
#endif
-#elif defined __linux__ || defined __APPLE__
+#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
int result = mkdir(path.c_str(), 0777);
#else
int result = -1;
@@ -310,7 +310,7 @@ private:
Impl& operator=(const Impl&); // disabled
};
-#elif defined __linux__ || defined __APPLE__
+#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
struct FileLock::Impl
{
@@ -424,7 +424,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
default_cache_path = "/tmp/";
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
}
-#elif defined __linux__
+#elif defined __linux__ || defined __HAIKU__
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if (default_cache_path.empty())
{
diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
index 8ca304a..de60030 100644
--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
+++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
@@ -101,7 +101,7 @@ extern "C" {
long tv_nsec;
};
#endif
-#elif defined __linux__ || defined __APPLE__
+#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
@@ -298,7 +298,7 @@ static int get_number_of_cpus(void)
GetSystemInfo( &sysinfo );
return (int)sysinfo.dwNumberOfProcessors;
-#elif defined __linux__
+#elif defined __linux__ || defined __HAIKU__
return (int)sysconf( _SC_NPROCESSORS_ONLN );
#elif defined __APPLE__
int numCPU=0;
--
2.16.2