Makefile 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #
  2. # Copyright (C) 2020-2021 Jo-Philipp Wich <[email protected]>
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=ucode
  9. PKG_RELEASE:=2
  10. PKG_SOURCE_PROTO:=git
  11. PKG_SOURCE_URL=https://github.com/jow-/ucode.git
  12. PKG_SOURCE_DATE:=2024-07-11
  13. PKG_SOURCE_VERSION:=1a8a0bcf725520820802ad433db22d8f64fbed6c
  14. PKG_MIRROR_HASH:=0a859c97457a019adc73b028c19e2b334271b2c4de28337f1a18fd35438af3d3
  15. PKG_MAINTAINER:=Jo-Philipp Wich <[email protected]>
  16. PKG_LICENSE:=ISC
  17. PKG_ABI_VERSION:=20230711
  18. HOST_BUILD_DEPENDS:=libjson-c/host
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/host-build.mk
  21. include $(INCLUDE_DIR)/cmake.mk
  22. CMAKE_OPTIONS += \
  23. -DSOVERSION=$(PKG_ABI_VERSION)
  24. -DCMAKE_SKIP_RPATH=FALSE \
  25. -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
  26. ifeq ($(HOST_OS),Darwin)
  27. CMAKE_HOST_OPTIONS += \
  28. -DCMAKE_MACOSX_RPATH=1
  29. else
  30. CMAKE_HOST_OPTIONS += \
  31. -DUSE_RPATH="${STAGING_DIR_HOSTPKG}/lib"
  32. endif
  33. CMAKE_HOST_OPTIONS += \
  34. -DFS_SUPPORT=ON \
  35. -DMATH_SUPPORT=ON \
  36. -DNL80211_SUPPORT=OFF \
  37. -DRESOLV_SUPPORT=OFF \
  38. -DRTNL_SUPPORT=OFF \
  39. -DSTRUCT_SUPPORT=ON \
  40. -DUBUS_SUPPORT=OFF \
  41. -DUCI_SUPPORT=OFF \
  42. -DULOOP_SUPPORT=OFF \
  43. -DDEBUG_SUPPORT=ON \
  44. -DLOG_SUPPORT=OFF
  45. define Package/ucode/default
  46. SUBMENU:=ucode
  47. SECTION:=lang
  48. CATEGORY:=Languages
  49. TITLE:=Tiny scripting and templating language
  50. endef
  51. define Package/ucode
  52. $(Package/ucode/default)
  53. DEPENDS:=+libucode
  54. endef
  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. define Package/libucode
  60. $(Package/ucode/default)
  61. SUBMENU:=
  62. SECTION:=libs
  63. CATEGORY:=Libraries
  64. TITLE+= (library)
  65. ABI_VERSION:=$(PKG_ABI_VERSION)
  66. DEPENDS:=+libjson-c
  67. endef
  68. define Package/libucode/description
  69. The libucode package provides the shared runtime library for the ucode interpreter.
  70. endef
  71. # 1: name
  72. # 2: cmake symbol
  73. # 3: depends
  74. # 4: description
  75. define UcodeModule
  76. UCODE_MODULES += ucode-mod-$(strip $(1))
  77. CMAKE_OPTIONS += -D$(strip $(2))=$(if $(CONFIG_PACKAGE_ucode-mod-$(strip $(1))),ON,OFF)
  78. PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_ucode-mod-$(strip $(1))
  79. define Package/ucode-mod-$(strip $(1))
  80. $(Package/ucode/default)
  81. TITLE+= ($(strip $(1)) module)
  82. DEPENDS:=+ucode $(3)
  83. endef
  84. define Package/ucode-mod-$(strip $(1))/description
  85. $(strip $(4))
  86. endef
  87. define Package/ucode-mod-$(strip $(1))/install
  88. $(INSTALL_DIR) $$(1)/usr/lib/ucode
  89. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/$(strip $(1)).so $$(1)/usr/lib/ucode/
  90. endef
  91. endef
  92. define Build/InstallDev
  93. $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include/ucode
  94. $(CP) $(PKG_INSTALL_DIR)/usr/include/ucode/*.h $(1)/usr/include/ucode/
  95. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so* $(1)/usr/lib/
  96. endef
  97. define Package/ucode/install
  98. $(INSTALL_DIR) $(1)/usr/bin
  99. $(CP) $(PKG_INSTALL_DIR)/usr/bin/u* $(1)/usr/bin/
  100. endef
  101. define Package/libucode/install
  102. $(INSTALL_DIR) $(1)/usr/lib
  103. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so.* $(1)/usr/lib/
  104. endef
  105. $(eval $(call UcodeModule, \
  106. debug, DEBUG_SUPPORT, +libubox +libucode, \
  107. The debug plugin module provides runtime debugging and introspection facilities.))
  108. $(eval $(call UcodeModule, \
  109. fs, FS_SUPPORT, , \
  110. The filesystem plugin module allows interaction with the local file system.))
  111. $(eval $(call UcodeModule, \
  112. log, LOG_SUPPORT, +libubox, \
  113. The log plugin module provides access to the syslog and libubox ulog APIs.))
  114. $(eval $(call UcodeModule, \
  115. math, MATH_SUPPORT, , \
  116. The math plugin provides access to various <math.h> procedures.))
  117. $(eval $(call UcodeModule, \
  118. nl80211, NL80211_SUPPORT, +libnl-tiny +libubox, \
  119. The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.))
  120. $(eval $(call UcodeModule, \
  121. resolv, RESOLV_SUPPORT, , \
  122. The resolv plugin implements simple DNS resolving.))
  123. $(eval $(call UcodeModule, \
  124. rtnl, RTNL_SUPPORT, +libnl-tiny +libubox, \
  125. The rtnl plugin provides access to the Linux routing netlink API.))
  126. $(eval $(call UcodeModule, \
  127. socket, SOCKET_SUPPORT, , \
  128. The socket plugin provides access to IPv4, IPv6, Unix and packet socket APIs.))
  129. $(eval $(call UcodeModule, \
  130. struct, STRUCT_SUPPORT, , \
  131. The struct plugin implements Python 3 compatible struct.pack/unpack functionality.))
  132. $(eval $(call UcodeModule, \
  133. ubus, UBUS_SUPPORT, +libubus +libblobmsg-json, \
  134. The ubus module allows ucode template scripts to enumerate and invoke ubus procedures.))
  135. $(eval $(call UcodeModule, \
  136. uci, UCI_SUPPORT, +libuci, \
  137. The uci module allows templates to read and modify uci configuration.))
  138. $(eval $(call UcodeModule, \
  139. uloop, ULOOP_SUPPORT, +libubox, \
  140. The uloop module allows ucode scripts to interact with OpenWrt uloop event loop implementation.))
  141. $(eval $(call BuildPackage,libucode))
  142. $(eval $(call BuildPackage,ucode))
  143. $(foreach mod,$(UCODE_MODULES), \
  144. $(eval $(call BuildPackage,$(mod))))
  145. $(eval $(call HostBuild))