Merge pull request #4853 from StevenHessing/noddos
[feed/packages.git] / utils / crelay / Makefile
1 #
2 # Copyright (C) 2015-2016 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:=crelay
11 PKG_VERSION:=0.10.1
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/ondrej1024/crelay
16 PKG_SOURCE_VERSION:=V$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_MIRROR_HASH:=e7cae6dcc299cbec86e6cbc79dd155a1489d97c9a46b3b4e5179a6ca11cc4b8b
19 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
20
21 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
22 PKG_LICENSE:=GPL-2.0
23 PKG_LICENSE_FILES:=LICENSE
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/nls.mk
27
28 define Package/crelay
29 SECTION:=utils
30 CATEGORY:=Utilities
31 TITLE:=USB relay remote control daemon
32 URL:=http://github.com/ondrej1024/crelay
33 DEPENDS:=+libftdi1 +hidapi +libusb-1.0
34 endef
35
36 define Package/crelay/description
37 crelay is used to control different relay cards in a unified manner. It provides
38 several interfaces for controlling the relays locally or remotely by a web browser
39 or a smartphone. The card which is detected first will be used. A WebUI control is
40 available on port 8000 (default)
41 .
42 Currently supported relay cards:
43 - Conrad USB 4-channel relay card
44 - Sainsmart USB 4/8-channel relay board
45 - Sainsmart USB 16-channel relay control module
46 - Generic GPIO relays
47 - HID API compatible relay card
48 endef
49
50 define Build/Configure
51 endef
52
53 TARGET_CFLAGS+= \
54 -D_GNU_SOURCE \
55 -I$(STAGING_DIR)/usr/include/libftdi1 \
56 -I$(STAGING_DIR)/usr/include/hidapi
57
58 TARGET_LDFLAGS+= $(if $(ICONV_FULL),-liconv)
59
60 define Build/Compile
61 $(MAKE) -C $(PKG_BUILD_DIR)/src \
62 CC="$(TARGET_CC)" \
63 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
64 LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
65 endef
66
67 define Package/crelay/install
68 $(INSTALL_DIR) $(1)/usr/bin
69 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/crelay $(1)/usr/bin/
70 $(INSTALL_DIR) $(1)/etc/init.d
71 $(INSTALL_BIN) ./files/crelay.init $(1)/etc/init.d/crelay
72 $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/crelay.conf $(1)/etc
73 endef
74
75 $(eval $(call BuildPackage,crelay))