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>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
36 (define-public open-zwave
43 (url "https://github.com/OpenZWave/open-zwave/")
44 (commit (string-append "v" version))))
45 (file-name (git-file-name name version))
48 "0xgs4mmr0480c269wx9xkk67ikjzxkh8xcssrdx0f5xcl1lyd333"))
49 (patches (search-patches "open-zwave-hidapi.patch"))
50 (modules '((guix build utils)))
53 ;; Set RUNPATH on the 'MinOZW' executable.
54 (substitute* "cpp/examples/MinOZW/Makefile"
56 "$(LDFLAGS) -Wl,-rpath=$(PREFIX)/lib"))
58 ;; XXX: There's a bundled TinyXML under cpp/tinyxml. Keep
59 ;; it because using our own TinyXML leads to double-free
62 ;; Delete the bundled HIDAPI.
63 (delete-file-recursively "cpp/hidapi")
65 (build-system gnu-build-system)
67 '(#:phases (modify-phases %standard-phases
68 (delete 'configure)) ;no 'configure' script
70 #:make-flags (list "BUILD=debug"
71 (string-append "PREFIX="
72 (assoc-ref %outputs "out"))
73 (string-append "pkgconfigdir="
74 (assoc-ref %outputs "out")
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
81 (native-inputs (list which pkg-config perl ;for tests
83 (inputs (list hidapi eudev))
84 (home-page "http://www.openzwave.net/")
85 (synopsis "Access Z-Wave devices from C++ programs")
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+)))
93 (define-public node-openzwave-shared
95 (name "node-openzwave-shared")
101 (url "https://github.com/OpenZWave/node-openzwave-shared")
102 (commit (string-append "v" version))))
103 (file-name (git-file-name name version))
106 "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
108 (list open-zwave node-nan))
110 (list which python pkg-config))
111 (build-system node-build-system)
114 (modify-phases %standard-phases
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")
125 (or native-inputs inputs)
126 "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
128 (home-page "https://github.com/OpenZWave/node-openzwave-shared")
129 (synopsis "Node.js bindings for OpenZWave")
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}.
137 This library is currently able to:
140 scan a Z-Wave network and report on connected devices;
142 write values to Z-Wave nodes;
144 monitor the network for changes;
146 heal nodes and/or the network; and
148 perform management tasks: add or remove nodes, replace failed nodes,
149 manage their group associations, etc.
151 (license license:isc)))