summaryrefslogtreecommitdiffstats
path: root/utils/crelay/Makefile
blob: 04fa0ae26abf98af22ee82959d2c3493e2b2f574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=crelay
PKG_VERSION:=0.9
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ondrej1024/crelay
PKG_SOURCE_VERSION:=V$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/crelay
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=USB relay remote control daemon
  URL:=http://github.com/ondrej1024/crelay
  DEPENDS:=+libftdi1 +hidapi +libusb-1.0
endef

define Package/crelay/description
 crelay is used to control different relay cards in a unified manner. It provides
 several interfaces for controlling the relays locally or remotely by a web browser
 or a smartphone.  The card which is detected first will be used. A WebUI control is
 availble on port 8000 (default)
 .
 Currently supported relay cards:
      - Conrad USB 4-channel relay card
      - Sainsmart USB 4-channel relay card
      - Generic GPIO relays
      - HID API compatible relay card
endef

define Build/Configure
endef

TARGET_CFLAGS+= \
	-D_GNU_SOURCE \
	-I$(STAGING_DIR)/usr/include/libftdi1 \
	-I$(STAGING_DIR)/usr/include/hidapi

TARGET_LDFLAGS+= $(if $(ICONV_FULL),-liconv)

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR)/src \
		CC="$(TARGET_CC)" \
		CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
		LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"
endef

define Package/crelay/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/crelay $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/crelay.init $(1)/etc/init.d/crelay
	$(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/crelay.conf $(1)/etc
endef

$(eval $(call BuildPackage,crelay))