f07367d264fe9b8e58931d9636f16130eb526c70
[jackhill/guix/guix.git] / gnu / packages / zwave.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
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 (gnu packages zwave)
20 #:use-module (guix packages)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages base)
26 #:use-module (gnu packages libusb)
27 #:use-module (gnu packages linux)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages xml))
31
32 (define-public open-zwave
33 (package
34 (name "open-zwave")
35 (version "1.6")
36 (source (origin
37 (method git-fetch)
38 (uri (git-reference
39 (url "https://github.com/OpenZWave/open-zwave/")
40 (commit (string-append "v" version))))
41 (file-name (git-file-name name version))
42 (sha256
43 (base32
44 "0xgs4mmr0480c269wx9xkk67ikjzxkh8xcssrdx0f5xcl1lyd333"))
45 (patches (search-patches "open-zwave-hidapi.patch"))
46 (modules '((guix build utils)))
47 (snippet
48 '(begin
49 ;; Set RUNPATH on the 'MinOZW' executable.
50 (substitute* "cpp/examples/MinOZW/Makefile"
51 (("\\$\\(LDFLAGS\\)")
52 "$(LDFLAGS) -Wl,-rpath=$(PREFIX)/lib"))
53
54 ;; Delete the bundled TinyXML.
55 (delete-file-recursively "cpp/tinyxml")
56 (substitute* "cpp/build/Makefile"
57 (("LIBS \\+= -ludev")
58 "LIBS += -ludev -ltinyxml "))
59
60 ;; Delete the bundled HIDAPI.
61 (delete-file-recursively "cpp/hidapi")
62 #t))))
63 (build-system gnu-build-system)
64 (arguments
65 '(#:phases (modify-phases %standard-phases
66 (delete 'configure)) ;no 'configure' script
67
68 #:make-flags (list "BUILD=debug"
69 (string-append "PREFIX="
70 (assoc-ref %outputs "out"))
71 (string-append "pkgconfigdir="
72 (assoc-ref %outputs "out")
73 "/lib/pkgconfig"))
74
75 ;; "make check" and "make fulltest" are only concerned with checking
76 ;; the device XML database and it's not entirely clear what to get from
77 ;; them.
78 #:tests? #f))
79 (native-inputs `(("which" ,which)
80 ("pkg-config" ,pkg-config)
81 ("perl" ,perl) ;for tests
82 ("perl-xml-simple" ,perl-xml-simple)))
83 (inputs `(("tinyxml" ,tinyxml)
84 ("hidapi" ,hidapi)
85 ("eudev" ,eudev)))
86 (home-page "http://www.openzwave.net/")
87 (synopsis "Access Z-Wave devices from C++ programs")
88 (description
89 "OpenZWave (or OZW) is a C++ library that interfaces with selected Z-Wave
90 PC controllers. It allows developers to create applications that manipulate
91 and respond to devices on a Z-Wave network, without requiring in-depth
92 knowledge of the Z-Wave protocol.")
93 (license license:lgpl3+)))