diff options
| author | ruki <[email protected]> | 2018-12-13 23:53:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-12-13 17:18:49 +0800 |
| commit | b3fa23bff3a8a34e832a10ef714224d6e728ebd3 (patch) | |
| tree | 1aa20f227a117efdf4e589ba8e31ea5f700f7932 | |
| parent | 11d0bbaebf5804d331ffa126ec0dab21913dad15 (diff) | |
improve git package
| -rw-r--r-- | tests/projects/package/basic/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/core/platform/environment.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/utils/archive/extract.lua | 2 | ||||
| -rw-r--r-- | xmake/repository/packages/g/git/xmake.lua | 33 |
4 files changed, 20 insertions, 25 deletions
diff --git a/tests/projects/package/basic/xmake.lua b/tests/projects/package/basic/xmake.lua index d84c9b8f8..b7ec6919d 100644 --- a/tests/projects/package/basic/xmake.lua +++ b/tests/projects/package/basic/xmake.lua @@ -1,8 +1,8 @@ -- requires add_requires("tbox master", {debug = true}) -add_requires("zlib >=1.2.11", {optional = true}) -add_requires("pcre2", "luajit", {system = false}) +add_requires("zlib >=1.2.11") +add_requires("pcre2", "luajit", {system = false, optional = true}) -- add modes add_rules("mode.debug", "mode.release") diff --git a/xmake/core/platform/environment.lua b/xmake/core/platform/environment.lua index dc8c65ef9..5bb53e7c4 100644 --- a/xmake/core/platform/environment.lua +++ b/xmake/core/platform/environment.lua @@ -56,12 +56,6 @@ function environment._enter_toolchains() -- add $programdir/winenv/bin to $path if os.host() == "windows" then os.addenv("PATH", path.join(os.programdir(), "winenv", "bin")) - - -- attempt to load winenv - local winenv_dir = path.join(global.directory(), "winenv") - if os.isdir(winenv_dir) then - import("winenv", {rootdir = winenv_dir, try = true, anonymous = true})(winenv_dir) - end end end diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index f5cf33d38..53e3aaa67 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -34,7 +34,7 @@ import("detect.tools.find_unzip") -- extract archivefile using tar function _extract_using_tar(archivefile, outputdir, extension, opt) - -- the tar of winenv can only extract "*.tar" + -- the tar of windows can only extract "*.tar" if os.host() == "windows" and extension ~= ".tar" then return false end diff --git a/xmake/repository/packages/g/git/xmake.lua b/xmake/repository/packages/g/git/xmake.lua index 0076dd64e..e2e5de408 100644 --- a/xmake/repository/packages/g/git/xmake.lua +++ b/xmake/repository/packages/g/git/xmake.lua @@ -6,31 +6,32 @@ package("git") if os.host() == "windows" then if os.arch() == "x64" then - add_urls("https://github.com/tboox/xmake-win64env/archive/$(version).zip", {alias = "github"}) - add_urls("https://gitlab.com/tboox/xmake-win64env/-/archive/$(version)/xmake-win64env-$(version).zip", {alias = "gitlab"}) - add_versions("github:v1.0.3", "df43e419a358b136cfc0ae343560684321722a39713c205a7a894edd9d15b2b5") - add_versions("gitlab:v1.0.3", "376807a3386f15e734f3b2f51ed5d151d434fb99b7349412a2fb9e83d5e29d5c") + add_urls("https://github.com/git-for-windows/git/releases/download/v$(version).windows.1/MinGit-$(version)-64-bit.zip") + if winos.version():gt("winxp") then + add_versions("2.20.0", "f577f81c401535858761fc4857a105337cc12880b79e72f89d0740167083d287") + else + add_versions("2.10.0", "2e1101ec57da526728704c04792293613f3c5aa18e65f13a4129d00b54de2087") + end else - add_urls("https://github.com/tboox/xmake-win32env/archive/$(version).zip", {alias = "github"}) - add_urls("https://gitlab.com/tboox/xmake-win32env/-/archive/$(version)/xmake-win32env-$(version).zip", {alias = "gitlab"}) - add_versions("github:v1.0.3", "2a3b71baae67f3ebb057748d1261970d18d80be52e88427a4719d2185594fc21") - add_versions("gitlab:v1.0.3", "2a627f78349702a85b710399c14f5dc0acfdb5ad840765e3e2637d554a373807") + add_urls("https://github.com/git-for-windows/git/releases/download/v$(version).windows.1/MinGit-$(version)-32-bit.zip") + if winos.version():gt("winxp") then + add_versions("2.20.0", "39d3dce9f67d7ae884edf0416d28f6dd8e24b6326de8e509613a2b12fb4f0820") + else + add_versions("2.10.0", "36f890870126dcf840d87eaec7e55b8a483bc336ebf8970de2f9d549a3cfc195") + end end end + on_load("windows", function (package) + package:addenv("PATH", path.join("share", "MinGit", "cmd")) + end) + on_install("macosx", "linux", function (package) import("package.manager.install")("git") end) on_install("windows", function (package) - - -- install winenv with git - local winenv_dir = path.join(val("globaldir"), "winenv") - os.mkdir(winenv_dir) - os.cp("*", winenv_dir) - - -- load winenv - import("winenv", {rootdir = winenv_dir})(winenv_dir) + os.cp("*", package:installdir("share/MinGit")) end) on_test(function (package) |
