c2f0607341f5b98fc1f208e5abb54eb6bf83eb42
[openwrt/staging/pepe2k.git] / package / utils / ucode / Makefile
1 #
2 # Copyright (C) 2020-2021 Jo-Philipp Wich <jo@mein.io>
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:=ucode
11 PKG_RELEASE:=1
12
13 PKG_SOURCE_PROTO:=git
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>
19 PKG_LICENSE:=ISC
20
21 PKG_ABI_VERSION:=20230711
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/host-build.mk
25 include $(INCLUDE_DIR)/cmake.mk
26
27 CMAKE_OPTIONS += -DSOVERSION=$(PKG_ABI_VERSION)
28 CMAKE_HOST_OPTIONS += \
29 -DSOVERSION=$(PKG_ABI_VERSION) \
30 -DFS_SUPPORT=ON \
31 -DMATH_SUPPORT=ON \
32 -DNL80211_SUPPORT=OFF \
33 -DRESOLV_SUPPORT=OFF \
34 -DRTNL_SUPPORT=OFF \
35 -DSTRUCT_SUPPORT=ON \
36 -DUBUS_SUPPORT=OFF \
37 -DUCI_SUPPORT=OFF \
38 -DULOOP_SUPPORT=OFF \
39 -DDEBUG_SUPPORT=ON \
40 -DLOG_SUPPORT=OFF
41
42
43 define Package/ucode/default
44 SUBMENU:=ucode
45 SECTION:=lang
46 CATEGORY:=Languages
47 TITLE:=Tiny scripting and templating language
48 endef
49
50 define Package/ucode
51 $(Package/ucode/default)
52 DEPENDS:=+libucode
53 endef
54
55 define Package/ucode/description
56 ucode is a tiny script interpreter featuring an ECMAScript oriented
57 script language and Jinja-inspired templating.
58 endef
59
60
61 define Package/libucode
62 $(Package/ucode/default)
63 SUBMENU:=
64 SECTION:=libs
65 CATEGORY:=Libraries
66 TITLE+= (library)
67 ABI_VERSION:=$(PKG_ABI_VERSION)
68 DEPENDS:=+libjson-c
69 endef
70
71 define Package/libucode/description
72 The libucode package provides the shared runtime library for the ucode interpreter.
73 endef
74
75 # 1: name
76 # 2: cmake symbol
77 # 3: depends
78 # 4: description
79 define UcodeModule
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))
83
84 define Package/ucode-mod-$(strip $(1))
85 $(Package/ucode/default)
86 TITLE+= ($(strip $(1)) module)
87 DEPENDS:=ucode $(3)
88 endef
89
90 define Package/ucode-mod-$(strip $(1))/description
91 $(strip $(4))
92 endef
93
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/
97 endef
98 endef
99
100
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/
105 endef
106
107
108 define Package/ucode/install
109 $(INSTALL_DIR) $(1)/usr/bin
110 $(CP) $(PKG_INSTALL_DIR)/usr/bin/u* $(1)/usr/bin/
111 endef
112
113 define Package/libucode/install
114 $(INSTALL_DIR) $(1)/usr/lib
115 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so.* $(1)/usr/lib/
116 endef
117
118
119 $(eval $(call UcodeModule, \
120 debug, DEBUG_SUPPORT, +libubox +libucode, \
121 The debug plugin module provides runtime debugging and introspection facilities.))
122
123 $(eval $(call UcodeModule, \
124 fs, FS_SUPPORT, , \
125 The filesystem plugin module allows interaction with the local file system.))
126
127 $(eval $(call UcodeModule, \
128 log, LOG_SUPPORT, +libubox, \
129 The log plugin module provides access to the syslog and libubox ulog APIs.))
130
131 $(eval $(call UcodeModule, \
132 math, MATH_SUPPORT, , \
133 The math plugin provides access to various <math.h> procedures.))
134
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.))
138
139 $(eval $(call UcodeModule, \
140 resolv, RESOLV_SUPPORT, , \
141 The resolv plugin implements simple DNS resolving.))
142
143 $(eval $(call UcodeModule, \
144 rtnl, RTNL_SUPPORT, +libnl-tiny +libubox, \
145 The rtnl plugin provides access to the Linux routing netlink API.))
146
147 $(eval $(call UcodeModule, \
148 struct, STRUCT_SUPPORT, , \
149 The struct plugin implements Python 3 compatible struct.pack/unpack functionality.))
150
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.))
154
155 $(eval $(call UcodeModule, \
156 uci, UCI_SUPPORT, +libuci, \
157 The uci module allows templates to read and modify uci configuration.))
158
159 $(eval $(call UcodeModule, \
160 uloop, ULOOP_SUPPORT, +libubox, \
161 The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.))
162
163 $(eval $(call BuildPackage,libucode))
164 $(eval $(call BuildPackage,ucode))
165
166 $(foreach mod,$(UCODE_MODULES), \
167 $(eval $(call BuildPackage,$(mod))))
168
169 $(eval $(call HostBuild))