efcc87ca2c1c511409b014ae5e1525be751b282d
[feed/packages.git] / lang / lua-eco / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=lua-eco
4 PKG_VERSION:=2.4.0
5 PKG_RELEASE:=1
6
7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
8 PKG_SOURCE_URL=https://github.com/zhaojh329/lua-eco/releases/download/v$(PKG_VERSION)
9 PKG_HASH:=7dd3ae8c9548ad9f0bfcc9a95e77c6f24ef868d3dd21983c5b940f738360ff9b
10
11 PKG_MAINTAINER:=Jianhui Zhao <zhaojh329@gmail.com>
12 PKG_LICENSE:=MIT
13 PKG_LICENSE_FILES:=LICENSE
14
15 PKG_CONFIG_DEPENDS:= \
16 LUA_ECO_OPENSSL \
17 LUA_ECO_WOLFSSL \
18 LUA_ECO_MBEDTLS
19
20 include $(INCLUDE_DIR)/package.mk
21 include $(INCLUDE_DIR)/cmake.mk
22
23 define Package/lua-eco
24 TITLE:=A Lua interpreter with a built-in libev event loop
25 SECTION:=lang
26 CATEGORY:=Languages
27 SUBMENU:=Lua
28 URL:=https://github.com/zhaojh329/lua-eco
29 DEPENDS:=+libev +liblua +luabitop
30 endef
31
32 define Package/lua-eco/description
33 Lua-eco is a Lua interpreter with a built-in event loop for scheduling
34 lightweight coroutines automatically, enabling efficient concurrency in
35 Lua. Build high-performance, scalable applications.
36 endef
37
38 define Package/lua-eco/Module
39 TITLE:=$1 support for lua-eco
40 SECTION:=lang
41 CATEGORY:=Languages
42 SUBMENU:=Lua
43 URL:=https://github.com/zhaojh329/lua-eco
44 DEPENDS:=+lua-eco $2
45 endef
46
47 Package/lua-eco-log=$(call Package/lua-eco/Module,log utils)
48 Package/lua-eco-sys=$(call Package/lua-eco/Module,system utils)
49 Package/lua-eco-file=$(call Package/lua-eco/Module,file utils)
50 Package/lua-eco-base64=$(call Package/lua-eco/Module,base64)
51 Package/lua-eco-sha1=$(call Package/lua-eco/Module,sha1)
52 Package/lua-eco-md5=$(call Package/lua-eco/Module,md5)
53 Package/lua-eco-socket=$(call Package/lua-eco/Module,socket,+lua-eco-file +lua-eco-sys)
54 Package/lua-eco-dns=$(call Package/lua-eco/Module,dns,+lua-eco-socket)
55 Package/lua-eco-ssl=$(call Package/lua-eco/Module,ssl,\
56 +LUA_ECO_OPENSSL:libopenssl +LUA_ECO_WOLFSSL:libwolfssl \
57 +LUA_ECO_MBEDTLS:libmbedtls +LUA_ECO_MBEDTLS:zlib +lua-eco-socket)
58 Package/lua-eco-ubus=$(call Package/lua-eco/Module,ubus,+libubus)
59 Package/lua-eco-http=$(call Package/lua-eco/Module,http/https,+lua-eco-dns +lua-eco-ssl +lua-eco-log)
60 Package/lua-eco-mqtt=$(call Package/lua-eco/Module,mqtt,+lua-eco-socket +lua-eco-dns +lua-mosquitto)
61 Package/lua-eco-websocket=$(call Package/lua-eco/Module,websocket,+lua-eco-http +lua-eco-base64 +lua-eco-sha1)
62 Package/lua-eco-termios=$(call Package/lua-eco/Module,termios)
63 Package/lua-eco-struct=$(call Package/lua-eco/Module,struct pack)
64 Package/lua-eco-netlink=$(call Package/lua-eco/Module,netlink,+lua-eco-socket)
65 Package/lua-eco-ip=$(call Package/lua-eco/Module,ip utils,+lua-eco-netlink)
66 Package/lua-eco-nl80211=$(call Package/lua-eco/Module,nl80211,+lua-eco-netlink)
67
68 define Package/lua-eco-ssl/config
69 choice
70 prompt "SSL Library"
71 default LUA_ECO_MBEDTLS
72
73 config LUA_ECO_OPENSSL
74 bool "OpenSSL"
75
76 config LUA_ECO_WOLFSSL
77 bool "wolfSSL"
78
79 config LUA_ECO_MBEDTLS
80 bool "mbedTLS"
81 endchoice
82 endef
83
84 CMAKE_OPTIONS += \
85 -DPLATFORM="openwrt" \
86 -DECO_UBUS_SUPPORT=O$(if $(CONFIG_PACKAGE_lua-eco-ubus),N,FF) \
87 -DECO_SSL_SUPPORT=O$(if $(CONFIG_PACKAGE_lua-eco-ssl),N,FF)
88
89 ifneq ($(CONFIG_PACKAGE_lua-eco-ssl),)
90 ifneq ($(CONFIG_LUA_ECO_OPENSSL),)
91 CMAKE_OPTIONS += -DUSE_OPENSSL=ON
92 else ifneq ($(CONFIG_LUA_ECO_WOLFSSL),)
93 CMAKE_OPTIONS += -DUSE_WOLFSSL=ON
94 else ifneq ($(CONFIG_LUA_ECO_MBEDTLS),)
95 CMAKE_OPTIONS += -DUSE_MBEDTLS=ON
96 endif
97 endif
98
99 define Package/lua-eco/install
100 $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/lua/eco/core $(1)/usr/lib/lua/eco/encoding
101 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/eco $(1)/usr/bin
102 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/encoding/hex.lua $(1)/usr/lib/lua/eco/encoding
103 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/{time,bufio}.so $(1)/usr/lib/lua/eco/core
104 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/{time,bufio,bit,sync}.lua $(1)/usr/lib/lua/eco
105 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/binary.so $(1)/usr/lib/lua/eco
106 endef
107
108 define Package/lua-eco-log/install
109 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
110 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/log.so $(1)/usr/lib/lua/eco
111 endef
112
113 define Package/lua-eco-sys/install
114 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
115 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/sys.lua $(1)/usr/lib/lua/eco
116 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/sys.so $(1)/usr/lib/lua/eco/core
117 endef
118
119 define Package/lua-eco-file/install
120 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
121 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/file.lua $(1)/usr/lib/lua/eco
122 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/file.so $(1)/usr/lib/lua/eco/core
123 endef
124
125 define Package/lua-eco-base64/install
126 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/encoding
127 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/encoding/base64.so $(1)/usr/lib/lua/eco/encoding
128 endef
129
130 define Package/lua-eco-sha1/install
131 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/crypto
132 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/crypto/sha1.so $(1)/usr/lib/lua/eco/crypto
133 endef
134
135 define Package/lua-eco-md5/install
136 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/crypto
137 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/crypto/md5.so $(1)/usr/lib/lua/eco/crypto
138 endef
139
140 define Package/lua-eco-socket/install
141 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
142 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/socket.lua $(1)/usr/lib/lua/eco
143 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/socket.so $(1)/usr/lib/lua/eco/core
144 endef
145
146 define Package/lua-eco-dns/install
147 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
148 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/dns.lua $(1)/usr/lib/lua/eco
149 endef
150
151 define Package/lua-eco-ssl/install
152 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
153 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/ssl.lua $(1)/usr/lib/lua/eco
154 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/ssl.so $(1)/usr/lib/lua/eco/core
155 endef
156
157 define Package/lua-eco-ubus/install
158 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
159 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/ubus.lua $(1)/usr/lib/lua/eco
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/ubus.so $(1)/usr/lib/lua/eco/core
161 endef
162
163 define Package/lua-eco-http/install
164 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
165 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/{url,http}.lua $(1)/usr/lib/lua/eco
166 endef
167
168 define Package/lua-eco-mqtt/install
169 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
170 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/mqtt.lua $(1)/usr/lib/lua/eco
171 endef
172
173 define Package/lua-eco-websocket/install
174 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
175 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/websocket.lua $(1)/usr/lib/lua/eco
176 endef
177
178 define Package/lua-eco-termios/install
179 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
180 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/termios.so $(1)/usr/lib/lua/eco
181 endef
182
183 define Package/lua-eco-struct/install
184 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
185 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/struct.so $(1)/usr/lib/lua/eco
186 endef
187
188 define Package/lua-eco-netlink/install
189 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
190 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/{nl,genl}.lua $(1)/usr/lib/lua/eco
191 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/{nl,genl}.so $(1)/usr/lib/lua/eco/core
192 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/rtnl.so $(1)/usr/lib/lua/eco
193 endef
194
195 define Package/lua-eco-ip/install
196 $(INSTALL_DIR) $(1)/usr/lib/lua/eco
197 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/ip.lua $(1)/usr/lib/lua/eco
198 endef
199
200 define Package/lua-eco-nl80211/install
201 $(INSTALL_DIR) $(1)/usr/lib/lua/eco/core
202 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/nl80211.lua $(1)/usr/lib/lua/eco
203 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/eco/core/nl80211.so $(1)/usr/lib/lua/eco/core
204 endef
205
206 $(eval $(call BuildPackage,lua-eco))
207 $(eval $(call BuildPackage,lua-eco-log))
208 $(eval $(call BuildPackage,lua-eco-sys))
209 $(eval $(call BuildPackage,lua-eco-file))
210 $(eval $(call BuildPackage,lua-eco-base64))
211 $(eval $(call BuildPackage,lua-eco-sha1))
212 $(eval $(call BuildPackage,lua-eco-md5))
213 $(eval $(call BuildPackage,lua-eco-socket))
214 $(eval $(call BuildPackage,lua-eco-dns))
215 $(eval $(call BuildPackage,lua-eco-ssl))
216 $(eval $(call BuildPackage,lua-eco-ubus))
217 $(eval $(call BuildPackage,lua-eco-http))
218 $(eval $(call BuildPackage,lua-eco-mqtt))
219 $(eval $(call BuildPackage,lua-eco-websocket))
220 $(eval $(call BuildPackage,lua-eco-termios))
221 $(eval $(call BuildPackage,lua-eco-netlink))
222 $(eval $(call BuildPackage,lua-eco-ip))
223 $(eval $(call BuildPackage,lua-eco-nl80211))