package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.9 KiB

6 years ago
package("libpng")
set_homepage("http://www.libpng.org/pub/png/libpng.html")
set_description("The official PNG reference library")
set_urls("https://github.com/glennrp/libpng/archive/$(version).zip",
"https://github.com/glennrp/libpng.git")
add_versions("v1.6.36", "6274d3f761cc80f7f6e2cde6c07bed10c00bc4ddd24c4f86e25eb51affa1664d")
6 years ago
add_versions("v1.6.35", "3d22d46c566b1761a0e15ea397589b3a5f36ac09b7c785382e6470156c04247f")
add_versions("v1.6.34", "7ffa5eb8f9f3ed23cf107042e5fec28699718916668bbce48b968600475208d3")
add_deps("zlib")
6 years ago
if is_host("windows") then
add_deps("cmake")
end
6 years ago
if is_plat("windows") then
add_links("libpng16_static")
else
add_links("png")
end
6 years ago
6 years ago
on_install("windows", function (package)
6 years ago
local configs = {"-DPNG_TESTS=OFF",
"-DPNG_SHARED=OFF",
6 years ago
"-DPNG_DEBUG=" .. (package:debug() and "ON" or "OFF")}
6 years ago
import("package.tools.cmake").install(package, configs)
6 years ago
end)
6 years ago
on_install("macosx", "linux", function (package)
import("package.tools.autoconf").install(package, {"--disable-dependency-tracking", "--disable-silent-rules", "--enable-shared=no"})
end)
on_install("iphoneos", "android@linux,macosx", function (package)
6 years ago
import("package.tools.autoconf")
local zlib = package:dep("zlib")
local envs = autoconf.buildenvs(package)
if zlib then
envs.CPPFLAGS = (envs.CPPFLAGS or "") .. " -I" .. os.args(path.join(zlib:installdir(), "include"))
envs.LDFLAGS = (envs.LDFLAGS or "") .. " -L" .. os.args(path.join(zlib:installdir(), "lib"))
end
autoconf.install(package, {"--disable-dependency-tracking", "--disable-silent-rules", "--enable-shared=no"}, {envs = envs})
6 years ago
end)
on_test(function (package)
assert(package:has_cfuncs("png_create_read_struct", {includes = "png.h"}))
end)