apcupsd: add cgi module
[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.13
12 PKG_RELEASE:=3
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_MD5SUM:=c291d9d3923b4d9c0e600b755ad4f489
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
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 define Build/Configure
43 $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/
44 $(call Build/Configure/Default, \
45 --with-distname=unknown \
46 --sysconfdir=/etc/apcupsd \
47 --enable-cgi \
48 --enable-usb \
49 --without-x \
50 )
51 endef
52
53 define Build/Compile
54 $(MAKE) -C $(PKG_BUILD_DIR) \
55 DESTDIR="$(PKG_INSTALL_DIR)" \
56 LD="$(TARGET_CC)" \
57 all install
58 endef
59
60 define Package/apcupsd/install
61 $(INSTALL_DIR) $(1)/usr/sbin
62 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/
63 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/
64 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/
65 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/
66 $(INSTALL_DIR) $(1)/etc/apcupsd
67 $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/
68 $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/
69 $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/
70 $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/
71 $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/
72 $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/
73 $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/
74 $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/
75 $(INSTALL_DIR) $(1)/etc/init.d
76 $(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd
77 endef
78
79 define Package/apcupsd-cgi/install
80 $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd
81 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/multimon.cgi $(1)/www/cgi-bin/apcupsd
82 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsfstats.cgi $(1)/www/cgi-bin/apcupsd
83 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsimage.cgi $(1)/www/cgi-bin/apcupsd
84 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/upsstats.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 endef
89
90 define Package/apcupsd/conffiles
91 /etc/apcupsd/apcupsd.conf
92 /etc/apcupsd/apcupsd_mail.conf
93 /etc/apcupsd/changeme
94 /etc/apcupsd/commfailure
95 /etc/apcupsd/commok
96 /etc/apcupsd/offbattery
97 /etc/apcupsd/onbattery
98 endef
99
100 define Package/apcupsd-cgi/conffiles
101 /etc/apcupsd/apcupsd.css
102 /etc/apcupsd/hosts.conf
103 endef
104
105 $(eval $(call BuildPackage,apcupsd))
106 $(eval $(call BuildPackage,apcupsd-cgi))