From 5ff67da583c42beb297a7e74aba50c6a3cc9da20 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Fri, 20 Aug 2021 16:44:24 +0800 Subject: [PATCH] add numactl (#578) * update eigen * improve meson * update libxml2 * improve glfw * improve attr * add numactl --- packages/a/attr/xmake.lua | 3 +-- packages/e/eigen/xmake.lua | 8 ++++---- packages/g/glfw/xmake.lua | 10 +++------- packages/l/libxml2/xmake.lua | 19 ++++++++++++++++--- packages/m/meson/xmake.lua | 3 ++- packages/n/numactl/xmake.lua | 18 ++++++++++++++++++ 6 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 packages/n/numactl/xmake.lua diff --git a/packages/a/attr/xmake.lua b/packages/a/attr/xmake.lua index 4bfb159ff..9717e7831 100644 --- a/packages/a/attr/xmake.lua +++ b/packages/a/attr/xmake.lua @@ -14,8 +14,7 @@ package("attr") if package:config("pic") ~= false then table.insert(configs, "--with-pic") end - import("package.tools.autoconf").install(package) - print(os.files(package:installdir("**"))) + import("package.tools.autoconf").install(package, configs) end) on_test(function (package) diff --git a/packages/e/eigen/xmake.lua b/packages/e/eigen/xmake.lua index 91f436a58..6b649aa29 100644 --- a/packages/e/eigen/xmake.lua +++ b/packages/e/eigen/xmake.lua @@ -1,23 +1,23 @@ package("eigen") + set_kind("library", {headeronly = true}) set_homepage("https://eigen.tuxfamily.org/") set_description("C++ template library for linear algebra") + set_license("MPL-2.0") add_urls("https://gitlab.com/libeigen/eigen/-/archive/$(version)/eigen-$(version).tar.bz2", "https://gitlab.com/libeigen/eigen") add_versions("3.3.7", "685adf14bd8e9c015b78097c1dc22f2f01343756f196acdc76a678e1ae352e11") add_versions("3.3.8", "0215c6593c4ee9f1f7f28238c4e8995584ebf3b556e9dbf933d84feb98d5b9ef") add_versions("3.3.9", "0fa5cafe78f66d2b501b43016858070d52ba47bd9b1016b0165a7b8e04675677") + add_versions("3.4.0", "b4c198460eba6f28d34894e3a5710998818515104d6e74e5cc331ce31e46e626") add_deps("cmake") add_includedirs("include") add_includedirs("include/eigen3") on_install("macosx", "linux", "windows", function (package) - local configs = {"-DBUILD_TESTING=OFF"} - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) - table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) - import("package.tools.cmake").install(package, configs) + import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"}) end) on_test(function (package) diff --git a/packages/g/glfw/xmake.lua b/packages/g/glfw/xmake.lua index 854a27ef0..b888e9d44 100644 --- a/packages/g/glfw/xmake.lua +++ b/packages/g/glfw/xmake.lua @@ -10,13 +10,9 @@ package("glfw") add_configs("glfw_include", {description = "Choose submodules enabled in glfw", default = "none", type = "string", values = {"none", "vulkan", "glu", "glext", "es2", "es3"}}) - on_fetch(function (package, opt) - if opt.system and package.find_package then - if package:is_plat("linux") then - return package:find_package("apt::libglfw3-dev", opt) - end - end - end) + if is_plat("linux") then + add_extsources("apt::libglfw3-dev") + end add_deps("cmake") add_deps("opengl", {optional = true}) diff --git a/packages/l/libxml2/xmake.lua b/packages/l/libxml2/xmake.lua index e2c78fd40..ff2e0d90d 100644 --- a/packages/l/libxml2/xmake.lua +++ b/packages/l/libxml2/xmake.lua @@ -7,21 +7,27 @@ package("libxml2") set_urls("http://xmlsoft.org/sources/libxml2-$(version).tar.gz", "https://ftp.osuosl.org/pub/blfs/conglomeration/libxml2/libxml2-$(version).tar.gz") add_urls("https://gitlab.gnome.org/GNOME/libxml2.git") - add_versions("2.9.9", "94fb70890143e3c6549f265cee93ec064c80a84c42ad0f23e85ee1fd6540a871") add_versions("2.9.10", "aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f") + add_versions("2.9.12", "c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92") add_includedirs("include/libxml2") if is_plat("windows") then - add_links("libxml2_a") add_syslinks("wsock32", "ws2_32") else add_links("xml2") end if is_plat("linux") then + add_extsources("apt::libxml2-dev") add_syslinks("m") end + on_load("windows", function (package) + if not package:config("shared") then + package:add("defines", "LIBXML_STATIC") + end + end) + on_load("macosx", "linux", "iphoneos", "android", function (package) if package:gitref() then package:add("deps", "autoconf", "automake", "libtool", "pkg-config") @@ -30,8 +36,15 @@ package("libxml2") on_install("windows", function (package) os.cd("win32") - os.vrun("cscript configure.js iso8859x=yes iconv=no compiler=msvc cruntime=/MT debug=%s prefix=\"%s\"", package:debug() and "yes" or "no", package:installdir()) + os.vrun("cscript configure.js iso8859x=yes iconv=no compiler=msvc cruntime=/%s debug=%s prefix=\"%s\"", package:config("vs_runtime"), package:debug() and "yes" or "no", package:installdir()) import("package.tools.nmake").install(package, {"/f", "Makefile.msvc"}) + os.tryrm(path.join(package:installdir("lib"), "libxml2_a_dll.lib")) + if package:config("shared") then + os.tryrm(path.join(package:installdir("lib"), "libxml2_a.lib")) + else + os.tryrm(path.join(package:installdir("lib"), "libxml2.lib")) + os.tryrm(path.join(package:installdir("bin"), "libxml2.dll")) + end end) on_install("macosx", "linux", "iphoneos", "android", function (package) diff --git a/packages/m/meson/xmake.lua b/packages/m/meson/xmake.lua index 12a3d2ba6..4ca8cc655 100644 --- a/packages/m/meson/xmake.lua +++ b/packages/m/meson/xmake.lua @@ -15,7 +15,8 @@ package("meson") on_install("@macosx", "@linux", "@windows", function (package) local envs = {PYTHONPATH = package:installdir()} - os.vrunv("python", {"-m", "pip", "install", "--target=" .. package:installdir(), "."}, {envs = envs}) + local python = package:is_plat("windows") and "python" or "python3" + os.vrunv(python, {"-m", "pip", "install", "--target=" .. package:installdir(), "."}, {envs = envs}) package:addenv("PYTHONPATH", envs.PYTHONPATH) end) diff --git a/packages/n/numactl/xmake.lua b/packages/n/numactl/xmake.lua new file mode 100644 index 000000000..7562291e2 --- /dev/null +++ b/packages/n/numactl/xmake.lua @@ -0,0 +1,18 @@ +package("numactl") + + set_homepage("https://github.com/numactl/numactl") + set_description("NUMA support for Linux") + set_license("LGPL-2.1") + + add_urls("https://github.com/numactl/numactl/releases/download/v$(version)/numactl-$(version).tar.gz") + add_versions("2.0.14", "826bd148c1b6231e1284e42a4db510207747484b112aee25ed6b1078756bcff6") + + on_install("linux", function (package) + import("package.tools.autoconf").install(package) + package:addenv("PATH", "bin") + end) + + on_test(function (package) + os.vrun("numactl -H") + assert(package:has_cfuncs("numa_available", {includes = "numa.h"})) + end)