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 (guix build-system cmake)
36
  #:use-module (guix build-system python))
37
38
(define-public opencv
39
  (package
40
    (name "opencv")
41
    (version "3.2.0")
42
    (source (origin
43
              (method url-fetch)
44
              (uri (string-append "https://github.com/opencv/opencv/archive/"
45
                                  version ".zip"))
46
              (file-name (string-append name "-" version ".zip"))
47
              (sha256
48
               (base32
49
                "0p0ppp3p7xnn4ah9g3a9nh7wav2jg2zq3mz1vnd50bk6aknhq06j"))))
50
    (build-system cmake-build-system)
51
    (native-inputs
52
     `(("doxygen" ,doxygen)
53
       ("unzip" ,unzip)
54
       ("pkg-config" ,pkg-config)))
55
    (inputs
56
     `(("ffmpeg" ,ffmpeg)
57
       ("gstreamer" ,gstreamer)
58
       ("gtk-3" ,gtk+)
59
       ("ilmbase" ,ilmbase)
60
       ("jasper" ,jasper)
61
       ("libgpoto2" ,libgphoto2)
62
       ("libjpeg-turbo" ,libjpeg-turbo)
63
       ("libpng" ,libpng)
64
       ("libtiff" ,libtiff)
65
       ("libwebp" ,libwebp)
66
       ("mesa" ,mesa)
67
       ("openexr" ,openexr)
68
       ("zlib" ,zlib)))
69
    (arguments
70
     ;; This thing has a strange license
71
     `(#:configure-flags (list "-DWITH_IPP=OFF")
72
       #:tests? #f; they're just too long
73
       #:phases
74
       (modify-phases %standard-phases
75
         (add-before 'configure 'remove-3rdparties
76
           (lambda _
77
             (delete-file-recursively "3rdparty")))
78
         (add-after 'set-paths 'add-ilmbase-include-path
79
           (lambda* (#:key inputs #:allow-other-keys)
80
             ;; OpenEXR propagates ilmbase, but its include files do not appear
81
             ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
82
             ;; the CPATH to satisfy the dependency on "half.h".
83
             (setenv "CPATH"
84
                     (string-append (assoc-ref inputs "ilmbase")
85
                                    "/include/OpenEXR"
86
                                    ":" (or (getenv "CPATH") "")))
87
             #t)))))
88
    (home-page "http://opencv.org/")
89
    (synopsis "Computer vision and machine learning software library")
90
    (description
91
     "OpenCV (Open Source Computer Vision Library) is an open source computer
92
vision and machine learning software library.")
93
    (license license:bsd-3)))
94