diff --git a/packages/l/llvm/xmake.lua b/packages/l/llvm/xmake.lua index d02c6f238..6c90a08e0 100644 --- a/packages/l/llvm/xmake.lua +++ b/packages/l/llvm/xmake.lua @@ -57,10 +57,6 @@ package("llvm") end end - on_install("@macosx", "@windows", "@msys", "@bsd", function (package) - os.cp("*", package:installdir()) - end) - on_load("@linux", function (package) if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then return @@ -69,6 +65,22 @@ package("llvm") end end) + if on_fetch then + on_fetch(function (package, opt) + local version = try {function() return os.iorunv("llvm-config --version") end} + if version then + import("core.base.semver") + if semver.satisfies(version:trim(), opt.require_version) then + return true + end + end + end) + end + + on_install("@macosx", "@windows", "@msys", "@bsd", function (package) + os.cp("*", package:installdir()) + end) + on_install("@linux", function (package) if linuxos.name() == "ubuntu" and linuxos.version():eq("20.04") and os.arch() == "x86_64" then @@ -144,5 +156,8 @@ package("llvm") end) on_test(function (package) - os.vrun("clang --version") + os.vrun("llvm-config --version") + if package:config("clang") then + os.vrun("clang --version") + end end)