Makefile 4.7 KB

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