Jelajahi Sumber

strawberry-perl: improve fetch from system (#8369)

* perl: improve fetch from system

* update xmake.lua

* update xmake.lua
choyy 2 bulan lalu
induk
melakukan
33313927ba
2 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 1 2
      packages/o/openssl/xmake.lua
  2. 8 0
      packages/s/strawberry-perl/xmake.lua

+ 1 - 2
packages/o/openssl/xmake.lua

@@ -65,9 +65,8 @@ package("openssl")
     end)
 
     on_install("windows", function (package)
-        local working_dir = try {function() return os.iorunv("perl", {"-MFile::Spec::Functions=rel2abs", "-e", "print rel2abs('.')"}) end}
-        assert(working_dir, "package(openssl): perl not found!")
         -- Check if Perl is using Unix-style paths
+        local working_dir = os.iorunv("perl", {"-MFile::Spec::Functions=rel2abs", "-e", "print rel2abs('.')"})
         local unix_perl = working_dir:find("/") == 1
         if (unix_perl and package:is_plat("windows")) or (not unix_perl and not package:is_plat("windows")) then
             wprint("package(openssl): Detected Perl may not match your build platform. "..

+ 8 - 0
packages/s/strawberry-perl/xmake.lua

@@ -20,6 +20,14 @@ package("strawberry-perl")
 
     add_configs("mingw", {description = "Export built-in MinGW binaries.", default = false, type = "boolean"})
 
+    on_fetch("@windows", function (package, opt)
+        if opt.system then
+            return package:find_tool("perl", {check = function()
+                return os.iorunv("perl", {"-MFile::Spec::Functions=rel2abs", "-e", "print rel2abs('.')"})
+            end})
+        end
+    end)
+
     on_install("@windows", "@msys", "@cygwin", function (package)
         os.mv("perl", package:installdir())
         os.mv("c", package:installdir())