package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.1 KiB

package("quickjs")
set_homepage("https://bellard.org/quickjs/")
set_description("QuickJS is a small and embeddable Javascript engine")
if is_plat("windows") then
add_urls("https://github.com/xmake-mirror/quickjs.git")
add_versions("2021.03.27", "c83f82dce8988334be6c6a7b9b029eb963e7e310")
else
add_urls("https://github.com/bellard/quickjs.git")
add_versions("2021.03.27", "b5e62895c619d4ffc75c9d822c8d85f1ece77e5b")
end
if is_plat("linux", "macosx", "iphoneos", "cross") then
add_syslinks("pthread", "dl", "m")
elseif is_plat("android") then
add_syslinks("dl", "m")
end
on_install("linux", "macosx", "iphoneos", "android", "mingw", "cross", function (package)
io.writefile("xmake.lua", ([[
add_rules("mode.debug", "mode.release")
target("quickjs")
set_kind("$(kind)")
add_files("quickjs*.c", "cutils.c", "lib*.c")
add_headerfiles("quickjs-libc.h")
add_headerfiles("quickjs.h")
add_installfiles("*.js", {prefixdir = "share"})
set_languages("c99")
add_defines("CONFIG_VERSION=\"%s\"", "_GNU_SOURCE")
add_defines("CONFIG_BIGNUM")
if is_plat("windows", "mingw") then
add_defines("__USE_MINGW_ANSI_STDIO")
end
]]):format(package:version_str()))
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
if package:is_plat("cross") then
io.replace("quickjs.c", "#define CONFIG_PRINTF_RNDN", "")
end
import("package.tools.xmake").install(package, configs)
end)
on_install("windows", function (package)
local configs = {}
if package:config("shared") then
configs.kind = "shared"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("JS_NewRuntime", {includes = "quickjs.h"}))
end)