2 # Copyright (C) 2020-2021 Jo-Philipp Wich <jo@mein.io>
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE_URL
=https
://github.com
/jow-
/ucode.git
15 PKG_SOURCE_DATE
:=2023-10-19
16 PKG_SOURCE_VERSION
:=07c03173d4e6a30953f92fa88ed29b0b956c9106
17 PKG_MIRROR_HASH
:=fd770335f442ebfc0f4e28d94bb60d886c43aa239ab88e965be7c490b3283a82
18 PKG_MAINTAINER
:=Jo-Philipp Wich
<jo@mein.io
>
21 PKG_ABI_VERSION
:=20230711
23 include $(INCLUDE_DIR
)/package.mk
24 include $(INCLUDE_DIR
)/host-build.mk
25 include $(INCLUDE_DIR
)/cmake.mk
27 CMAKE_OPTIONS
+= -DSOVERSION
=$(PKG_ABI_VERSION
)
28 CMAKE_HOST_OPTIONS
+= \
29 -DSOVERSION
=$(PKG_ABI_VERSION
) \
32 -DNL80211_SUPPORT
=OFF \
33 -DRESOLV_SUPPORT
=OFF \
43 define Package
/ucode
/default
47 TITLE
:=Tiny scripting and templating language
51 $(Package
/ucode
/default
)
55 define Package
/ucode
/description
56 ucode is a tiny script interpreter featuring an ECMAScript oriented
57 script language and Jinja-inspired templating.
61 define Package
/libucode
62 $(Package
/ucode
/default
)
67 ABI_VERSION
:=$(PKG_ABI_VERSION
)
71 define Package
/libucode
/description
72 The libucode package provides the shared runtime library for the ucode interpreter.
80 UCODE_MODULES
+= ucode-mod-
$(strip $(1))
81 CMAKE_OPTIONS
+= -D
$(strip $(2))=$(if
$(CONFIG_PACKAGE_ucode-mod-
$(strip $(1))),ON
,OFF
)
82 PKG_CONFIG_DEPENDS
+= CONFIG_PACKAGE_ucode-mod-
$(strip $(1))
84 define Package
/ucode-mod-
$(strip $(1))
85 $(Package
/ucode
/default
)
86 TITLE
+= ($(strip $(1)) module
)
90 define Package
/ucode-mod-
$(strip $(1))/description
94 define Package
/ucode-mod-
$(strip $(1))/install
95 $(INSTALL_DIR
) $$(1)/usr
/lib
/ucode
96 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/ucode
/$(strip $(1)).so
$$(1)/usr
/lib
/ucode
/
101 define Build
/InstallDev
102 $(INSTALL_DIR
) $(1)/usr
/lib
$(1)/usr
/include/ucode
103 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/ucode
/*.h
$(1)/usr
/include/ucode
/
104 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so
* $(1)/usr
/lib
/
108 define Package
/ucode
/install
109 $(INSTALL_DIR
) $(1)/usr
/bin
110 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/u
* $(1)/usr
/bin
/
113 define Package
/libucode
/install
114 $(INSTALL_DIR
) $(1)/usr
/lib
115 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so.
* $(1)/usr
/lib
/
119 $(eval
$(call UcodeModule
, \
120 debug
, DEBUG_SUPPORT
, +libubox
+libucode
, \
121 The debug plugin module provides runtime debugging and introspection facilities.
))
123 $(eval
$(call UcodeModule
, \
125 The filesystem plugin module allows interaction with the local file system.
))
127 $(eval
$(call UcodeModule
, \
128 log
, LOG_SUPPORT
, +libubox
, \
129 The log plugin module provides access to the syslog and libubox ulog APIs.
))
131 $(eval
$(call UcodeModule
, \
132 math
, MATH_SUPPORT
, , \
133 The math plugin provides access to various
<math.h
> procedures.
))
135 $(eval
$(call UcodeModule
, \
136 nl80211
, NL80211_SUPPORT
, +libnl-tiny
+libubox
, \
137 The nl80211 plugin provides access to the Linux wireless
802.11 netlink API.
))
139 $(eval
$(call UcodeModule
, \
140 resolv
, RESOLV_SUPPORT
, , \
141 The resolv plugin implements simple DNS resolving.
))
143 $(eval
$(call UcodeModule
, \
144 rtnl
, RTNL_SUPPORT
, +libnl-tiny
+libubox
, \
145 The rtnl plugin provides access to the Linux routing netlink API.
))
147 $(eval
$(call UcodeModule
, \
148 struct
, STRUCT_SUPPORT
, , \
149 The struct plugin implements Python
3 compatible struct.pack
/unpack functionality.
))
151 $(eval
$(call UcodeModule
, \
152 ubus
, UBUS_SUPPORT
, +libubus
+libblobmsg-json
, \
153 The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.
))
155 $(eval
$(call UcodeModule
, \
156 uci
, UCI_SUPPORT
, +libuci
, \
157 The uci module allows templates to read and modify uci configuration.
))
159 $(eval
$(call UcodeModule
, \
160 uloop
, ULOOP_SUPPORT
, +libubox
, \
161 The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.
))
163 $(eval
$(call BuildPackage
,libucode
))
164 $(eval
$(call BuildPackage
,ucode
))
166 $(foreach mod
,$(UCODE_MODULES
), \
167 $(eval
$(call BuildPackage
,$(mod
))))
169 $(eval
$(call HostBuild
))