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
:=2024-02-13
16 PKG_SOURCE_VERSION
:=3f9811d2f7b730f1f1d030872ae1def7e8349be6
17 PKG_MIRROR_HASH
:=b05cdaa6ecaf8c4b79e67551085c5580d09c5940304b5837a859324abbb26e94
18 PKG_MAINTAINER
:=Jo-Philipp Wich
<jo@mein.io
>
21 PKG_ABI_VERSION
:=20230711
22 HOST_BUILD_DEPENDS
:=libjson-c
/host
24 include $(INCLUDE_DIR
)/package.mk
25 include $(INCLUDE_DIR
)/host-build.mk
26 include $(INCLUDE_DIR
)/cmake.mk
28 CMAKE_OPTIONS
+= -DSOVERSION
=$(PKG_ABI_VERSION
)
30 ifeq ($(HOST_OS
),Darwin
)
31 CMAKE_HOST_OPTIONS
+= \
32 -DCMAKE_SKIP_RPATH
=FALSE \
33 -DCMAKE_MACOSX_RPATH
=1 \
34 -DCMAKE_INSTALL_RPATH
="${STAGING_DIR_HOSTPKG}/lib"
36 CMAKE_HOST_OPTIONS
+= \
37 -DSOVERSION
=$(PKG_ABI_VERSION
)
40 CMAKE_HOST_OPTIONS
+= \
43 -DNL80211_SUPPORT
=OFF \
44 -DRESOLV_SUPPORT
=OFF \
54 define Package
/ucode
/default
58 TITLE
:=Tiny scripting and templating language
62 $(Package
/ucode
/default
)
66 define Package
/ucode
/description
67 ucode is a tiny script interpreter featuring an ECMAScript oriented
68 script language and Jinja-inspired templating.
72 define Package
/libucode
73 $(Package
/ucode
/default
)
78 ABI_VERSION
:=$(PKG_ABI_VERSION
)
82 define Package
/libucode
/description
83 The libucode package provides the shared runtime library for the ucode interpreter.
91 UCODE_MODULES
+= ucode-mod-
$(strip $(1))
92 CMAKE_OPTIONS
+= -D
$(strip $(2))=$(if
$(CONFIG_PACKAGE_ucode-mod-
$(strip $(1))),ON
,OFF
)
93 PKG_CONFIG_DEPENDS
+= CONFIG_PACKAGE_ucode-mod-
$(strip $(1))
95 define Package
/ucode-mod-
$(strip $(1))
96 $(Package
/ucode
/default
)
97 TITLE
+= ($(strip $(1)) module
)
101 define Package
/ucode-mod-
$(strip $(1))/description
105 define Package
/ucode-mod-
$(strip $(1))/install
106 $(INSTALL_DIR
) $$(1)/usr
/lib
/ucode
107 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/ucode
/$(strip $(1)).so
$$(1)/usr
/lib
/ucode
/
112 define Build
/InstallDev
113 $(INSTALL_DIR
) $(1)/usr
/lib
$(1)/usr
/include/ucode
114 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/ucode
/*.h
$(1)/usr
/include/ucode
/
115 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so
* $(1)/usr
/lib
/
119 define Package
/ucode
/install
120 $(INSTALL_DIR
) $(1)/usr
/bin
121 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/u
* $(1)/usr
/bin
/
124 define Package
/libucode
/install
125 $(INSTALL_DIR
) $(1)/usr
/lib
126 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libucode.so.
* $(1)/usr
/lib
/
130 $(eval
$(call UcodeModule
, \
131 debug
, DEBUG_SUPPORT
, +libubox
+libucode
, \
132 The debug plugin module provides runtime debugging and introspection facilities.
))
134 $(eval
$(call UcodeModule
, \
136 The filesystem plugin module allows interaction with the local file system.
))
138 $(eval
$(call UcodeModule
, \
139 log
, LOG_SUPPORT
, +libubox
, \
140 The log plugin module provides access to the syslog and libubox ulog APIs.
))
142 $(eval
$(call UcodeModule
, \
143 math
, MATH_SUPPORT
, , \
144 The math plugin provides access to various
<math.h
> procedures.
))
146 $(eval
$(call UcodeModule
, \
147 nl80211
, NL80211_SUPPORT
, +libnl-tiny
+libubox
, \
148 The nl80211 plugin provides access to the Linux wireless
802.11 netlink API.
))
150 $(eval
$(call UcodeModule
, \
151 resolv
, RESOLV_SUPPORT
, , \
152 The resolv plugin implements simple DNS resolving.
))
154 $(eval
$(call UcodeModule
, \
155 rtnl
, RTNL_SUPPORT
, +libnl-tiny
+libubox
, \
156 The rtnl plugin provides access to the Linux routing netlink API.
))
158 $(eval
$(call UcodeModule
, \
159 struct
, STRUCT_SUPPORT
, , \
160 The struct plugin implements Python
3 compatible struct.pack
/unpack functionality.
))
162 $(eval
$(call UcodeModule
, \
163 ubus
, UBUS_SUPPORT
, +libubus
+libblobmsg-json
, \
164 The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.
))
166 $(eval
$(call UcodeModule
, \
167 uci
, UCI_SUPPORT
, +libuci
, \
168 The uci module allows templates to read and modify uci configuration.
))
170 $(eval
$(call UcodeModule
, \
171 uloop
, ULOOP_SUPPORT
, +libubox
, \
172 The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.
))
174 $(eval
$(call BuildPackage
,libucode
))
175 $(eval
$(call BuildPackage
,ucode
))
177 $(foreach mod
,$(UCODE_MODULES
), \
178 $(eval
$(call BuildPackage
,$(mod
))))
180 $(eval
$(call HostBuild
))