summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Tai <atai@atai.org>2023-02-15 08:10:22 -0800
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-22 14:17:24 -0400
commit2cf24e98406159b6ee6069164a961b71c62fc03e (patch)
tree5d600db20fa4ab3e82ea2fbd0137d6e797309102
parentb45f75d5b7496c742596499beda7e4bdb23ae54e (diff)
downloadguix-2cf24e98406159b6ee6069164a961b71c62fc03e.tar.gz
gnu: Add opencv-next.
* gnu/packages/image-processing.scm (opencv-next): New variable.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r--gnu/packages/image-processing.scm77
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 7652b24e1a..98afe4f342 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -699,6 +699,83 @@ things like:
     (home-page "https://opencv.org/")
     (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
   (package
     (name "vips")