From d54dda9fe89f9299ff2739c6a386353046f5a200 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Wed, 26 May 2021 19:00:25 +0800 Subject: [PATCH] add libavif and libimagequant (#433) * update wayland * add libimagequant * add libavif * fix libavif * update freetype * update glib --- packages/f/freetype/xmake.lua | 31 ++++++++++++------------- packages/g/glib/xmake.lua | 6 +++-- packages/l/libavif/xmake.lua | 32 ++++++++++++++++++++++++++ packages/l/libimagequant/xmake.lua | 36 ++++++++++++++++++++++++++++++ packages/w/wayland/xmake.lua | 7 +++--- 5 files changed, 91 insertions(+), 21 deletions(-) create mode 100644 packages/l/libavif/xmake.lua create mode 100644 packages/l/libimagequant/xmake.lua diff --git a/packages/f/freetype/xmake.lua b/packages/f/freetype/xmake.lua index be27034b3..7b582e67f 100644 --- a/packages/f/freetype/xmake.lua +++ b/packages/f/freetype/xmake.lua @@ -14,10 +14,15 @@ package("freetype") add_versions("2.10.4", "5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac") end + local configdeps = {woff2 = "brotli", + bzip2 = "bzip2", + png = "libpng", + zlib = "zlib"} + if not is_plat("windows") then - add_configs("woff2", {description = "Enable woff2 support.", default = true, type = "boolean"}) - add_configs("bzip2", {description = "Enable bzip2 support.", default = true, type = "boolean"}) - add_configs("png", {description = "Enable png support.", default = true, type = "boolean"}) + for conf, dep in pairs(configdeps) do + add_configs(conf, {description = "Enable " .. conf .. " support.", default = true, type = "boolean"}) + end add_includedirs("include/freetype2") end @@ -30,15 +35,11 @@ package("freetype") end on_load("linux", "macosx", function (package) - package:add("deps", "zlib", "pkg-config") - if package:config("woff2") then - package:add("deps", "brotli") - end - if package:config("bzip2") then - package:add("deps", "bzip2") - end - if package:config("png") then - package:add("deps", "libpng") + package:add("deps", "pkg-config") + for conf, dep in pairs(configdeps) do + if package:config(conf) then + package:add("deps", dep) + end end end) @@ -54,9 +55,9 @@ package("freetype") "--without-harfbuzz"} table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) - table.insert(configs, "--with-bzip2=" .. (package:config("bzip2") and "yes" or "no")) - table.insert(configs, "--with-brotli=" .. (package:config("woff2") and "yes" or "no")) - table.insert(configs, "--with-png=" .. (package:config("png") and "yes" or "no")) + for conf, dep in pairs(configdeps) do + table.insert(configs, "--with-" .. conf .. "=" .. (package:config(conf) and "yes" or "no")) + end if package:config("pic") ~= false then table.insert(configs, "--with-pic") end diff --git a/packages/g/glib/xmake.lua b/packages/g/glib/xmake.lua index d340ed73b..ea54f0553 100644 --- a/packages/g/glib/xmake.lua +++ b/packages/g/glib/xmake.lua @@ -6,6 +6,7 @@ package("glib") set_urls("https://download.gnome.org/sources/glib/$(version).tar.xz", {version = function (version) return table.concat(table.slice((version):split('%.'), 1, 2), '.') .. "/glib-" .. version end}) add_versions("2.60.2", "2ef15475060addfda0443a7e8a52b28a10d5e981e82c083034061daf9a8f80d9") + add_versions("2.68.2", "ecc7798a9cc034eabdfd7f246e6dd461cdbf1175fcc2e9867cc7da7b7309e0fb") add_deps("meson", "ninja", "libffi", "pcre") if is_plat("linux") then @@ -27,10 +28,11 @@ package("glib") local configs = {"-Dbsymbolic_functions=false", "-Ddtrace=false", "-Dman=false", + "-Dtests=false", "-Ddefault_library=static", - "-Dlibmount=false", + "-Dlibmount=disabled", "-Dinstalled_tests=false"} - if package:is_plat("macosx") then + if package:is_plat("macosx") and package:version():le("2.61.0") then table.insert(configs, "-Diconv=native") end table.insert(configs, "-Dgio_module_dir=" .. path.join(package:installdir(), "lib/gio/modules")) diff --git a/packages/l/libavif/xmake.lua b/packages/l/libavif/xmake.lua new file mode 100644 index 000000000..90e3b8c04 --- /dev/null +++ b/packages/l/libavif/xmake.lua @@ -0,0 +1,32 @@ +package("libavif") + + set_homepage("https://github.com/AOMediaCodec/libavif") + set_description("libavif - Library for encoding and decoding .avif files") + set_license("BSD-2-Clause") + + add_urls("https://github.com/AOMediaCodec/libavif/archive/refs/tags/$(version).tar.gz", + "https://github.com/AOMediaCodec/libavif.git") + add_versions("v0.9.1", "8526f3fff34a05a51d7c703cdcf1d0d38c939b5b6dd4bb7d3a3405ddad88186c") + + add_configs("dav1d", {description = "Use the dav1d codec for decoding.", default = false, type = "boolean"}) + + add_deps("cmake") + on_load(function (package) + if package:config("dav1d") then + package:add("deps", "dav1d") + end + end) + + on_install("windows", "linux", "macosx", function (package) + local configs = {"-DAVIF_ENABLE_WERROR=OFF", "-DAVIF_BUILD_TESTS=OFF"} + 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("dav1d") then + table.insert(configs, "-DAVIF_CODEC_DAV1D=ON") + end + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("avifImageCreate", {includes = "avif/avif.h"})) + end) diff --git a/packages/l/libimagequant/xmake.lua b/packages/l/libimagequant/xmake.lua new file mode 100644 index 000000000..aed7243f3 --- /dev/null +++ b/packages/l/libimagequant/xmake.lua @@ -0,0 +1,36 @@ +package("libimagequant") + + set_homepage("https://pngquant.org/lib/") + set_description("Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.") + set_license("GPL-3.0") + + add_urls("https://github.com/ImageOptim/libimagequant/archive/refs/tags/$(version).tar.gz", + "https://github.com/ImageOptim/libimagequant.git") + add_versions("2.15.1", "3a9548f99be8c3b20a5d9407d0ca95bae8b0fb424a2735a87cb6cf3fdd028225") + + add_configs("sse", {description = "Use SSE.", default = true, type = "boolean"}) + + on_install("windows", "macosx", "linux", function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + option("sse") + set_showmenu(true) + add_defines("USE_SSE") + target("imagequant") + set_kind("$(kind)") + if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all") + end + add_files("libimagequant.c", "blur.c", "mediancut.c", "mempool.c", "nearest.c", "pam.c", "kmeans.c") + add_headerfiles("libimagequant.h") + add_options("sse") + ]]) + local configs = {} + configs.kind = package:config("shared") and "shared" or "static" + configs.sse = package:config("sse") and true or false + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("liq_attr_create", {includes = "libimagequant.h"})) + end) diff --git a/packages/w/wayland/xmake.lua b/packages/w/wayland/xmake.lua index 329aba0a1..a20859231 100644 --- a/packages/w/wayland/xmake.lua +++ b/packages/w/wayland/xmake.lua @@ -6,8 +6,10 @@ package("wayland") add_urls("https://wayland.freedesktop.org/releases/wayland-$(version).tar.xz") add_versions("1.18.0", "4675a79f091020817a98fd0484e7208c8762242266967f55a67776936c2e294d") + add_versions("1.19.0", "baccd902300d354581cd5ad3cc49daa4921d55fb416a5883e218750fef166d15") - add_resources("1.x", "protocols", "https://wayland.freedesktop.org/releases/wayland-protocols-1.20.tar.xz", "9782b7a1a863d82d7c92478497d13c758f52e7da4f197aa16443f73de77e4de7") + add_resources("1.18.0", "protocols", "https://wayland.freedesktop.org/releases/wayland-protocols-1.20.tar.xz", "9782b7a1a863d82d7c92478497d13c758f52e7da4f197aa16443f73de77e4de7") + add_resources("1.19.0", "protocols", "https://wayland.freedesktop.org/releases/wayland-protocols-1.21.tar.xz", "b99945842d8be18817c26ee77dafa157883af89268e15f4a5a1a1ff3ffa4cde5") add_deps("meson", "libxml2", "libffi", "expat", "bison") on_install("linux", function (package) @@ -35,9 +37,6 @@ package("wayland") envs.ACLOCAL = ACLOCAL meson.install(package, configs, {envs = envs}) - -- add links - package:add("links", "wayland-client", "wayland-server", "wayland-cursor", "wayland-egl") - -- install wayland-protocols local protocol = assert(package:resourcedir("protocols"), "wayland-protocols not found!") local configfile = find_file("configure.ac", path.join(protocol, "**"))