From 4a628dff6204ee08d0f75c6b670eea1e4fd55400 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:36:34 +0800 Subject: [PATCH] enable fontconfig on windows (#2847) * update harfbuzz * enable fontconfig on windows * fix expat * depend on gperf --- packages/f/fontconfig/xmake.lua | 35 ++++++++++++++++++++++----------- packages/g/gperf/xmake.lua | 16 +++++++++++++-- packages/h/harfbuzz/xmake.lua | 1 + 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/packages/f/fontconfig/xmake.lua b/packages/f/fontconfig/xmake.lua index 429df7ba0..5d3d91098 100644 --- a/packages/f/fontconfig/xmake.lua +++ b/packages/f/fontconfig/xmake.lua @@ -8,28 +8,41 @@ package("fontconfig") add_versions("2.13.93", "0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5") add_versions("2.13.94", "246d1640a7e54fba697b28e4445f4d9eb63dda1b511d19986249368ee7191882") add_versions("2.14.0", "b8f607d556e8257da2f3616b4d704be30fd73bd71e367355ca78963f9a7f0434") - - add_deps("meson", "pkg-config", "freetype >=2.9", "expat", "ninja >=1.8.2") - add_deps("python 3.x", {kind = "binary"}) - if is_plat("macosx") then - add_deps("gettext") - else - add_deps("autoconf", "automake", "libtool", "gperf", "bzip2") - add_deps("util-linux", {configs = {libuuid = true}}) - end + add_versions("2.14.2", "3ba2dd92158718acec5caaf1a716043b5aa055c27b081d914af3ccb40dce8a55") -- fix the build issue with --enable-static add_patches("2.13.1", "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/8208f99fa1676c42bfd8d74de3e9dac5366c150c.diff", "2abdff214b99f2d074170e6512b0149cc858ea26cd930690aa6b4ccea2c549ef") - on_install("linux", "macosx", function (package) + add_configs("nls", {description = "Enable Native Language Support (NLS)", default = false, type = "boolean"}) + + add_deps("meson", "ninja", "freetype", "expat", "gperf") + add_deps("python 3.x", {kind = "binary"}) + if is_plat("linux") then + add_deps("pkg-config") + end + + on_load("windows", "linux", "macosx", function (package) + if package:config("nls") and not package:is_plat("linux") then + package:add("deps", "libintl") + end + if package:is_plat("linux") and package:version():lt("2.13.91") then + package:add("deps", "util-linux", {configs = {libuuid = true}}) + package:add("deps", "autoconf", "automake", "libtool", "bzip2") + end + end) + + on_install("windows", "linux", "macosx", function (package) + if package:is_plat("windows") then + io.replace("meson.build", "c_args = []", "c_args = ['-DXML_STATIC']", {plain = true}) + end local configs = { "-Dtests=disabled", "-Dtools=disabled", "-Ddoc=disabled"} table.insert(configs, "-Ddebug=" .. (package:debug() and "true" or "false")) table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static")) - + table.insert(configs, "-Dnls=" .. (package:config("nls") and "enabled" or "disabled")) import("package.tools.meson").install(package, configs) end) diff --git a/packages/g/gperf/xmake.lua b/packages/g/gperf/xmake.lua index fd8694a4c..8b68099a4 100644 --- a/packages/g/gperf/xmake.lua +++ b/packages/g/gperf/xmake.lua @@ -8,11 +8,23 @@ package("gperf") "https://ftpmirror.gnu.org/gperf/gperf-$(version).tar.gz") add_versions("3.1", "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2") - if is_plat("linux") then + if is_host("linux") then add_extsources("apt::gperf", "pacman::gperf") end - on_install("macosx", "linux", function (package) + on_install("@windows", function (package) + os.cp("src/config.h.in", "src/config.h") + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + target("gperf") + set_kind("binary") + add_files("lib/*.c", "lib/*.cc", "src/*.cc") + add_includedirs("lib", "src") + ]]) + import("package.tools.xmake").install(package) + end) + + on_install("@macosx", "@linux", function (package) import("package.tools.autoconf").install(package) end) diff --git a/packages/h/harfbuzz/xmake.lua b/packages/h/harfbuzz/xmake.lua index c55624e88..b5bb49594 100644 --- a/packages/h/harfbuzz/xmake.lua +++ b/packages/h/harfbuzz/xmake.lua @@ -18,6 +18,7 @@ package("harfbuzz") add_versions("8.0.1", "d54ca67b6a0bf732b66a343566446d7f93df2bb850133f886c0082fb618a06b2") add_versions("8.1.0", "8d544f1b74797b7b4d88f586e3b9202528b3e8c17968d28b7cdde02041bff5a0") add_versions("8.1.1", "b16e6bc0fc7e6a218583f40c7d201771f2e3072f85ef6e9217b36c1dc6b2aa25") + add_versions("8.3.0", "6a093165442348d99f3307480ea87ed83bdabaf642cdd9548cff6b329e93bfac") add_configs("icu", {description = "Enable ICU library unicode functions.", default = false, type = "boolean"}) add_configs("freetype", {description = "Enable freetype interop helpers.", default = true, type = "boolean"})