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-11-02
16 PKG_SOURCE_VERSION
:=cfb24ea4f12131dcefe4f1ede2f51d3d16b88dec
17 PKG_MIRROR_HASH
:=f515a23ab438f92be5788c42b9f614a82e670de2df1c01cd63143cdc77fa24fe
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
)
29 ifeq ($(HOST_OS
),Darwin
)
30 CMAKE_HOST_OPTIONS
+= \
31 -DCMAKE_SKIP_RPATH
=FALSE \
32 -DCMAKE_MACOSX_RPATH
=1 \
33 -DCMAKE_INSTALL_RPATH
="${STAGING_DIR_HOSTPKG}/lib"
35 CMAKE_HOST_OPTIONS
+= \
36 -DSOVERSION
=$(PKG_ABI_VERSION
)
39 CMAKE_HOST_OPTIONS
+= \
42 -DNL80211_SUPPORT
=OFF \
43 -DRESOLV_SUPPORT
=OFF \
53 define Package
/ucode
/default
57 TITLE
:=Tiny scripting and templating language
61 $(Package
/ucode
/default
)
65 define Package
/ucode
/description
66 ucode is a tiny script interpreter featuring an ECMAScript oriented
67 script language and Jinja-inspired templating.
71 define Package
/libucode
72 $(Package
/ucode
/default
)
77 ABI_VERSION
:=$(PKG_ABI_VERSION
)
81 define Package
/libucode
/description
82 The libucode package provides the shared runtime library for the ucode interpreter.
90 UCODE_MODULES
+= ucode-mod-
$(strip $(1))
91 CMAKE_OPTIONS
+= -D
$(strip $(2))=$(if
$(CONFIG_PACKAGE_ucode-mod-
$(strip $(1))),ON
,OFF
)
92 PKG_CONFIG_DEPENDS
+= CONFIG_PACKAGE_ucode-mod-
$(strip $(1))
94 define Package
/ucode-mod-
$(strip $(1))
95 $(Package
/ucode
/default
)
96 TITLE
+= ($(strip $(1)) module
)
100 define Package
/ucode-mod-
$(strip $(1))/description
104 define Package
/ucode-mod-
$(strip $(1))/install
105 $(INSTALL_DIR
) $$(1)/usr
/lib
/ucode
106 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/ucode
/$(strip $(1)).so
$$(1)/usr
/lib
/ucode
/
111 define Build
/InstallDev
112 $(INSTALL_DIR
) $(1)/usr
/lib
$(1)/usr
/include/ucode
113 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/ucode
/*.h
$(1)/usr
/include/ucode
/
114 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so
* $(1)/usr
/lib
/
118 define Package
/ucode
/install
119 $(INSTALL_DIR
) $(1)/usr
/bin
120 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/u
* $(1)/usr
/bin
/
123 define Package
/libucode
/install
124 $(INSTALL_DIR
) $(1)/usr
/lib
125 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so.
* $(1)/usr
/lib
/
129 $(eval
$(call UcodeModule
, \
130 debug
, DEBUG_SUPPORT
, +libubox
+libucode
, \
131 The debug plugin module provides runtime debugging and introspection facilities.
))
133 $(eval
$(call UcodeModule
, \
135 The filesystem plugin module allows interaction with the local file system.
))
137 $(eval
$(call UcodeModule
, \
138 log
, LOG_SUPPORT
, +libubox
, \
139 The log plugin module provides access to the syslog and libubox ulog APIs.
))
141 $(eval
$(call UcodeModule
, \
142 math
, MATH_SUPPORT
, , \
143 The math plugin provides access to various
<math.h
> procedures.
))
145 $(eval
$(call UcodeModule
, \
146 nl80211
, NL80211_SUPPORT
, +libnl-tiny
+libubox
, \
147 The nl80211 plugin provides access to the Linux wireless
802.11 netlink API.
))
149 $(eval
$(call UcodeModule
, \
150 resolv
, RESOLV_SUPPORT
, , \
151 The resolv plugin implements simple DNS resolving.
))
153 $(eval
$(call UcodeModule
, \
154 rtnl
, RTNL_SUPPORT
, +libnl-tiny
+libubox
, \
155 The rtnl plugin provides access to the Linux routing netlink API.
))
157 $(eval
$(call UcodeModule
, \
158 struct
, STRUCT_SUPPORT
, , \
159 The struct plugin implements Python
3 compatible struct.pack
/unpack functionality.
))
161 $(eval
$(call UcodeModule
, \
162 ubus
, UBUS_SUPPORT
, +libubus
+libblobmsg-json
, \
163 The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.
))
165 $(eval
$(call UcodeModule
, \
166 uci
, UCI_SUPPORT
, +libuci
, \
167 The uci module allows templates to read and modify uci configuration.
))
169 $(eval
$(call UcodeModule
, \
170 uloop
, ULOOP_SUPPORT
, +libubox
, \
171 The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.
))
173 $(eval
$(call BuildPackage
,libucode
))
174 $(eval
$(call BuildPackage
,ucode
))
176 $(foreach mod
,$(UCODE_MODULES
), \
177 $(eval
$(call BuildPackage
,$(mod
))))
179 $(eval
$(call HostBuild
))