Merge pull request #4853 from StevenHessing/noddos
[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:=1
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 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 --enable-modbus-usb \
50 --without-x \
51 )
52 endef
53
54 define Build/Compile
55 $(MAKE) -C $(PKG_BUILD_DIR) \
56 DESTDIR="$(PKG_INSTALL_DIR)" \
57 LD="$(TARGET_CC)" \
58 all install
59 endef
60
61 define Package/apcupsd/install
62 $(INSTALL_DIR) $(1)/usr/sbin
63 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/
64 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/
65 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/
66 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/
67 $(INSTALL_DIR) $(1)/etc/apcupsd
68 $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/
69 $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/
70 $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/
71 $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/
72 $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/
73 $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/
74 $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/
75 $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/
76 $(INSTALL_DIR) $(1)/etc/init.d
77 $(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd
78 endef
79
80 define Package/apcupsd-cgi/install
81 $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd
82 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/*.cgi $(1)/www/cgi-bin/apcupsd
83 $(INSTALL_DIR) $(1)/etc/apcupsd
84 $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/
85 $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/
86 $(INSTALL_CONF) ./files/multimon.conf $(1)/etc/apcupsd/
87 endef
88
89 define Package/apcupsd/conffiles
90 /etc/apcupsd/apcupsd.conf
91 /etc/apcupsd/apcupsd_mail.conf
92 /etc/apcupsd/changeme
93 /etc/apcupsd/commfailure
94 /etc/apcupsd/commok
95 /etc/apcupsd/offbattery
96 /etc/apcupsd/onbattery
97 endef
98
99 define Package/apcupsd-cgi/conffiles
100 /etc/apcupsd/apcupsd.css
101 /etc/apcupsd/hosts.conf
102 /etc/apcupsd/multimon.conf
103 endef
104
105 $(eval $(call BuildPackage,apcupsd))
106 $(eval $(call BuildPackage,apcupsd-cgi))