From b06b9efef4174b2e8771e8c561e34b9be6b2e45b Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 8 May 2019 23:37:23 +0800 Subject: [PATCH] improve skia --- packages/d/doctest/xmake.lua | 5 ++--- packages/l/libffi/xmake.lua | 6 +++--- packages/n/nana/xmake.lua | 6 ++---- packages/p/python/xmake.lua | 22 +++++++--------------- packages/p/python2/xmake.lua | 13 +++---------- packages/s/skia/xmake.lua | 19 +++++++++++-------- 6 files changed, 28 insertions(+), 43 deletions(-) diff --git a/packages/d/doctest/xmake.lua b/packages/d/doctest/xmake.lua index 510019d89..636bc4f84 100644 --- a/packages/d/doctest/xmake.lua +++ b/packages/d/doctest/xmake.lua @@ -13,8 +13,7 @@ package("doctest") end) on_test(function (package) - import("lib.detect.check_cxsnippets") - assert(check_cxsnippets({test = [[ + assert(package:check_cxxsnippets({test = [[ int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; } TEST_CASE("testing the factorial function") { @@ -23,5 +22,5 @@ package("doctest") CHECK(factorial(3) == 6); CHECK(factorial(10) == 3628800); } - ]]}, {configs = table.join(package:fetch(), {languages = "c++11"}), sourcekind = "cxx", includes = "doctest/doctest.h", defines = "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN"})) + ]]}, {configs = {languages = "c++11"}, includes = "doctest/doctest.h", defines = "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN"})) end) diff --git a/packages/l/libffi/xmake.lua b/packages/l/libffi/xmake.lua index 3a06fc1c3..4c2da5a96 100644 --- a/packages/l/libffi/xmake.lua +++ b/packages/l/libffi/xmake.lua @@ -9,10 +9,10 @@ package("libffi") add_versions("3.2.1", "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37") on_load(function (package) - if package:version_str():find('.', 1, true) then - package:add("includedirs", "lib/libffi-" .. package:version_str() .. "/include") - else + if package:gitref() then package:add("deps", "autoconf", "automake", "libtool") + else + package:add("includedirs", "lib/libffi-" .. package:version_str() .. "/include") end end) diff --git a/packages/n/nana/xmake.lua b/packages/n/nana/xmake.lua index 478b9ce9b..d4ad8f5ac 100644 --- a/packages/n/nana/xmake.lua +++ b/packages/n/nana/xmake.lua @@ -13,14 +13,12 @@ package("nana") end)]] on_test(function (package) - import("lib.detect.check_cxsnippets") - assert(check_cxsnippets({test = [[ + assert(package:check_cxxsnippets({test = [[ using namespace nana; form fm; label lb(fm, rectangle(fm.size())); lb.caption("Hello, World"); fm.show(); exec(); - ]]}, {configs = table.join(package:fetch(), {languages = "c++11"}), sourcekind = "cxx", - includes = {"nana/gui/wvl.hpp", "nana/gui/widgets/label.hpp"}})) + ]]}, {configs = {languages = "c++11"}, includes = {"nana/gui/wvl.hpp", "nana/gui/widgets/label.hpp"}})) end) diff --git a/packages/p/python/xmake.lua b/packages/p/python/xmake.lua index 882344353..0be9614c0 100644 --- a/packages/p/python/xmake.lua +++ b/packages/p/python/xmake.lua @@ -50,20 +50,14 @@ package("python") on_install("windows", function (package) local installdir = package:installdir("share", package:name(), package:version_str()) os.cp("*", installdir) - if package:version_str():startswith("2.") then - os.cp("python.exe", path.join(installdir, "python2.exe")) - else + if package:version():ge("3.0") then os.cp("python.exe", path.join(installdir, "python3.exe")) + else + os.cp("python.exe", path.join(installdir, "python2.exe")) end end) on_install("macosx", "linux", function (package) - -- unset these so that installing pip and setuptools puts them where we want - -- and not into some other Python the user has installed. - local PYTHONHOME = os.getenv("PYTHONHOME") - local PYTHONPATH = os.getenv("PYTHONPATH") - os.setenv("PYTHONHOME", "") - os.setenv("PYTHONPATH", "") -- init configs local configs = {"--enable-ipv6", "--without-ensurepip"} @@ -72,17 +66,15 @@ package("python") -- add openssl libs path for detecting local openssl_dir = package:dep("openssl"):installdir() - if package:version_str():startswith("3") then + if package:version():ge("3.0") then table.insert(configs, "--with-openssl=" .. openssl_dir) else io.gsub("setup.py", "/usr/local/ssl", openssl_dir) end - -- do install - import("package.tools.autoconf").install(package, configs) - - os.setenv("PYTHONHOME", PYTHONHOME) - os.setenv("PYTHONPATH", PYTHONPATH) + -- unset these so that installing pip and setuptools puts them where we want + -- and not into some other Python the user has installed. + import("package.tools.autoconf").install(package, configs, {envs = {PYTHONHOME = "", PYTHONPATH = ""}}) end) on_test(function (package) diff --git a/packages/p/python2/xmake.lua b/packages/p/python2/xmake.lua index 62b612994..be61208a7 100644 --- a/packages/p/python2/xmake.lua +++ b/packages/p/python2/xmake.lua @@ -36,12 +36,6 @@ package("python2") end) on_install("macosx", "linux", function (package) - -- unset these so that installing pip and setuptools puts them where we want - -- and not into some other Python the user has installed. - local PYTHONHOME = os.getenv("PYTHONHOME") - local PYTHONPATH = os.getenv("PYTHONPATH") - os.setenv("PYTHONHOME", "") - os.setenv("PYTHONPATH", "") -- init configs local configs = {"--enable-ipv6", "--without-ensurepip"} @@ -51,10 +45,9 @@ package("python2") -- add openssl libs path for detecting io.gsub("setup.py", "/usr/local/ssl", package:dep("openssl"):installdir()) - -- do install - import("package.tools.autoconf").install(package, configs) - os.setenv("PYTHONHOME", PYTHONHOME) - os.setenv("PYTHONPATH", PYTHONPATH) + -- unset these so that installing pip and setuptools puts them where we want + -- and not into some other Python the user has installed. + import("package.tools.autoconf").install(package, configs, {envs = {PYTHONHOME = "", PYTHONPATH = ""}}) end) on_test(function (package) diff --git a/packages/s/skia/xmake.lua b/packages/s/skia/xmake.lua index ec01fca62..80c0050c9 100644 --- a/packages/s/skia/xmake.lua +++ b/packages/s/skia/xmake.lua @@ -13,18 +13,21 @@ package("skia") on_install("macosx", "linux", "windows", function (package) os.vrun("git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1") local pathes = os.getenv("PATH") - os.addenv("PATH", path.join(os.curdir(), "depot_tools")) - os.addenv("PATH", path.join(os.curdir(), "bin")) - os.vrun("python2 tools/git-sync-deps") - os.vrun("bin/gn gen build --args='is_official_build=true is_debug=false'") + pathes = pathes .. path.envsep() .. path.join(os.curdir(), "depot_tools") + pathes = pathes .. path.envsep() .. path.join(os.curdir(), "bin") + local args = {is_official_build = true, is_debug = package:debug()} + local argstr = "" + for k, v in pairs(args) do + argstr = argstr .. ' ' .. k .. '=' .. tostring(v) + end + os.vrunv("python2", {"tools/git-sync-deps"}, {envs = {PATH = pathes}}) + os.vrun("bin/gn gen build --args='%s'", argstr) os.vrun("ninja -C build") - os.setenv("PATH", pathes) end) on_test(function (package) - import("lib.detect.check_cxsnippets") - assert(check_cxsnippets({test = [[ + assert(package:check_cxxsnippets({test = [[ SkPaint paint; paint.setStyle(SkPaint::kFill_Style); - ]]}, {configs = table.join(package:fetch(), {languages = "c++11"}), sourcekind = "cxx", includes = "core/SkPaint.h", defines = "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN"})) + ]]}, {configs = {languages = "c++14"}, includes = "core/SkPaint.h", defines = "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN"})) end)