From a4642cce6250eaff6011fd0a16b1152fe2036387 Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 30 Dec 2023 23:34:50 +0800 Subject: [PATCH] mujs: add package (#3013) --- packages/m/mujs/xmake.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/m/mujs/xmake.lua diff --git a/packages/m/mujs/xmake.lua b/packages/m/mujs/xmake.lua new file mode 100644 index 000000000..c759a28a9 --- /dev/null +++ b/packages/m/mujs/xmake.lua @@ -0,0 +1,33 @@ +package("mujs") + set_homepage("http://mujs.com/") + set_description("An embeddable Javascript interpreter in C.") + + add_urls("https://mujs.com/downloads/mujs-$(version).tar.gz") + add_urls("https://github.com/ccxvii/mujs/archive/refs/tags/$(version).tar.gz", + "https://github.com/ccxvii/mujs.git") + + add_versions("1.3.4", "c015475880f6a382e706169c94371a7dd6cc22078832f6e0865af8289c2ef42b") + + if is_plat("linux", "bsd") then + add_syslinks("m") + end + + add_includedirs("include", "include/mujs") + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.release", "mode.debug") + target("mujs") + set_kind("$(kind)") + add_files("js*.c", "utf*.c", "regexp.c") + add_headerfiles("*.h", {prefixdir = "mujs"}) + if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all") + end + ]]) + import("package.tools.xmake").install(package) + end) + + on_test(function (package) + assert(package:has_cfuncs("js_newstate", {includes = "mujs/mujs.h"})) + end)