diff --git a/packages/l/libxmake/xmake.lua b/packages/l/libxmake/xmake.lua new file mode 100644 index 000000000..467b6b026 --- /dev/null +++ b/packages/l/libxmake/xmake.lua @@ -0,0 +1,55 @@ +package("libxmake") + + set_homepage("https://xmake.io") + set_description("The c/c++ bindings of the xmake core engine") + + add_urls("https://gitee.com/tboox/xmake.git", + "https://github.com/xmake-io/xmake.git", + "https://gitlab.com/tboox/xmake.git") + + add_configs("curses", { description = "Enable curses library.", default = false, type = "boolean"}) + add_configs("readline", { description = "Enable readline library.", default = false, type = "boolean"}) + + add_includedirs("include", "include/luajit") + add_links("xmake", "tbox", "luajit", "sv") + if is_plat("windows") then + add_ldflags("/export:malloc", "/export:free") + add_syslinks("kernel32", "user32", "gdi32") + add_syslinks("ws2_32", "advapi32", "shell32") + elseif is_plat("android") then + add_links("m", "c") + elseif is_plat("macosx") then + add_ldflags("-all_load", "-pagezero_size 10000", "-image_base 100000000") + elseif is_plat("msys") then + add_ldflags("-static-libgcc", {force = true}) + add_syslinks("kernel32", "user32", "gdi32") + add_syslinks("ws2_32", "advapi32", "shell32") + else + add_links("pthread", "dl", "m", "c") + end + + on_load(function (package) + if package:config("curses") then + package:add("links", "lcurses") + if package:is_plat("windows") then + package:add("links", "pdcurses") + else + package:add("links", "ncurses") + end + end + if package:config("readline") then + package:add("links", "readline") + end + end) + + on_install("linux", "macosx", "windows", "msys", "android", function (package) + local configs = {"--onlylib=y"} + table.insert(configs, "--curses=" .. (package:config("curses") and "y" or "n")) + table.insert(configs, "--readline=" .. (package:config("readline") and "y" or "n")) + os.cd("core") + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("xm_machine_init", {includes = "xmake/xmake.h"})) + end) diff --git a/scripts/packages.lua b/scripts/packages.lua index cdc83d2c5..15dae447e 100644 --- a/scripts/packages.lua +++ b/scripts/packages.lua @@ -60,7 +60,7 @@ function main(opt) local packagefile = path.join(packagedir, "xmake.lua") local instance = package.load_from_repository(packagename, nil, packagedir, packagefile) if instance then - for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw"}) do + for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys"}) do local archs = platform.archs(plat) if archs then local package_archs = {}