You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

293 lines
13 KiB

  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=nut
  9. PKG_VERSION:=2.7.3
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
  13. PKG_MD5SUM:=a1a7f747093663e1f39ab595b63b45e4
  14. PKG_MAINTAINER:=Martin Rowe <martin.p.rowe@gmail.com>
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_LICENSE_FILES:=LICENSE-GPL2
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/nut-$(PKG_VERSION)
  18. PKG_INSTALL:=1
  19. PKG_CONFIG_DEPENDS:= \
  20. CONFIG_NUT_CLIENTS_UPSC \
  21. CONFIG_NUT_CLIENTS_UPSCMD \
  22. CONFIG_NUT_CLIENTS_UPSLOG \
  23. CONFIG_NUT_CLIENTS_UPSMON \
  24. CONFIG_NUT_CLIENTS_UPSRW \
  25. CONFIG_NUT_CLIENTS_UPSSCHED \
  26. CONFIG_NUT_DRIVER_SERIAL \
  27. CONFIG_NUT_DRIVER_SNMP \
  28. CONFIG_NUT_DRIVER_USB \
  29. CONFIG_NUT_SERVER \
  30. CONFIG_NUT_SSL \
  31. include $(INCLUDE_DIR)/package.mk
  32. define Package/nut/Default
  33. SECTION:=net
  34. CATEGORY:=Network
  35. URL:=http://www.networkupstools.org/
  36. DEPENDS:=nut
  37. endef
  38. define Package/nut/description
  39. Network UPS Tools (NUT) is a client/server monitoring system that
  40. allows computers to share uninterruptible power supply (UPS) and
  41. power distribution unit (PDU) hardware. Clients access the hardware
  42. through the server, and are notified whenever the power status
  43. changes.
  44. endef
  45. define Package/nut
  46. $(call Package/nut/Default)
  47. TITLE:=Network UPS Tools
  48. DEPENDS:= \
  49. +libpthread \
  50. +NUT_DRIVER_SNMP:libnetsnmp \
  51. +NUT_DRIVER_USB:libusb-compat \
  52. +NUT_SSL:libopenssl
  53. MENU:=1
  54. endef
  55. define Package/nut/config
  56. source "$(SOURCE)/Config.in"
  57. endef
  58. define Package/nut/conffiles
  59. /etc/nut/nut.conf
  60. $(if $(CONFIG_NUT_CLIENTS_UPSMON),/etc/nut/upsmon.conf)
  61. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),/etc/nut/upssched.conf)
  62. $(if $(CONFIG_NUT_SERVER),/etc/nut/ups.conf)
  63. $(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.conf)
  64. $(if $(CONFIG_NUT_SERVER),/etc/nut/upsd.users)
  65. endef
  66. define Package/nut/install
  67. $(INSTALL_DIR) $(1)/etc/nut
  68. $(INSTALL_DIR) $(1)/usr/bin
  69. $(INSTALL_DIR) $(1)/usr/bin
  70. $(INSTALL_DIR) $(1)/usr/lib
  71. $(INSTALL_DIR) $(1)/usr/sbin
  72. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/nut.conf.sample $(1)/etc/nut/nut.conf
  73. $(if $(or $(CONFIG_NUT_CLIENTS_UPSC),\
  74. $(CONFIG_NUT_CLIENTS_UPSCMD),\
  75. $(CONFIG_NUT_CLIENTS_LOG),\
  76. $(CONFIG_NUT_CLIENTS_UPSRW),\
  77. $(CONFIG_NUT_CLIENTS_UPSMON),\
  78. $(CONFIG_NUT_CLIENTS_UPSSCHED)),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libupsclient.so* $(1)/usr/lib/)
  79. $(if $(or $(CONFIG_NUT_SERVER),\
  80. $(CONFIG_NUT_CLIENTS_UPSMON)),$(INSTALL_DIR) $(1)/etc/init.d)
  81. $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/lib/nut)
  82. $(if $(CONFIG_NUT_SERVER),$(INSTALL_DIR) $(1)/usr/share/nut)
  83. $(if $(CONFIG_NUT_SERVER),$(CP) ./files/nut-server.init $(1)/etc/init.d/)
  84. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin)
  85. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsdrvctl $(1)/usr/sbin)
  86. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/)
  87. $(if $(CONFIG_NUT_SERVER),$(CP) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/)
  88. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/ups.conf.sample $(1)/etc/nut/ups.conf)
  89. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.conf.sample $(1)/etc/nut/upsd.conf)
  90. $(if $(CONFIG_NUT_SERVER),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsd.users.sample $(1)/etc/nut/upsd.users)
  91. $(if $(CONFIG_NUT_CLIENTS_UPSC),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsc $(1)/usr/bin/)
  92. $(if $(CONFIG_NUT_CLIENTS_UPSCMD),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upscmd $(1)/usr/bin/)
  93. $(if $(CONFIG_NUT_CLIENTS_LOG),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upslog $(1)/usr/bin/)
  94. $(if $(CONFIG_NUT_CLIENTS_UPSRW),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upsrw $(1)/usr/bin/)
  95. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) ./files/nut-monitor.init $(1)/etc/init.d/)
  96. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upsmon $(1)/usr/sbin/)
  97. $(if $(CONFIG_NUT_CLIENTS_UPSMON),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upsmon.conf.sample $(1)/etc/nut/upsmon.conf)
  98. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/bin/upssched-cmd $(1)/usr/bin/)
  99. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(CP) $(PKG_INSTALL_DIR)/usr/sbin/upssched $(1)/usr/sbin/)
  100. $(if $(CONFIG_NUT_CLIENTS_UPSSCHED),$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/nut/upssched.conf.sample $(1)/etc/nut/upssched.conf)
  101. endef
  102. # Dealing with all of the drivers is very repetitive, but the previous
  103. # maintainer had a neat solution which just needed some tweaking.
  104. define DriverPackage
  105. define Package/nut-driver-$(2)
  106. $(call Package/nut/Default)
  107. TITLE:=$(2) (NUT $(1) driver)
  108. $(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL)
  109. $(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP)
  110. $(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB)
  111. endef
  112. # Deliberately empty description in order to trigger a build failure.
  113. # It should be overridden by the list below, and when updating to a
  114. # new version of nut we will need to provide descriptions for any new
  115. # drivers.
  116. define Package/nut-driver-$(2)/description
  117. endef
  118. define Package/nut-driver-$(2)/install
  119. $(INSTALL_DIR) $$(1)/lib/nut
  120. $(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2) $$(1)/lib/nut/
  121. $(if $(filter $(2),clone),$(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2)-outlet $$(1)/lib/nut/)
  122. endef
  123. endef
  124. define DriverDescription
  125. define Package/nut-driver-$(2)/description
  126. $(3)
  127. endef
  128. endef
  129. # These lists are lifted *directly* from drivers/Makefile.am in the nut
  130. # source tree. This it to make it simpler to keep in sync when updating
  131. # to a newer version of nut. Do not edit this manually.
  132. #
  133. # DO NOT EDIT (except to update with a fresh cut/paste)!
  134. SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \
  135. bestfortress bestuferrups bestups dummy-ups etapro everups \
  136. gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \
  137. oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \
  138. safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \
  139. blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser \
  140. nutdrv_qx
  141. SNMP_DRIVERLIST = snmp-ups
  142. USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \
  143. blazer_usb richcomm_usb riello_usb \
  144. nutdrv_atcl_usb \
  145. nutdrv_qx
  146. # END: DO NOT EDIT!
  147. SERIAL_DRIVERLIST_IGNORE:=skel clone-outlet nutdrv_qx
  148. # nutdrv_qx can be either USB or serial. Given most routers have USB
  149. # instead of serial ports, and not wanting two identical packages with
  150. # different names that conflict with each other, only the option for the
  151. # driver with USB bindings is provided. If you really want to save that
  152. # tiny bit of space and build it without USB support, remove nutdrv_qx
  153. # from the previous line.
  154. $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call DriverPackage,serial,$(d))))
  155. $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call DriverPackage,snmp,$(d))))
  156. $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call DriverPackage,usb,$(d))))
  157. $(eval $(call DriverDescription,serial,al175,\
  158. Driver for Eltek UPS models with AL175 alarm module))
  159. $(eval $(call DriverDescription,serial,bcmxcp,\
  160. Driver for UPSes supporting the serial BCM/XCP protocol))
  161. $(eval $(call DriverDescription,serial,belkin,\
  162. Driver for Belkin serial UPS equipment))
  163. $(eval $(call DriverDescription,serial,belkinunv,\
  164. Driver for Belkin "Universal UPS" and compatible))
  165. $(eval $(call DriverDescription,serial,bestfcom,\
  166. Driver for Best Power Fortress/Ferrups))
  167. $(eval $(call DriverDescription,serial,bestfortress,\
  168. Driver for old Best Fortress UPS equipment))
  169. $(eval $(call DriverDescription,serial,bestuferrups,\
  170. Driver for Best Power Micro-Ferrups))
  171. $(eval $(call DriverDescription,serial,bestups,\
  172. Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment))
  173. $(eval $(call DriverDescription,serial,dummy-ups,\
  174. Driver for multi-purpose UPS emulation))
  175. $(eval $(call DriverDescription,serial,etapro,\
  176. Driver for ETA UPS equipment))
  177. $(eval $(call DriverDescription,serial,everups,\
  178. Driver for Ever UPS models))
  179. $(eval $(call DriverDescription,serial,gamatronic,\
  180. Driver for Gamatronic UPS equipment))
  181. $(eval $(call DriverDescription,serial,genericups,\
  182. Driver for contact-closure UPS equipment))
  183. $(eval $(call DriverDescription,serial,isbmex,\
  184. Driver for ISBMEX UPS equipment))
  185. $(eval $(call DriverDescription,serial,liebert,\
  186. Driver for Liebert contact-closure UPS equipment))
  187. $(eval $(call DriverDescription,serial,liebert-esp2,\
  188. Driver for Liebert UPS, using the ESP-II serial protocol))
  189. $(eval $(call DriverDescription,serial,masterguard,\
  190. Driver for Masterguard UPS equipment))
  191. $(eval $(call DriverDescription,serial,metasys,\
  192. Driver for Meta System UPS equipment))
  193. $(eval $(call DriverDescription,serial,oldmge-shut,\
  194. Driver for SHUT Protocol UPS equipment, deprecated, use mge-shut))
  195. $(eval $(call DriverDescription,serial,mge-utalk,\
  196. Driver for MGE UPS SYSTEMS UTalk protocol equipment))
  197. $(eval $(call DriverDescription,serial,microdowell,\
  198. Driver for Microdowell Enterprise UPS series))
  199. $(eval $(call DriverDescription,serial,mge-shut,\
  200. Driver for SHUT Protocol UPS equipment))
  201. $(eval $(call DriverDescription,serial,oneac,\
  202. Driver for Oneac UPS equipment))
  203. $(eval $(call DriverDescription,serial,optiups,\
  204. Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment))
  205. $(eval $(call DriverDescription,serial,powercom,\
  206. Driver for serial Powercom/Trust/Advice UPS equipment))
  207. $(eval $(call DriverDescription,serial,rhino,\
  208. Driver for Brazilian Microsol RHINO UPS equipment))
  209. $(eval $(call DriverDescription,serial,safenet,\
  210. Driver for SafeNet compatible UPS equipment))
  211. $(eval $(call DriverDescription,serial,solis,\
  212. Driver for Brazilian Microsol SOLIS UPS equipment))
  213. $(eval $(call DriverDescription,serial,tripplite,\
  214. Driver for Tripp-Lite SmartPro UPS equipment))
  215. $(eval $(call DriverDescription,serial,tripplitesu,\
  216. Driver for Tripp-Lite SmartOnline (SU) UPS equipment))
  217. $(eval $(call DriverDescription,serial,upscode2,\
  218. Driver for UPScode II compatible UPS equipment))
  219. $(eval $(call DriverDescription,serial,victronups,\
  220. Driver for IMV/Victron UPS unit Match, Match Lite, NetUps))
  221. $(eval $(call DriverDescription,serial,powerpanel,\
  222. Driver for PowerPanel Plus compatible UPS equipment))
  223. $(eval $(call DriverDescription,serial,blazer_ser,\
  224. Driver for Megatec/Q1 protocol serial based UPS equipment))
  225. $(eval $(call DriverDescription,serial,clone,\
  226. UPS driver clone))
  227. $(eval $(call DriverDescription,serial,ivtscd,\
  228. Driver for the IVT Solar Controller Device))
  229. $(eval $(call DriverDescription,serial,apcsmart,\
  230. Driver for American Power Conversion Smart Protocol UPS equipment))
  231. $(eval $(call DriverDescription,serial,apcsmart-old,\
  232. Driver for American Power Conversion Smart Protocol UPS equipment))
  233. $(eval $(call DriverDescription,serial,apcupsd-ups,\
  234. Driver for apcupsd client access))
  235. $(eval $(call DriverDescription,serial,riello_ser,\
  236. Driver for Riello UPS Protocol UPS equipment))
  237. $(eval $(call DriverDescription,snmp,snmp-ups,\
  238. Multi-MIB Driver for SNMP UPS equipment))
  239. $(eval $(call DriverDescription,usb,usbhid-ups,\
  240. Driver for USB/HID UPS equipment))
  241. $(eval $(call DriverDescription,usb,bcmxcp_usb,\
  242. Experimental driver for UPSes supporting the BCM/XCP protocol over USB))
  243. $(eval $(call DriverDescription,usb,tripplite_usb,\
  244. Driver for older Tripp Lite USB UPSes (not PDC HID)))
  245. $(eval $(call DriverDescription,usb,blazer_usb,\
  246. Driver for Megatec/Q1 protocol USB based UPS equipment))
  247. $(eval $(call DriverDescription,usb,richcomm_usb,\
  248. Driver for UPS equipment using Richcomm dry-contact to USB solution))
  249. $(eval $(call DriverDescription,usb,riello_usb,\
  250. Driver for Riello UPS Protocol UPS equipment via USB))
  251. $(eval $(call DriverDescription,usb,nutdrv_atcl_usb,\
  252. Driver for ATCL FOR UPS equipment))
  253. $(eval $(call DriverDescription,usb,nutdrv_qx,\
  254. Driver for Q* protocol serial and USB based UPS equipment))
  255. CONFIGURE_ARGS += \
  256. --$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \
  257. --$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
  258. --$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \
  259. --without-neon \
  260. --without-powerman \
  261. --without-ipmi \
  262. --without-freeipmi \
  263. --$(if $(CONFIG_NUT_SSL),with,without)-ssl $(if $(CONFIG_NUT_SSL),--with-openssl) \
  264. --without-avahi \
  265. --without-libltdl \
  266. --with-user=root \
  267. --with-group=root \
  268. --sysconfdir=/etc/nut \
  269. --with-drvpath=/lib/nut \
  270. --with-statepath=/var/run \
  271. --datadir=/usr/share/nut
  272. $(eval $(call BuildPackage,nut))
  273. $(foreach d,$(filter-out $(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call BuildPackage,nut-driver-$(d))))
  274. $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))
  275. $(foreach d,$(USB_LIBUSB_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d))))