Ver Fonte

improve skia

ruki há 6 anos atrás
pai
commit
b06b9efef4

+ 2 - 3
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)

+ 3 - 3
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)
 

+ 2 - 4
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)

+ 7 - 15
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)

+ 3 - 10
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)

+ 11 - 8
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)