jansson: moved to github
[openwrt.org/packages.git] / utils / Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#
# Copyright © 2006-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
 
include $(TOPDIR)/rules.mk
 
PKG_NAME:=nut
PKG_VERSION:=2.6.5
PKG_RELEASE:=2
 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.6/
PKG_MD5SUM:=e6eac4fa04baff0d0a827d64efe81a7e
 
PKG_BUILD_DEPENDS:=libusb-compat libnetsnmp
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
 
PKG_BUILD_PARALLEL:=1
 
define Package/nut/Default
  URL:=http://www.networkupstools.org/
  TITLE:= Network UPS Tools
  DEPENDS:=@USB_SUPPORT +libnetsnmp +libpthread
  SECTION:=utils
  CATEGORY:=Utilities
endef
 
define Package/nut/description
  Network UPS Tools (NUT) is a client/server monitoring system that
  allows computers to share uninterruptible power supply (UPS) and
  power distribution unit (PDU) hardware. Clients access the hardware
  through the server, and are notified whenever the power status
  changes.
endef
 
define Package/nut
$(call Package/nut/Default)
  MENU:=1
#  TITLE+= (common)
endef
 
define Package/nut-server
$(call Package/nut/Default)
  TITLE+= (server)
  DEPENDS+= nut
endef
 
define Package/nut-client
$(call Package/nut/Default)
  TITLE+= (client)
  DEPENDS+= nut
endef
 
define Package/nut-logger
$(call Package/nut/Default)
  TITLE+= (logger)
  DEPENDS+= nut
endef
 
define Package/nut-monitor
$(call Package/nut/Default)
  TITLE+= (monitor)
  DEPENDS+= nut
endef
 
define Package/nut/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(INSTALL_DIR) $(1)/etc/nut
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/
        $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
        ln -sf /var/run/ups.conf $(1)/etc/nut/ups.conf
endef
 
define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib
endef
 
define Package/nut/conffiles
/etc/nut/nut.conf
endef
 
define Package/nut-client/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin
endef
 
define Package/nut-server/install
        $(INSTALL_DIR) $(1)/etc/nut
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_DIR) $(1)/lib/nut
        $(INSTALL_DIR) $(1)/usr/share/nut
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/ups.init $(1)/etc/init.d/ups
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/nut/upsdrvctl $(1)/lib/nut
        $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample $(1)/etc/nut/upsd.conf
        ln -sf /var/run/upsd.users $(1)/etc/nut/upsd.users
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/cmdvartab
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/driver.list
endef
 
define Package/nut-server/conffiles
/etc/nut/upsd.conf
endef
 
define Package/nut-logger/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin
endef
 
define Package/nut-monitor/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_DIR) $(1)/etc/nut
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/upsmon.init $(1)/etc/init.d/upsmon
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin
        ln -sf /var/run/upsmon.conf $(1)/etc/nut/upsmon.conf
        $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf
endef
 
define Package/nut-monitor/conffiles
/etc/nut/upssched.conf
endef
 
define DriverPackage
  define Package/nut-driver-$(1)
    $(call Package/nut/Default)
    TITLE += ($(1) driver)
    DEPENDS += nut nut-server
    ifeq ($(1),$(filter $(1),$(USB_LIBUSB_DRIVERLIST)))
      DEPENDS+=libusb-compat
    endif
    ifeq ($(1),$(filter $(1),$(SNMP_DRIVERLIST)))
      DEPENDS+=libnetsnmp
    endif
  endef
  # Deliberately empty (well, some spaces) in order to trigger a build
  # failure. It should be overridden by the list below, and when updating
  # to a new version of nut we will need to provide descriptions for any
  # new drivers.
  define Package/nut-driver-$(1)/description
 
  endef
  define Package/nut-driver-$(1)/install
        $(INSTALL_DIR) $$(1)/lib/nut/
        $(INSTALL_BIN) $$(PKG_INSTALL_DIR)/lib/nut/$(1) $$(1)/lib/nut/
    ifeq ($(1),clone)
        # Bundle clone and clone-outlet together
        $(INSTALL_BIN) $$(PKG_INSTALL_DIR)/lib/nut/$(1)-outlet $$(1)/lib/nut/
    endif
  endef
endef
 
# These lists are lifted *directly* from drivers/Makefile.am in the nut
# source tree. This it to make it simpler to keep in sync when updating
# to a newer version of nut. Do not edit this manually.
#
# DO NOT EDIT (except to update with a fresh cut/paste)!
SERIAL_DRIVERLIST = bcmxcp belkin belkinunv bestfcom    \
 bestfortress bestuferrups bestups dummy-ups etapro everups     \
 gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys  \
 oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino        \
 safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
 blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old
SNMP_DRIVERLIST = snmp-ups
USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \
 blazer_usb richcomm_usb
# END: DO NOT EDIT!
 
NUT_DRIVERS := $(filter-out skel clone-outlet,$(SERIAL_DRIVERLIST)) \
        $(USB_LIBUSB_DRIVERLIST) $(SNMP_DRIVERLIST)
 
$(foreach d,$(NUT_DRIVERS),$(eval $(call DriverPackage,$(d))))
 
define DriverDescription
  define Package/nut-driver-$(1)/description
    $(2)
  endef
endef
 
$(eval $(call DriverDescription,apcsmart,\
        Driver for American Power Conversion Smart Protocol UPS equipment))
