diff options
| author | Ross Burton <ross.burton@intel.com> | 2020-01-09 16:24:24 +0000 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-01-10 00:50:59 -0800 |
| commit | 5b92128aea6a15eeb993cb34477c9bdf4fcd66f9 (patch) | |
| tree | e5022ca95890e52f083ce6e3dbbca56629e3704a | |
| parent | adfe0b63443d8d2b18428afcb922aca422858890 (diff) | |
| download | meta-openembedded-5b92128aea6a15eeb993cb34477c9bdf4fcd66f9.tar.gz | |
opencv: abort configure if we need to download
OpenCV's habit of downloading files during do_configure is bad form
(as it becomes impossible to do offline builds), so add an option to
error out if a download would be needed.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/opencv/opencv/download.patch | 32 | ||||
| -rw-r--r-- | meta-oe/recipes-support/opencv/opencv_4.1.0.bb | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv/download.patch b/meta-oe/recipes-support/opencv/opencv/download.patch new file mode 100644 index 0000000000..fa8db88078 --- /dev/null +++ b/meta-oe/recipes-support/opencv/opencv/download.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | This CMake module will download files during do_configure. This is bad as it | ||
| 2 | means we can't do offline builds. | ||
| 3 | |||
| 4 | Add an option to disallow downloads by emitting a fatal error. | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
| 8 | |||
| 9 | diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake | ||
| 10 | index cdc47ad2cb..74573f45a2 100644 | ||
| 11 | --- a/cmake/OpenCVDownload.cmake | ||
| 12 | +++ b/cmake/OpenCVDownload.cmake | ||
| 13 | @@ -14,6 +14,7 @@ | ||
| 14 | # RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it | ||
| 15 | # Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache | ||
| 16 | |||
| 17 | +set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads") | ||
| 18 | set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files") | ||
| 19 | if(DEFINED ENV{OPENCV_DOWNLOAD_PATH}) | ||
| 20 | set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}") | ||
| 21 | @@ -153,6 +154,11 @@ function(ocv_download) | ||
| 22 | |||
| 23 | # Download | ||
| 24 | if(NOT EXISTS "${CACHE_CANDIDATE}") | ||
| 25 | + if(NOT OPENCV_ALLOW_DOWNLOADS) | ||
| 26 | + message(FATAL_ERROR "Not going to download ${DL_FILENAME}") | ||
| 27 | + return() | ||
| 28 | + endif() | ||
| 29 | + | ||
| 30 | ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"") | ||
| 31 | file(DOWNLOAD "${DL_URL}" "${CACHE_CANDIDATE}" | ||
| 32 | INACTIVITY_TIMEOUT 60 | ||
diff --git a/meta-oe/recipes-support/opencv/opencv_4.1.0.bb b/meta-oe/recipes-support/opencv/opencv_4.1.0.bb index 03e4f58dca..f679ccb05f 100644 --- a/meta-oe/recipes-support/opencv/opencv_4.1.0.bb +++ b/meta-oe/recipes-support/opencv/opencv_4.1.0.bb | |||
| @@ -48,6 +48,7 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \ | |||
| 48 | file://0003-To-fix-errors-as-following.patch \ | 48 | file://0003-To-fix-errors-as-following.patch \ |
| 49 | file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \ | 49 | file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \ |
| 50 | file://0001-Dont-use-isystem.patch \ | 50 | file://0001-Dont-use-isystem.patch \ |
| 51 | file://download.patch \ | ||
| 51 | " | 52 | " |
| 52 | PV = "4.1.0" | 53 | PV = "4.1.0" |
| 53 | 54 | ||
| @@ -87,6 +88,7 @@ EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \ | |||
| 87 | -DIPPROOT=${WORKDIR}/ippicv_lnx \ | 88 | -DIPPROOT=${WORKDIR}/ippicv_lnx \ |
| 88 | -DOPENCV_GENERATE_PKGCONFIG=ON \ | 89 | -DOPENCV_GENERATE_PKGCONFIG=ON \ |
| 89 | -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \ | 90 | -DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \ |
| 91 | -DOPENCV_ALLOW_DOWNLOADS=OFF \ | ||
| 90 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ | 92 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ |
| 91 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \ | 93 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \ |
| 92 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \ | 94 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \ |
