guix-more/more/packages/opencv.scm

opencv.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages opencv)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (gnu packages)
22
  #:use-module (guix packages)
23
  #:use-module (guix download)
24
  #:use-module (guix utils)
25
  #:use-module (gnu packages compression)
26
  #:use-module (gnu packages documentation)
27
  #:use-module (gnu packages gl)
28
  #:use-module (gnu packages graphics)
29
  #:use-module (gnu packages gstreamer)
30
  #:use-module (gnu packages gtk)
31
  #:use-module (gnu packages image)
32
  #:use-module (gnu packages photo)
33
  #:use-module (gnu packages pkg-config)
34
  #:use-module (gnu packages video)
35
  #:use-module (gnu packages zip)
36
  #:use-module (guix build-system cmake)
37
  #:use-module (guix build-system python))
38
39
(define-public opencv
40
  (package
41
    (name "opencv")
42
    (version "3.2.0")
43
    (source (origin
44
              (method url-fetch)
45
              (uri (string-append "https://github.com/opencv/opencv/archive/"
46
                                  version ".zip"))
47
              (file-name (string-append name "-" version ".zip"))
48
              (sha256
49
               (base32
50
                "0p0ppp3p7xnn4ah9g3a9nh7wav2jg2zq3mz1vnd50bk6aknhq06j"))))
51
    (build-system cmake-build-system)
52
    (native-inputs
53
     `(("doxygen" ,doxygen)
54
       ("unzip" ,unzip)
55
       ("pkg-config" ,pkg-config)))
56
    (inputs
57
     `(("ffmpeg" ,ffmpeg)
58
       ("gstreamer" ,gstreamer)
59
       ("gtk-3" ,gtk+)
60
       ("ilmbase" ,ilmbase)
61
       ("jasper" ,jasper)
62
       ("libgpoto2" ,libgphoto2)
63
       ("libjpeg-turbo" ,libjpeg-turbo)
64
       ("libpng" ,libpng)
65
       ("libtiff" ,libtiff)
66
       ("libwebp" ,libwebp)
67
       ("mesa" ,mesa)
68
       ("openexr" ,openexr)
69
       ("zlib" ,zlib)))
70
    (arguments
71
     ;; This thing has a strange license
72
     `(#:configure-flags (list "-DWITH_IPP=OFF")
73
       #:tests? #f; they're just too long
74
       #:phases
75
       (modify-phases %standard-phases
76
         (add-before 'configure 'remove-3rdparties
77
           (lambda _
78
             (delete-file-recursively "3rdparty")))
79
         (add-after 'set-paths 'add-ilmbase-include-path
80
           (lambda* (#:key inputs #:allow-other-keys)
81
             ;; OpenEXR propagates ilmbase, but its include files do not appear
82
             ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
83
             ;; the CPATH to satisfy the dependency on "half.h".
84
             (setenv "CPATH"
85
                     (string-append (assoc-ref inputs "ilmbase")
86
                                    "/include/OpenEXR"
87
                                    ":" (or (getenv "CPATH") "")))
88
             #t)))))
89
    (home-page "http://opencv.org/")
90
    (synopsis "Computer vision and machine learning software library")
91
    (description
92
     "OpenCV (Open Source Computer Vision Library) is an open source computer
93
vision and machine learning software library.")
94
    (license license:bsd-3)))
95