libpng: Compile using xmake on all platforms (#3249)

* libpng: Compile using xmake

This fixes an error if zlib is found by xmake

* Update xmake.lua

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/3257/head
Jérôme Leclercq 1 year ago committed by GitHub
parent 9090f201d4
commit 557f232b9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      packages/l/libpng/xmake.lua

@ -27,7 +27,7 @@ package("libpng")
add_extsources("brew::libpng")
end
on_install("windows", "mingw", "macosx|arm64", "android", "iphoneos", "cross", "bsd", "wasm", function (package)
on_install(function (package)
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
add_requires("zlib")
@ -61,11 +61,6 @@ package("libpng")
end
]])
local configs = {}
if package:config("shared") then
configs.kind = "shared"
elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
configs.cxflags = "-fPIC"
end
if package:is_plat("android") and package:is_arch("armeabi-v7a") then
io.replace("arm/filter_neon.S", ".func", ".hidden", {plain = true})
io.replace("arm/filter_neon.S", ".endfunc", "", {plain = true})
@ -74,19 +69,6 @@ package("libpng")
import("package.tools.xmake").install(package, configs)
end)
on_install("macosx|x86_64", "linux", function (package)
local configs = {}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
if not package:dep("zlib"):is_system() then
table.insert(configs, "--with-zlib-prefix=" .. package:dep("zlib"):installdir())
end
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("png_create_read_struct", {includes = "png.h"}))
end)

Loading…
Cancel
Save