5e4974c950e44dec3840bf9074585e586ae816ce
[feed/packages.git] / net / apcupsd / Makefile
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=apcupsd
11 PKG_VERSION:=3.14.14
12 PKG_RELEASE:=2
13
14 PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
15 PKG_LICENSE:=GPL-2.0
16 PKG_LICENSE_FILES:=COPYING
17
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=@SF/apcupsd
20 PKG_HASH:=db7748559b6b4c3784f9856561ef6ac6199ef7bd019b3edcd7e0a647bf8f9867
21
22 PKG_BUILD_DEPENDS:=libgd
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/apcupsd
27 SECTION:=net
28 CATEGORY:=Network
29 DEPENDS:=+libpthread +libusb-compat
30 TITLE:=UPS control software
31 URL:=http://www.apcupsd.org/
32 endef
33
34 define Package/apcupsd-cgi
35 SECTION:=net
36 CATEGORY:=Network
37 DEPENDS:=+libpthread +libgd
38 TITLE:=UPS control software CGI module
39 URL:=http://www.apcupsd.org/
40 endef
41
42 CONFIGURE_VARS += SHUTDOWN=/sbin/halt
43
44 define Build/Configure
45 $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/
46 $(call Build/Configure/Default, \
47 --with-distname=unknown \
48 --sysconfdir=/etc/apcupsd \
49 --enable-cgi \
50 --enable-usb \
51 --enable-modbus-usb \
52 --without-x \
53 )
54 endef
55
56 define Build/Compile
57 $(MAKE) -C $(PKG_BUILD_DIR) \
58 DESTDIR="$(PKG_INSTALL_DIR)" \
59 LD="$(TARGET_CC)" \
60 all install
61 endef
62
63 define Package/apcupsd/install
64 $(INSTALL_DIR) $(1)/usr/sbin
65 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/
66 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/
67 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/
68 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/
69 $(INSTALL_DIR) $(1)/etc/apcupsd
70 $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/
71 $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/
72 $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/
73 $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/
74 $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/
75 $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/
76 $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/
77 $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/
78 $(INSTALL_DIR) $(1)/etc/init.d
79 $(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd
80 endef
81
82 define Package/apcupsd-cgi/install
83 $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd
84 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/*.cgi $(1)/www/cgi-bin/apcupsd
85 $(INSTALL_DIR) $(1)/etc/apcupsd
86 $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/
87 $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/
88 $(INSTALL_CONF) ./files/multimon.conf $(1)/etc/apcupsd/
89 endef
90
91 define Package/apcupsd/conffiles
92 /etc/apcupsd/apcupsd.conf
93 /etc/apcupsd/apcupsd_mail.conf
94 /etc/apcupsd/changeme
95 /etc/apcupsd/commfailure
96 /etc/apcupsd/commok
97 /etc/apcupsd/offbattery
98 /etc/apcupsd/onbattery
99 endef
100
101 define Package/apcupsd-cgi/conffiles
102 /etc/apcupsd/apcupsd.css
103 /etc/apcupsd/hosts.conf
104 /etc/apcupsd/multimon.conf
105 endef
106
107 $(eval $(call BuildPackage,apcupsd))
108 $(eval $(call BuildPackage,apcupsd-cgi))