$(eval $(call DriverDescription,apcsmart-old,\
        Driver for American Power Conversion Smart Protocol UPS equipment))
$(eval $(call DriverDescription,bcmxcp,\
        Driver for UPSes supporting the serial BCM/XCP protocol))
$(eval $(call DriverDescription,bcmxcp_usb,\
        Experimental driver for UPSes supporting the BCM/XCP protocol over USB))
$(eval $(call DriverDescription,belkin,\
        Driver for Belkin serial UPS equipment))
$(eval $(call DriverDescription,belkinunv,\
        Driver for Belkin "Universal UPS" and compatible))
$(eval $(call DriverDescription,bestfcom,\
        Driver for Best Power Fortress/Ferrups))
$(eval $(call DriverDescription,bestfortress,\
        Driver for old Best Fortress UPS equipment))
$(eval $(call DriverDescription,bestuferrups,\
        Driver for Best Power Micro-Ferrups))
$(eval $(call DriverDescription,bestups,\
        Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment))
$(eval $(call DriverDescription,blazer_ser,\
        Driver for Megatec/Q1 protocol serial))
$(eval $(call DriverDescription,blazer_usb,\
        Driver for Megatec/Q1 protocol USB))
$(eval $(call DriverDescription,clone,\
        UPS driver clone))
$(eval $(call DriverDescription,dummy-ups,\
        Driver for multi-purpose UPS emulation))
$(eval $(call DriverDescription,etapro,\
        Driver for ETA UPS equipment))
$(eval $(call DriverDescription,everups,\
        Driver for Ever UPS models))
$(eval $(call DriverDescription,gamatronic,\
        Driver for Gamatronic UPS equipment))
$(eval $(call DriverDescription,genericups,\
        Driver for contact-closure UPS equipment))
$(eval $(call DriverDescription,isbmex,\
        Driver for ISBMEX UPS equipment))
$(eval $(call DriverDescription,ivtscd,\
        driver for the IVT Solar Controller Device))
$(eval $(call DriverDescription,liebert,\
        Driver for Liebert contact-closure UPS equipment))
$(eval $(call DriverDescription,liebert-esp2,\
        Driver for Liebert UPS using the ESP-II protocol))
$(eval $(call DriverDescription,masterguard,\
        Driver for Masterguard UPS equipment))
$(eval $(call DriverDescription,metasys,\
        Driver for Meta System UPS equipment))
$(eval $(call DriverDescription,mge-shut,\
        Driver for SHUT Protocol UPS equipment))
$(eval $(call DriverDescription,mge-utalk,\
        Driver for MGE UPS SYSTEMS UTalk protocol equipment))
$(eval $(call DriverDescription,microdowell,\
        Driver for Microdowell Enterprise UPS series))
$(eval $(call DriverDescription,oldmge-shut,\
        Driver for SHUT Protocol UPS equipment))
$(eval $(call DriverDescription,oneac,\
        Driver for Oneac UPS equipment))
$(eval $(call DriverDescription,optiups,\
        Driver for Opti-UPS (Viewsonice) UPS and Zinto D (ONLINE-USV) equipment))
$(eval $(call DriverDescription,powercom,\
        UPS driver for Powercom/Trust/Advice UPS equipment))
$(eval $(call DriverDescription,powerpanel,\
        Driver for PowerPanel Plus compatible UPS equipment))
$(eval $(call DriverDescription,rhino,\
        Driver for Brazilian Microsol RHINO UPS equipment))
$(eval $(call DriverDescription,richcomm_usb,\
        Driver UPS equipment using Richcomm dry-contact to USB solution))
$(eval $(call DriverDescription,safenet,\
        Driver for SafeNet compatible UPS equipment))
$(eval $(call DriverDescription,solis,\
        Driver for Brazilian Microsol SOLIS UPS equipment))
$(eval $(call DriverDescription,tripplite,\
        Driver for Tripp-Lite SmartPro UPS equipment))
$(eval $(call DriverDescription,tripplitesu,\
        Driver for Tripp-Lite SmartOnline (SU) UPS equipment))
$(eval $(call DriverDescription,tripplite_usb,\
        Driver for older Tripp Lite USB UPSes (not PDC HID)))
$(eval $(call DriverDescription,upscode2,\
        Driver for UPScode II compatible UPS equipment))
$(eval $(call DriverDescription,usbhid-ups,\
        Driver for USB/HID UPS equipment))
$(eval $(call DriverDescription,victronups,\
        Driver for IMV/Victron UPS unit Match, Match Lite, NetUps))
$(eval $(call DriverDescription,snmp-ups,\
        Multi-MIB Driver for SNMP UPS equipment))
 
include $(INCLUDE_DIR)/package.mk
 
CONFIGURE_ARGS += \
  --without-ssl \
  --with-pidpath=/var/run \
  --with-statepath=/var/run \
  --with-altpidpath=/var/run \
  --sysconfdir=/etc/nut \
  --with-drvpath=/lib/nut \
  --datadir=/usr/share/nut \
  --with-user=root \
  --with-group=root \
  --with-usb \
  --with-snmp \
  --without-libltdl \
  --with-dev
 
 
$(eval $(call BuildPackage,nut))
$(eval $(call BuildPackage,nut-client))
$(eval $(call BuildPackage,nut-server))
$(eval $(call BuildPackage,nut-monitor))
$(eval $(call BuildPackage,nut-logger))
$(foreach d,$(NUT_DRIVERS),$(eval $(call BuildPackage,nut-driver-$(d))))
 
comments