Pārlūkot izejas kodu

improve llvm-mingw

ruki 4 gadi atpakaļ
vecāks
revīzija
8e1dd00245
1 mainītis faili ar 10 papildinājumiem un 10 dzēšanām
  1. 10 10
      packages/l/llvm-mingw/xmake.lua

+ 10 - 10
packages/l/llvm-mingw/xmake.lua

@@ -5,13 +5,13 @@ package("llvm-mingw")
     set_description("An LLVM/Clang/LLD based mingw-w64 toolchain")
     set_description("An LLVM/Clang/LLD based mingw-w64 toolchain")
 
 
     if is_host("windows") then
     if is_host("windows") then
-        if os.arch() == "x86" then
+        if is_arch("x86") then
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-i686.zip")
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-i686.zip")
             add_versions("20201020", "4f07721a81a3ba0980fc089e839d1f1a5784bbc8cee1332c15cf1b6ba24525d6")
             add_versions("20201020", "4f07721a81a3ba0980fc089e839d1f1a5784bbc8cee1332c15cf1b6ba24525d6")
-        elseif os.arch() == "arm64" then
+        elseif is_arch("arm64") then
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-aarch64.zip")
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-aarch64.zip")
             add_versions("20201020", "57d6e0fff94774ccd958a3d0174686189d3ec1cb5981eb4ea37fc82a007cc674")
             add_versions("20201020", "57d6e0fff94774ccd958a3d0174686189d3ec1cb5981eb4ea37fc82a007cc674")
-        elseif os.arch() == "arm" or os.arch() == "armv7" then
+        elseif is_arch("arm.*") then
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-armv7.zip")
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-armv7.zip")
             add_versions("20201020", "c086562124fc79e157d2cb01eacd7bd3e937d488bacdac138ee45ed6a39d3b6c")
             add_versions("20201020", "c086562124fc79e157d2cb01eacd7bd3e937d488bacdac138ee45ed6a39d3b6c")
         else
         else
@@ -19,7 +19,7 @@ package("llvm-mingw")
             add_versions("20201020", "8f619911b61554d0394537305157f63284fab949ad0abed137b84440689fa77e")
             add_versions("20201020", "8f619911b61554d0394537305157f63284fab949ad0abed137b84440689fa77e")
         end
         end
     elseif is_host("linux") then
     elseif is_host("linux") then
-        if linuxos.name() == "ubuntu" and linuxos.version():eq("18.04") and os.arch() == "x86_64" then
+        if linuxos.name() == "ubuntu" and linuxos.version():eq("18.04") then
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-ubuntu-18.04.tar.xz")
             set_urls("https://github.com/mstorsjo/llvm-mingw/releases/download/$(version)/llvm-mingw-$(version)-ucrt-ubuntu-18.04.tar.xz")
             add_versions("20201020", "b41769e8c1511adb093de9f0b8bc340aa85e91f40343bbb8894cd12aca3a7543")
             add_versions("20201020", "b41769e8c1511adb093de9f0b8bc340aa85e91f40343bbb8894cd12aca3a7543")
         end
         end
@@ -27,21 +27,21 @@ package("llvm-mingw")
 
 
     on_install("@windows", "@linux", function (package)
     on_install("@windows", "@linux", function (package)
         if is_host("linux") then
         if is_host("linux") then
-            assert(linuxos.name() == "ubuntu" and linuxos.version():eq("18.04") and os.arch() == "x86_64", "only support for ubuntu 18.04")
+            assert(linuxos.name() == "ubuntu" and linuxos.version():eq("18.04"))
         end
         end
         os.cp("*", package:installdir())
         os.cp("*", package:installdir())
     end)
     end)
 
 
     on_test(function (package)
     on_test(function (package)
         local gcc
         local gcc
-        if package:is_arch("x86_64", "x64") then
-            gcc = "x86_64-w64-mingw32-gcc"
-        elseif package:is_arch("i386", "x86", "i686") then
+        if is_arch("i386", "x86", "i686") then
             gcc = "i686-w64-mingw32-gcc"
             gcc = "i686-w64-mingw32-gcc"
-        elseif package:is_arch("arm64", "aarch64") then
+        elseif is_arch("arm64", "aarch64") then
             gcc = "aarch64-w64-mingw32-gcc"
             gcc = "aarch64-w64-mingw32-gcc"
-        elseif package:is_arch("armv7", "arm.*") then
+        elseif is_arch("armv7", "arm.*") then
             gcc = "armv7-w64-mingw32-gcc"
             gcc = "armv7-w64-mingw32-gcc"
+        else
+            gcc = "x86_64-w64-mingw32-gcc"
         end
         end
         if gcc and is_host("windows") then
         if gcc and is_host("windows") then
             gcc = gcc .. ".exe"
             gcc = gcc .. ".exe"