gnu: qtwebengine: Rename to qtwebengine-5.
[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 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages zwave)
21 #:use-module (guix packages)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix git-download)
24 #:use-module (guix build-system gnu)
25 #:use-module (guix build-system node)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages node-xyz)
29 #:use-module (gnu packages libusb)
30 #:use-module (gnu packages linux)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages python)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages xml))
35
36 (define-public open-zwave
37 (package
38 (name "open-zwave")
39 (version "1.6")
40 (source (origin
41 (method git-fetch)
42 (uri (git-reference
43 (url "https://github.com/OpenZWave/open-zwave/")
44 (commit (string-append "v" version))))
45 (file-name (git-file-name name version))
46 (sha256
47 (base32
48 "0xgs4mmr0480c269wx9xkk67ikjzxkh8xcssrdx0f5xcl1lyd333"))
49 (patches (search-patches "open-zwave-hidapi.patch"))
50 (modules '((guix build utils)))
51 (snippet
52 '(begin
53 ;; Set RUNPATH on the 'MinOZW' executable.
54 (substitute* "cpp/examples/MinOZW/Makefile"
55 (("\\$\\(LDFLAGS\\)")
56 "$(LDFLAGS) -Wl,-rpath=$(PREFIX)/lib"))
57
58 ;; XXX: There's a bundled TinyXML under cpp/tinyxml. Keep
59 ;; it because using our own TinyXML leads to double-free
60 ;; down the road.
61
62 ;; Delete the bundled HIDAPI.
63 (delete-file-recursively "cpp/hidapi")
64 #t))))
65 (build-system gnu-build-system)
66 (arguments
67 '(#:phases (modify-phases %standard-phases
68 (delete 'configure)) ;no 'configure' script
69
70 #:make-flags (list "BUILD=debug"
71 (string-append "PREFIX="
72 (assoc-ref %outputs "out"))
73 (string-append "pkgconfigdir="
74 (assoc-ref %outputs "out")
75 "/lib/pkgconfig"))
76
77 ;; "make check" and "make fulltest" are only concerned with checking
78 ;; the device XML database and it's not entirely clear what to get from
79 ;; them.
80 #:tests? #f))
81 (native-inputs (list which pkg-config perl ;for tests
82 perl-xml-simple))
83 (inputs (list hidapi eudev))
84 (home-page "http://www.openzwave.net/")
85 (synopsis "Access Z-Wave devices from C++ programs")
86 (description
87 "OpenZWave (or OZW) is a C++ library that interfaces with selected Z-Wave
88 PC controllers. It allows developers to create applications that manipulate
89 and respond to devices on a Z-Wave network, without requiring in-depth
90 knowledge of the Z-Wave protocol.")
91 (license license:lgpl3+)))
92
93 (define-public node-openzwave-shared
94 (package
95 (name "node-openzwave-shared")
96 (version "1.7.2")
97 (source
98 (origin
99 (method git-fetch)
100 (uri (git-reference
101 (url "https://github.com/OpenZWave/node-openzwave-shared")
102 (commit (string-append "v" version))))
103 (file-name (git-file-name name version))
104 (sha256
105 (base32
106 "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
107 (inputs
108 (list open-zwave node-nan))
109 (native-inputs
110 (list which python pkg-config))
111 (build-system node-build-system)
112 (arguments
113 `(#:phases
114 (modify-phases %standard-phases
115 (replace 'build
116 ;; For some reason, `npm install` doesn't build
117 ;; the addon automatically, so we do it explicitly here.
118 ;; We go through `npx` so the npmrc file sets the
119 ;; configuration up properly.
120 (lambda* (#:key native-inputs inputs #:allow-other-keys)
121 (invoke (search-input-file (or native-inputs inputs) "/bin/npx")
122 "--call"
123 (string-append
124 (search-input-file
125 (or native-inputs inputs)
126 "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
127 " rebuild")))))))
128 (home-page "https://github.com/OpenZWave/node-openzwave-shared")
129 (synopsis "Node.js bindings for OpenZWave")
130 (description
131 "With the @code{node-openzwave-shared} package, you can easily control
132 and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
133 within Node.js applications. This library also supports secure
134 devices (e.g. door locks) that require encryption. All widely used Node.js
135 versions are supported with the help of @code{node-nan}.
136
137 This library is currently able to:
138 @itemize @bullet
139 @item
140 scan a Z-Wave network and report on connected devices;
141 @item
142 write values to Z-Wave nodes;
143 @item
144 monitor the network for changes;
145 @item
146 heal nodes and/or the network; and
147 @item
148 perform management tasks: add or remove nodes, replace failed nodes,
149 manage their group associations, etc.
150 @end itemize")
151 (license license:isc)))