瀏覽代碼

libelf: use `add_resources` instead of `http.download` (#7047)

* test

* pull from t gz

* try mirror

* mirror

* fixup

* fix

* re

* Update xmake.lua

* Update xmake.lua

* Try old way

* Revert into `android@linux,macosx`

* Update xmake.lua

* re-check

* Update xmake.lua

* Update xmake.lua

* Try fix win

* tryfix

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua
Saikari 4 月之前
父節點
當前提交
232345e918
共有 1 個文件被更改,包括 17 次插入14 次删除
  1. 17 14
      packages/l/libelf/xmake.lua

+ 17 - 14
packages/l/libelf/xmake.lua

@@ -1,17 +1,20 @@
 package("libelf")
-
     set_homepage("https://web.archive.org/web/20181111033959/www.mr511.de/software/english.html")
     set_description("ELF object file access library")
 
     set_urls("https://github.com/xmake-mirror/libelf/releases/download/$(version)/libelf-$(version).tar.gz",
              "https://github.com/xmake-mirror/libelf.git")
+
     add_versions("0.8.13", "591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d")
+    add_resources("0.8.13", "config", "https://dev.gentoo.org/~sam/distfiles/sys-devel/gnuconfig/gnuconfig-20240728.tar.xz", "6e3a7389d780cb0cf81bec0bba96ca278d5b76afd548352f70b4a444344430b7")
 
     add_includedirs("include", "include/libelf")
+    
+    if not is_subhost("windows") then
+        add_deps("autotools")
+    end
 
-    add_deps("autotools")
-
-    on_install("cross", "linux", "android@linux,macosx", function (package)
+    on_install("cross", "linux", "android", function (package)
         local configs = {"--disable-dependency-tracking",
                          "--disable-compat"}
         table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
@@ -31,18 +34,18 @@ package("libelf")
             package:add("defines", "__libelf_u64_t=uint64_t")
             package:add("defines", "__libelf_i64_t=int64_t")
         end
-        os.rm("configure", "config.guess", "config.sub")
-        local automake = package:dep("automake")
-        if automake and not automake:is_system() then
-            local automake_dir = path.join(automake:installdir(), "share", "automake-*")
-            os.cp(path.join(automake_dir, "config.guess"), ".")
-            os.cp(path.join(automake_dir, "config.sub"), ".")
+        if not is_subhost("windows") then
+            os.rm("configure")
         else
-            import("net.http")
-            import("core.base.global")
-            http.download("http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD", path.join(package:buildir(), "config.guess"), {insecure = global.get("insecure-ssl")})
-            http.download("http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD", path.join(package:buildir(), "config.sub"), {insecure = global.get("insecure-ssl")})
+            io.replace("lib/Makefile.in", [[$(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir;]], [["$(SHELL)" "$(top_srcdir)/mkinstalldirs" "$(instroot)$$dir";]], {plain = true})
+            io.replace("po/Makefile.in", [[$(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir;]], [["$(SHELL)" "$(top_srcdir)/mkinstalldirs" "$(instroot)$$dir";]], {plain = true})
+            io.replace("configure", [[{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }]], [[ac_cv_prog_cc_works=yes]], {plain = true})
+            io.replace("configure", [[libelf_cv_int64=no]], [[libelf_cv_int64='long']], {plain = true})
+            io.replace("configure", [[libelf_cv_int32=no]], [[libelf_cv_int32='int']], {plain = true})
+            io.replace("configure", [[libelf_cv_int16=no]], [[libelf_cv_int16='short']], {plain = true})
         end
+        os.cp(path.join(package:resourcedir("config"), "config.guess"), "config.guess")
+        os.cp(path.join(package:resourcedir("config"), "config.sub"), "config.sub")
         import("package.tools.autoconf").install(package, configs, {cxflags = cxflags})
     end)