Explorar el Código

libelf: fix build (#7022)

* test

* try fix

* test `"cross", "linux", "android@linux,macosx"`

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* test `os.rm("configure", "config.guess", "config.sub")`

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* `else`
Saikari hace 5 meses
padre
commit
0c62946b88
Se han modificado 1 ficheros con 15 adiciones y 6 borrados
  1. 15 6
      packages/l/libelf/xmake.lua

+ 15 - 6
packages/l/libelf/xmake.lua

@@ -9,7 +9,9 @@ package("libelf")
 
     add_includedirs("include", "include/libelf")
 
-    on_install("linux", "android", function (package)
+    add_deps("autotools")
+
+    on_install("cross", "linux", "android@linux,macosx", function (package)
         local configs = {"--disable-dependency-tracking",
                          "--disable-compat"}
         table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
@@ -18,11 +20,7 @@ package("libelf")
             table.insert(configs, "--enable-debug")
         end
         local cxflags = {}
-        if package:config("pic") ~= false then
-            table.insert(cxflags, "-fPIC")
-        end
         if package:is_plat("android") then
-            io.replace("./configure", "#define off_t long", "")
             io.replace("lib/private.h", "HAVE_MEMMOVE", "1")
             io.replace("lib/private.h", "HAVE_MEMCPY", "1")
             io.replace("lib/private.h", "STDC_HEADERS", "1")
@@ -33,7 +31,18 @@ package("libelf")
             package:add("defines", "__libelf_u64_t=uint64_t")
             package:add("defines", "__libelf_i64_t=int64_t")
         end
-        io.replace("./configure", "main(){return(0);}", "int main(){return(0);}", {plain = true})
+        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"), ".")
+        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")})
+        end
         import("package.tools.autoconf").install(package, configs, {cxflags = cxflags})
     end)