Improve libwebp (#1823)

* Update libwebp

* fix error in libwebp

* Revert changes for default value of options

* fix some error

* re-add option 'sharpyuv' and add some versions

* fix a error

* format

* fix some error

* add links manually

* fix error in windows shared lib building
pull/1831/head
冰雪殇璃陌梦 2 years ago committed by GitHub
parent 446d22eed5
commit 2c7878e18f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      packages/l/libwebp/xmake.lua

@ -7,7 +7,12 @@ package("libwebp")
add_urls("https://github.com/webmproject/libwebp/archive/$(version).tar.gz",
"https://github.com/webmproject/libwebp.git")
add_versions("v1.1.0", "424faab60a14cb92c2a062733b6977b4cc1e875a6398887c5911b3a1a6c56c51")
add_versions("v1.2.0", "d37571723f531e5002667632c94fa18857ed7eb5b0561e3b49e913c3e0b1403e")
add_versions("v1.2.1", "7926985218c9e546069c2013dd93774aac3f012fd275247f82b0c119ec9a3801")
add_versions("v1.2.2", "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e")
add_versions("v1.2.3", "5e8452bcfe64badadbed5480ea9e86f156fe649f15e765e6059645f0aff73546")
add_versions("v1.2.4", "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e")
add_versions("v1.3.0", "dc9860d3fe06013266c237959e1416b71c63b36f343aae1d65ea9c94832630e1")
add_configs("anim_utils", {description = "Build animation utilities.", default = false, type = "boolean"})
add_configs("cwebp", {description = "Build the cwebp command line tool.", default = false, type = "boolean"})
@ -18,14 +23,12 @@ package("libwebp")
add_configs("webpinfo", {description = "Build the webpinfo command line tool.", default = false, type = "boolean"})
add_configs("libwebpmux", {description = "Build the libwebpmux library.", default = false, type = "boolean"})
add_configs("webpmux", {description = "Build the webpmux command line tool.", default = false, type = "boolean"})
add_configs("sharpyuv", {description = "Build the sharpyuv library.", default = false, type = "boolean"})
add_configs("sharpyuv", {description = "Build the sharpyuv library, remove since v1.2.3", default = false, type = "boolean"})
add_configs("extras", {description = "Build extras.", default = false, type = "boolean"})
add_configs("thread", {description = "Enable threading support.", default = true, type = "boolean"})
add_deps("cmake")
add_deps("libpng", "libjpeg", "libtiff", "giflib")
if is_plat("linux", "bsd") then
add_syslinks("pthread")
end
add_links("webp", "webpdecoder", "webpencoder", "webpdemux")
if is_plat("macosx") then
add_extsources("brew::webp")
@ -33,20 +36,27 @@ package("libwebp")
add_extsources("apt::libwebp-dev", "pacman::libwebp")
end
on_install("linux", "macosx", "windows", "mingw", "bsd", function (package)
on_install("linux", "macosx", "windows", "mingw", "bsd", "wasm", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:config("sharpyuv") or package:version():ge("1.2.3") then
package:add("links", "sharpyuv")
end
for name, enabled in pairs(package:configs()) do
if not package:extraconf("configs", name, "builtin") then
if name == "thread" then
if enabled then
package:add("defines", "WEBP_USE_THREAD")
if package:is_plat("linux", "bsd") then
package:add("syslinks", "pthread")
end
end
elseif not package:extraconf("configs", name, "builtin") then
table.insert(configs, "-DWEBP_BUILD_" .. name:upper() .. "=" .. (enabled and "ON" or "OFF"))
end
end
local cxflags
if package:is_plat("windows") and package:config("shared") then
cxflags = "-DWEBP_EXTERN=__declspec(dllexport)"
end
import("package.tools.cmake").install(package, configs, {cxflags = cxflags})
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)

Loading…
Cancel
Save