fwknop: init script improvements
[feed/packages.git] / net / smartsnmpd / Makefile
1 #
2 # Copyright (C) 2014 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:=smartsnmpd
11 PKG_VERSION:=2015-02-22
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/credosemi/smartsnmp
16 PKG_SOURCE_VERSION:=ca1d455fd06748caa629fe7ad16a47cec8877b93
17 PKG_MIRROR_HASH:=fda89ec37944b4f800eb3c0147678745b57f08c87f10d246d3c9d165a43418b4
18
19 PKG_MAINTAINER:=Xiongfei Guo <xfguo@credosemi.com>
20 PKG_LICENSE:=GPL-2.0-or-later
21 PKG_LICENSE_FILES:=LICENSE
22
23 PKG_BUILD_DEPENDS:=scons/host
24
25 include $(INCLUDE_DIR)/package.mk
26 include ../../devel/scons/scons.mk
27
28 define Package/smartsnmpd
29 SECTION:=net
30 CATEGORY:=Network
31 DEPENDS+=+lua +liblua +libubox +libuci-lua +libubus-lua
32 TITLE:=Smart-SNMP (Agent)
33 URL:=https://github.com/credosemi/smartsnmp
34 endef
35
36 define Package/smartsnmpd/description
37 smartsnmpd is an implementation of SNMP Agent. Its goal is "Easily
38 writing boring SNMP MIB with Lua". This package add native support
39 for OpenWrt. Include using ubus and uci to get system info/status.
40 And, it use libubox/uloop as low level event-driven library.
41 endef
42
43 ifeq ($(CONFIG_BIG_ENDIAN),y)
44 TARGET_CFLAGS += -DBIG_ENDIAN
45 else
46 TARGET_CFLAGS += -DLITTLE_ENDIAN
47 endif
48
49 SCONS_OPTIONS += --transport=uloop
50
51 define Build/Configure
52 (cd $(PKG_BUILD_DIR); \
53 $(SCONS_VARS) \
54 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
55 scons \
56 prefix=/usr \
57 $(SCONS_OPTIONS) \
58 )
59 endef
60
61 define Package/smartsnmpd/install
62 $(INSTALL_DIR) $(1)/usr/sbin
63 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/smartsnmpd $(1)/usr/sbin/smartsnmpd
64
65 $(INSTALL_DIR) $(1)/usr/lib/lua/smartsnmp
66 $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/smartsnmp/core.so $(1)/usr/lib/lua/smartsnmp/core.so
67 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lualib/smartsnmp/*.lua $(1)/usr/lib/lua/smartsnmp/
68
69 $(INSTALL_DIR) $(1)/usr/lib/lua/smartsnmp/mibs
70 $(INSTALL_BIN) ./files/mibs/*.lua $(1)/usr/lib/lua/smartsnmp/mibs/
71
72 $(INSTALL_DIR) $(1)/etc/config
73 $(INSTALL_DATA) ./files/smartsnmpd.conf $(1)/etc/config/smartsnmpd
74
75 $(INSTALL_DIR) $(1)/etc/init.d
76 $(INSTALL_BIN) ./files/smartsnmpd.init $(1)/etc/init.d/smartsnmpd
77 endef
78
79 $(eval $(call BuildPackage,smartsnmpd))
80