Seperate msys2 (#3313)

* seperate msys2

* add mingw toolchain

* fix path

* disable key refresh

* update msys2 base

* ignore retcode

* starting uname

* fix install
pull/3314/head
ruki 1 year ago committed by GitHub
parent d885463d7c
commit f292072f38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 42
      packages/m/msys2-base/xmake.lua
  2. 28
      packages/m/msys2/xmake.lua

@ -0,0 +1,42 @@
package("msys2-base")
set_kind("toolchain")
set_homepage("https://www.msys2.org/")
set_description("Software Distribution and Building Platform for Windows")
add_urls("https://github.com/msys2/msys2-installer/releases/download/$(version).tar.xz", {version = function (version)
return version:gsub("%.", "-") .. "/msys2-base-x86_64-" .. version:gsub("%.", "")
end})
add_versions("2024.01.13", "04456a44a956d3c0b5f9b6c754918bf3a8c3d87c858be7a0c94c9171ab13c58c")
on_install("@windows|x64", function (package)
-- reduce time required to install packages by disabling pacman's disk space checking
io.gsub("etc/pacman.conf", "^CheckSpace", "#CheckSpace")
-- disable key refresh
io.replace("etc/post-install/07-pacman-key.post", "--refresh-keys", "--version", {plain = true})
-- install files
os.cp("*", package:installdir())
package:addenv("PATH", "usr/bin")
-- starting MSYS2 for the first time
local bash = path.join(package:installdir("usr/bin"), "bash.exe")
os.vrunv(bash, {"-leo", "pipefail", "-c", "uname -a"})
-- updating packages
try { function () os.vrunv(bash, {"-leo", "pipefail", "-c", "pacman --noconfirm -Syuu --overwrite *"}) end}
-- killing remaining tasks
os.vrunv("taskkill", {"/F", "/FI", "MODULES eq msys-2.0.dll"})
-- final system upgrade
os.vrunv(bash, {"-leo", "pipefail", "-c", "pacman --noconfirm -Syuu --overwrite *"})
end)
on_test(function (package)
os.vrun("sh --version")
os.vrun("perl --version")
os.vrun("ls -l")
os.vrun("grep --version")
os.vrun("uname -a")
end)

@ -3,23 +3,23 @@ package("msys2")
set_homepage("https://www.msys2.org/")
set_description("Software Distribution and Building Platform for Windows")
add_urls("https://github.com/msys2/msys2-installer/releases/download/$(version).tar.xz", {version = function (version)
return version:gsub("%.", "-") .. "/msys2-base-x86_64-" .. version:gsub("%.", "")
end})
add_versions("2024.01.13", "04456a44a956d3c0b5f9b6c754918bf3a8c3d87c858be7a0c94c9171ab13c58c")
add_deps("msys2-base")
add_configs("msystem", {description = "Set msys2 system.", type = "string", values = {"MSYS", "MINGW32", "MINGW64", "UCRT64", "CLANG32", "CLANG64", "CLANGARM64"}})
on_install("@windows|x64", function (package)
-- reduce time required to install packages by disabling pacman's disk space checking
io.gsub("etc/pacman.conf", "^CheckSpace", "#CheckSpace")
os.cp("*", package:installdir())
package:addenv("PATH", "usr/bin")
local msys2_base = package:dep("msys2-base")
local msystem = package:config("msystem")
if msystem then
package:addenv("MSYSTEM", msystem)
local bash = path.join(msys2_base:installdir("usr/bin"), "bash.exe")
if msystem == "MINGW64" then
os.vrunv(bash, {"-leo", "pipefail", "-c", "pacman --noconfirm -S --needed --overwrite * mingw-w64-x86_64-toolchain"})
package:addenv("PATH", msys2_base:installdir("mingw64/bin"))
elseif msystem == "MINGW32" then
os.vrunv(bash, {"-leo", "pipefail", "-c", "pacman --noconfirm -S --needed --overwrite * mingw-w64-i686-toolchain"})
package:addenv("PATH", msys2_base:installdir("mingw32/bin"))
end
end
end)
@ -29,4 +29,12 @@ package("msys2")
os.vrun("ls -l")
os.vrun("grep --version")
os.vrun("uname -a")
local msystem = package:config("msystem")
if msystem then
if msystem == "MINGW64" then
os.vrun("x86_64-w64-mingw32-gcc --version")
elseif msystem == "MINGW32" then
os.vrun("i686-w64-mingw32-gcc --version")
end
end
end)

Loading…
Cancel
Save