me
/
guix
Archived
1
0
Fork 0

gnu: opencv: Absorb opencv-next.

* gnu/packages/image-processing.scm (opencv): Absorb opencv-next, updating
package to 4.7.0.
[arguments]: Simplify the regexps in the disable-broken-tests phase, to make
it easier to understand.  Simply remove the removed lined in the
do-not-install-3rdparty-file phase, instead of leaving it blank.
master
Maxim Cournoyer 2023-03-22 17:04:59 -04:00
parent ec730083be
commit b58bac0086
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 30 additions and 112 deletions

View File

@ -486,21 +486,18 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
(define-public opencv (define-public opencv
(package (package
(name "opencv") (name "opencv")
(version "4.5.4") (version "4.7.0")
(source (origin (source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/opencv/opencv") (url "https://github.com/opencv/opencv")
(commit version))) (commit version)))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256
(base32
"0gf2xs3r4s51m20mpf0wdidpk0xzp3m2w6jx72fwldhn0pshlmcj"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
'(begin '(begin
;; Remove external libraries. We have almost all available ;; Remove external libraries. Almost all of them are
;; in Guix: ;; available in Guix.
(with-directory-excursion "3rdparty" (with-directory-excursion "3rdparty"
(for-each delete-file-recursively (for-each delete-file-recursively
'("carotene" '("carotene"
@ -524,20 +521,18 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
"tbb" "tbb"
"zlib"))) "zlib")))
;; Milky icon set is non-free: ;; Delete any bundled .jar files.
(delete-file-recursively "modules/highgui/src/files_Qt/Milky") (for-each delete-file (find-files "." "\\.jar$"))))
(sha256
;; Some jars found: (base32
(for-each delete-file "0l45v41nns2jmn9nr9fb0yvhqzfjpxjxn75i1c02rsfy3r3lv22v"))))
'("modules/java/test/pure_test/lib/junit-4.11.jar"
"samples/java/sbt/sbt/sbt-launch.jar"))))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
`(#:configure-flags `(#:configure-flags
(list "-DWITH_ADE=OFF" ;we don't have a package for ade yet (list "-DWITH_ADE=OFF" ;we don't have a package for ade yet
"-DWITH_IPP=OFF" "-DWITH_IPP=OFF"
"-DWITH_ITT=OFF" "-DWITH_ITT=OFF"
"-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64 "-DWITH_CAROTENE=OFF" ; only visible on arm/aarch64
"-DENABLE_PRECOMPILED_HEADERS=OFF" "-DENABLE_PRECOMPILED_HEADERS=OFF"
"-DOPENCV_GENERATE_PKGCONFIG=ON" "-DOPENCV_GENERATE_PKGCONFIG=ON"
@ -595,22 +590,20 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
;; This test fails with "unknown file: Failure" ;; This test fails with "unknown file: Failure"
;; But I couldn't figure out which file was missing: ;; But I couldn't figure out which file was missing:
(substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp" (substitute* "../opencv-contrib/modules/face/test/test_face_align.cpp"
(("(TEST\\(CV_Face_FacemarkKazemi, )(can_detect_landmarks\\).*)" (("\\bcan_detect_landmarks\\b" all)
all pre post) (string-append "DISABLED_" all)))
(string-append pre "DISABLED_" post)))
;; This test fails with a comparison between the expected 396 and ;; This all fails with a comparison between the expected 396 and
;; the actual 440 in file size. ;; the actual 440 in file size.
(substitute* "modules/imgcodecs/test/test_exr.impl.hpp" (substitute* "modules/imgcodecs/test/test_exr.impl.hpp"
(("(TEST\\(Imgcodecs_EXR, )(readWrite_32FC1\\).*)" all pre post) (("\\breadWrite_32FC1\\b" all)
(string-append pre "DISABLED_" post))) (string-append "DISABLED_" all)))
;; These fail with protobuf parse errors that come from ;; These fail with protobuf parse errors that come from
;; opencv-extra/testdata. ;; opencv-extra/alldata.
(substitute* "modules/dnn/test/test_layers.cpp" (substitute* "modules/dnn/test/test_layers.cpp"
(("(TEST_P\\(Test_Caffe_layers, )\ (("\\b(Accum|DataAugmentation|Resample|Correlation|Interp)\\b" all)
(Accum\\).*|DataAugmentation\\).*|Resample\\).*|Correlation\\).*)" all pre post) (string-append "DISABLED_" all)))))
(string-append pre "DISABLED_" post)))))
(add-after 'unpack 'unpack-submodule-sources (add-after 'unpack 'unpack-submodule-sources
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(mkdir "../opencv-extra") (mkdir "../opencv-extra")
@ -622,7 +615,8 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
(add-after 'build 'do-not-install-3rdparty-file (add-after 'build 'do-not-install-3rdparty-file
(lambda _ (lambda _
(substitute* "cmake_install.cmake" (substitute* "cmake_install.cmake"
(("file\\(INSTALL .*source/3rdparty/include/opencl/LICENSE.txt.*") "\n")))) (("file\\(INSTALL .*3rdparty/include/opencl/LICENSE.txt.*")
""))))
(add-before 'check 'start-xserver (add-before 'check 'start-xserver
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((xorg-server (assoc-ref inputs "xorg-server")) (let ((xorg-server (assoc-ref inputs "xorg-server"))
@ -634,7 +628,7 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
(zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp))))))))) (zero? (system (format #f "~a/bin/Xvfb ~a &" xorg-server disp)))))))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config) `(("pkg-config" ,pkg-config)
("xorg-server" ,xorg-server-for-tests) ; For running the tests ("xorg-server" ,xorg-server-for-tests) ;For running the tests
("opencv-extra" ("opencv-extra"
,(origin ,(origin
(method git-fetch) (method git-fetch)
@ -643,23 +637,24 @@ integrates with various databases on GUI toolkits such as Qt and Tk.")
(commit version))) (commit version)))
(file-name (git-file-name "opencv_extra" version)) (file-name (git-file-name "opencv_extra" version))
(sha256 (sha256
(base32 "1fg2hxdvphdvagc2fkmhqk7qql9mp7pj2bmp8kmd7vicpr72qk82")))) (base32
"0bdg5kwwdimnl2zp4ry5cmfxr9xb7zk2ml59853d90llsqjis47a"))))
("opencv-contrib" ("opencv-contrib"
,(origin ,(origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference (url "https://github.com/opencv/opencv_contrib")
(url "https://github.com/opencv/opencv_contrib") (commit version)))
(commit version)))
(file-name (git-file-name "opencv_contrib" version)) (file-name (git-file-name "opencv_contrib" version))
(sha256 (sha256
(base32 "0ga0l4ranp1834gxgp487ll1amvmssa02l2nk5ja5w0rx4d8hh26")))))) (base32
"0hbfn835kxh3hwmwvzgdglm2np1ri3z7nfnf60gf4x6ikp89mv4r"))))))
(inputs (inputs
(list ffmpeg-4 (list ffmpeg-4
gtk+ gtk+
gtkglext gtkglext
hdf5 hdf5
ilmbase ilmbase
imath ;should be propagated by openexr imath ;should be propagated by openexr
jasper jasper
libgphoto2 libgphoto2
libjpeg-turbo libjpeg-turbo
@ -699,83 +694,6 @@ things like:
(home-page "https://opencv.org/") (home-page "https://opencv.org/")
(license license:bsd-3))) (license license:bsd-3)))
;; TODO: Make this the default opencv after aiscm is able to use it.
(define-public opencv-next
(package
(inherit opencv)
(name "opencv")
(version "4.7.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/opencv/opencv")
(commit version)))
(file-name (git-file-name name version))
(modules '((guix build utils)))
(snippet
'(begin
;; Remove external libraries. Almost all of them are
;; available in Guix.
(with-directory-excursion "3rdparty"
(for-each delete-file-recursively
'("carotene"
"cpufeatures"
"ffmpeg"
"include"
"ippicv"
"ittnotify"
"libjasper"
"libjpeg"
"libjpeg-turbo"
"libpng"
"libtengine"
"libtiff"
"libwebp"
"openexr"
"openjpeg"
"openvx"
"protobuf"
;;"quirc"
"tbb"
"zlib")))
;; Delete any bundled .jar files.
(for-each delete-file (find-files "." "\\.jar$"))))
(sha256
(base32
"0l45v41nns2jmn9nr9fb0yvhqzfjpxjxn75i1c02rsfy3r3lv22v"))))
(native-inputs
`(("pkg-config" ,pkg-config)
("xorg-server" ,xorg-server-for-tests) ;For running the tests
("opencv-extra"
,(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/opencv/opencv_extra")
(commit version)))
(file-name (git-file-name "opencv_extra" version))
(sha256
(base32
"0bdg5kwwdimnl2zp4ry5cmfxr9xb7zk2ml59853d90llsqjis47a"))))
("opencv-contrib"
,(origin
(method git-fetch)
(uri (git-reference (url "https://github.com/opencv/opencv_contrib")
(commit version)))
(file-name (git-file-name "opencv_contrib" version))
(sha256
(base32
"0hbfn835kxh3hwmwvzgdglm2np1ri3z7nfnf60gf4x6ikp89mv4r"))))))
(arguments
(substitute-keyword-arguments (package-arguments opencv)
((#:phases phases '%standard-phases)
#~(modify-phases #$phases
(add-after 'unpack 'disable-broken-tests-opencv-4.7-specific
(lambda _
(substitute* "modules/dnn/test/test_layers.cpp"
(("(TEST_P\\(Test_Caffe_layers, )(Interp\\).*)" _ pre post)
(string-append pre "DISABLED_" post)))))))))))
(define-public vips (define-public vips
(package (package
(name "vips") (name "vips")