File liborcus-0.21.0-fix-building.patch of Package mingw64-liborcus

diff -ur liborcus-0.21.0.orig/configure.ac liborcus-0.21.0/configure.ac
--- liborcus-0.21.0.orig/configure.ac	2025-09-12 23:52:57.000000000 +0200
+++ liborcus-0.21.0/configure.ac	2026-01-01 14:24:29.243278360 +0100
@@ -368,6 +368,23 @@
         CXXFLAGS="$CXXFLAGS -Werror"
 ])
 
+# ==============
+# CLI support
+# ==============
+
+ORCUS_CLI_ANSI_CXXFLAGS=""
+ORCUS_CLI_UNICODE_CXXFLAGS=""
+
+case "$host_os-$GXX" in
+  *mingw*-yes|*cygwin*-yes)
+    ORCUS_CLI_ANSI_CXXFLAGS="-mconsole"
+    ORCUS_CLI_UNICODE_CXXFLAGS="-mconsole -municode"
+    ;;
+esac
+
+AC_SUBST([ORCUS_CLI_ANSI_CXXFLAGS])
+AC_SUBST([ORCUS_CLI_UNICODE_CXXFLAGS])
+
 AX_VALGRIND_CHECK()
 
 AC_CONFIG_FILES([Makefile
diff -ur liborcus-0.21.0.orig/src/cli_global.cpp liborcus-0.21.0/src/cli_global.cpp
--- liborcus-0.21.0.orig/src/cli_global.cpp	2025-08-12 03:21:20.000000000 +0200
+++ liborcus-0.21.0/src/cli_global.cpp	2026-01-01 14:18:10.591751109 +0100
@@ -13,7 +13,7 @@
 #include "filesystem_env.hpp"
 
 #ifdef _WIN32
-#include <Windows.h>
+#include <windows.h>
 #endif
 
 namespace po = boost::program_options;
diff -ur liborcus-0.21.0.orig/src/Makefile.am liborcus-0.21.0/src/Makefile.am
--- liborcus-0.21.0.orig/src/Makefile.am	2025-08-12 03:21:20.000000000 +0200
+++ liborcus-0.21.0/src/Makefile.am	2026-01-01 14:21:34.624117804 +0100
@@ -166,6 +166,7 @@
 # orcus-detect
 
 orcus_detect_SOURCES = orcus_detect_main.cpp cli_global.cpp
+orcus_detect_CXXFLAGS = $(ORCUS_CLI_UNICODE_CXXFLAGS)
 orcus_detect_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
@@ -203,7 +204,7 @@
 	orcus_filter_global.hpp \
 	orcus_filter_global.cpp \
 	orcus_csv_main.cpp
-
+orcus_csv_CXXFLAGS = $(ORCUS_CLI_UNICODE_CXXFLAGS)
 orcus_csv_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
@@ -232,7 +233,7 @@
 	cli_global.hpp \
 	cli_global.cpp \
 	orcus_xml_main.cpp
-
+orcus_xml_CXXFLAGS = $(ORCUS_CLI_ANSI_CXXFLAGS)
 orcus_xml_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
@@ -267,7 +268,7 @@
 	orcus_filter_global.hpp \
 	orcus_filter_global.cpp \
 	orcus_ods_main.cpp
-
+orcus_ods_CXXFLAGS = $(ORCUS_CLI_UNICODE_CXXFLAGS)
 orcus_ods_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
@@ -333,7 +334,7 @@
 	orcus_filter_global.hpp \
 	orcus_filter_global.cpp \
 	orcus_xlsx_main.cpp
-
+orcus_xlsx_CXXFLAGS = $(ORCUS_CLI_UNICODE_CXXFLAGS)
 orcus_xlsx_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
@@ -369,7 +370,7 @@
 	orcus_filter_global.hpp \
 	orcus_filter_global.cpp \
 	orcus_xls_xml_main.cpp
-
+orcus_xls_xml_CXXFLAGS = $(ORCUS_CLI_UNICODE_CXXFLAGS)
 orcus_xls_xml_LDFLAGS = \
 	$(BOOST_PROGRAM_OPTIONS_LDFLAGS) \
 	$(BOOST_SYSTEM_LDFLAGS)
diff -ur liborcus-0.21.0.orig/src/spreadsheet/debug_state_dumper.cpp liborcus-0.21.0/src/spreadsheet/debug_state_dumper.cpp
--- liborcus-0.21.0.orig/src/spreadsheet/debug_state_dumper.cpp	2025-05-13 03:45:24.000000000 +0200
+++ liborcus-0.21.0/src/spreadsheet/debug_state_dumper.cpp	2026-01-01 14:18:10.591751109 +0100
@@ -132,7 +132,7 @@
 void doc_debug_state_dumper::dump_properties(const fs::path& outdir) const
 {
     const fs::path outpath = outdir / "properties.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -144,7 +144,7 @@
 void doc_debug_state_dumper::dump_styles(const fs::path& outdir) const
 {
     const fs::path outpath = outdir / "styles.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -348,7 +348,7 @@
 void doc_debug_state_dumper::dump_named_expressions(const fs::path& outdir) const
 {
     const fs::path outpath = outdir / "named-expressions.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -375,7 +375,7 @@
 {
     check_dumper dumper{m_sheet, m_sheet_name};
     fs::path outpath = outdir / "cell-values.txt";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (of)
         dumper.dump(of);
 }
@@ -383,7 +383,7 @@
 void sheet_debug_state_dumper::dump_cell_formats(const fs::path& outdir) const
 {
     fs::path outpath = outdir / "cell-formats.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -413,7 +413,7 @@
 void sheet_debug_state_dumper::dump_column_formats(const fs::path& outdir) const
 {
     fs::path outpath = outdir / "column-formats.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -427,7 +427,7 @@
 void sheet_debug_state_dumper::dump_row_formats(const fs::path& outdir) const
 {
     fs::path outpath = outdir / "row-formats.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -441,7 +441,7 @@
 void sheet_debug_state_dumper::dump_column_widths(const fs::path& outdir) const
 {
     fs::path outpath = outdir / "column-widths.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -462,7 +462,7 @@
 void sheet_debug_state_dumper::dump_row_heights(const fs::path& outdir) const
 {
     fs::path outpath = outdir / "row-heights.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -486,7 +486,7 @@
         return;
 
     fs::path outpath = outdir / "auto-filter.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
@@ -498,7 +498,7 @@
 void sheet_debug_state_dumper::dump_named_expressions(const fs::path& outdir) const
 {
     const fs::path outpath = outdir / "named-expressions.yaml";
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
     if (!of)
         return;
 
diff -ur liborcus-0.21.0.orig/src/spreadsheet/debug_state_dumper_pivot.cpp liborcus-0.21.0/src/spreadsheet/debug_state_dumper_pivot.cpp
--- liborcus-0.21.0.orig/src/spreadsheet/debug_state_dumper_pivot.cpp	2025-05-13 03:45:24.000000000 +0200
+++ liborcus-0.21.0/src/spreadsheet/debug_state_dumper_pivot.cpp	2026-01-01 14:18:10.591751109 +0100
@@ -28,7 +28,7 @@
     std::ostringstream os;
     os << "cache-" << m_store.cache_id << ".yaml";
     fs::path outpath = outdir / os.str();
-    std::ofstream of{outpath.native()};
+    std::ofstream of{outpath};
 
     if (!of)
         return;
diff -ur liborcus-0.21.0.orig/src/spreadsheet/document_impl.cpp liborcus-0.21.0/src/spreadsheet/document_impl.cpp
--- liborcus-0.21.0.orig/src/spreadsheet/document_impl.cpp	2025-07-18 23:22:35.000000000 +0200
+++ liborcus-0.21.0/src/spreadsheet/document_impl.cpp	2026-01-01 14:18:10.591751109 +0100
@@ -133,7 +133,7 @@
         outpath /= std::string{sheet->name};
         outpath.replace_extension(".txt");
 
-        std::ofstream file(outpath.native());
+        std::ofstream file(outpath);
         if (!file)
         {
             std::cerr << "failed to create file: " << outpath << std::endl;
@@ -154,7 +154,7 @@
         outpath /= std::string{sheet->name};
         outpath.replace_extension(".html");
 
-        std::ofstream file(outpath.native());
+        std::ofstream file(outpath);
         if (!file)
         {
             std::cerr << "failed to create file: " << outpath << std::endl;
@@ -173,7 +173,7 @@
         outpath /= std::string{sheet->name};
         outpath.replace_extension(".json");
 
-        std::ofstream file(outpath.native());
+        std::ofstream file(outpath);
         if (!file)
         {
             std::cerr << "failed to create file: " << outpath << std::endl;
openSUSE Build Service is sponsored by