diff --git a/packages/e/expat/xmake.lua b/packages/e/expat/xmake.lua index ae2566884..2cea1dc8c 100644 --- a/packages/e/expat/xmake.lua +++ b/packages/e/expat/xmake.lua @@ -14,6 +14,8 @@ package("expat") add_versions("2.2.10", "b2c160f1b60e92da69de8e12333096aeb0c3bf692d41c60794de278af72135a5") add_versions("2.2.6", "17b43c2716d521369f82fc2dc70f359860e90fa440bea65b3b85f0b246ea81f2") + add_configs("char_type", {description = "Character type to use", default = "char", type = "string", values = {"char", "ushort", "wchar_t"}}) + add_deps("cmake") on_load("windows", function (package) if not package:config("shared") then @@ -25,6 +27,7 @@ package("expat") local configs = {"-DEXPAT_BUILD_EXAMPLES=OFF", "-DEXPAT_BUILD_TESTS=OFF", "-DEXPAT_BUILD_DOCS=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DEXPAT_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DEXPAT_CHAR_TYPE=" .. package:config("char_type")) if package:is_plat("windows") then table.insert(configs, "-DEXPAT_MSVC_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) end diff --git a/packages/m/minizip/xmake.lua b/packages/m/minizip/xmake.lua index 14357ee34..974b46b42 100644 --- a/packages/m/minizip/xmake.lua +++ b/packages/m/minizip/xmake.lua @@ -12,6 +12,8 @@ package("minizip") add_deps("zlib") + add_includedirs("include", "include/minizip") + on_install(function (package) os.cd(path.join("contrib", "minizip")) io.writefile("xmake.lua", [[ @@ -22,7 +24,7 @@ package("minizip") target("minizip") set_kind("$(kind)") add_files("zip.c", "unzip.c", "mztools.c", "ioapi.c") - add_headerfiles("crypt.h", "zip.h", "unzip.h", "ioapi.h", "mztools.h") + add_headerfiles("crypt.h", "zip.h", "unzip.h", "ioapi.h", "mztools.h", {prefixdir = "minizip"}) add_packages("zlib") if is_plat("windows") then add_files("iowin32.c") diff --git a/packages/x/xlsxio/port/xmake.lua b/packages/x/xlsxio/port/xmake.lua index 29cb919d7..2622af058 100644 --- a/packages/x/xlsxio/port/xmake.lua +++ b/packages/x/xlsxio/port/xmake.lua @@ -6,7 +6,11 @@ option("wide", {showmenu = true, default = false}) add_rules("mode.debug", "mode.release") -add_requires("expat") +if has_config("wide") then + add_requires("expat", {configs = {char_type = "wchar_t"}}) +else + add_requires("expat") +end if has_config("libzip") then add_requires("libzip") diff --git a/packages/x/xlsxio/xmake.lua b/packages/x/xlsxio/xmake.lua index eaed7244b..599a45b39 100644 --- a/packages/x/xlsxio/xmake.lua +++ b/packages/x/xlsxio/xmake.lua @@ -16,8 +16,6 @@ package("xlsxio") add_syslinks("pthread") end - add_deps("expat") - on_load(function (package) if package:config("libzip") then package:add("deps", "libzip") @@ -26,6 +24,12 @@ package("xlsxio") else package:add("deps", "minizip") end + + if package:config("wide") then + package:add("deps", "expat", {configs = {char_type = "wchar_t"}}) + else + package:add("deps", "expat") + end end) on_install("windows", "linux", "macosx", "mingw", "cross", function (package) @@ -41,8 +45,6 @@ package("xlsxio") end package:add("defines", "BUILD_XLSXIO_" .. (package:config("shared") and "SHARED" or "STATIC")) - io.replace("lib/xlsxio_read.c", "minizip/", "", {plain = true}) - io.replace("lib/xlsxio_write.c", "minizip/", "", {plain = true}) os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") import("package.tools.xmake").install(package, configs) end)