[vte/vte-0-60] all: Fix the build without ICU
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-60] all: Fix the build without ICU
- Date: Wed, 22 Apr 2020 21:45:28 +0000 (UTC)
commit 3ecbb90577582b93f43b184aab1cedd61a9ad86b
Author: Christian Persch <chpe src gnome org>
Date: Wed Apr 22 23:44:54 2020 +0200
all: Fix the build without ICU
(cherry picked from commit 262c45090dc5557732337517422f7da9bf9069bb)
src/decoder-cat.cc | 23 +++++++++++++++++++++--
src/meson.build | 6 +++++-
src/vte.cc | 4 ++++
3 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/src/decoder-cat.cc b/src/decoder-cat.cc
index c3bd83c5..d1d4fc1c 100644
--- a/src/decoder-cat.cc
+++ b/src/decoder-cat.cc
@@ -33,9 +33,12 @@
#include "debug.h"
#include "glib-glue.hh"
+#include "utf8.hh"
+
+#ifdef WITH_ICU
#include "icu-decoder.hh"
#include "icu-glue.hh"
-#include "utf8.hh"
+#endif
using namespace std::literals;
@@ -228,6 +231,8 @@ public:
}; // class Sink
+#ifdef WITH_ICU
+
static std::unique_ptr<vte::base::ICUDecoder>
make_decoder(Options const& options)
{
@@ -261,6 +266,8 @@ make_decoder(Options const& options)
return std::make_unique<vte::base::ICUDecoder>(converter, u32_converter);
}
+#endif /* WITH_ICU */
+
class Processor {
private:
gsize m_input_bytes{0};
@@ -329,6 +336,7 @@ private:
g_free(buf);
}
+#ifdef WITH_ICU
template<class Functor>
void
process_file_icu(int fd,
@@ -393,6 +401,7 @@ private:
g_free(buf);
}
+#endif /* WITH_ICU */
template<class Functor>
bool
@@ -400,6 +409,7 @@ private:
Options const& options,
Functor& func)
{
+#ifdef WITH_ICU
auto decoder = std::unique_ptr<vte::base::ICUDecoder>{};
if (options.charset()) {
decoder = make_decoder(options);
@@ -408,6 +418,7 @@ private:
}
assert(decoder != nullptr || options.charset() == nullptr);
+#endif
for (auto i = 0; i < options.repeat(); ++i) {
if (i > 0 && lseek(fd, 0, SEEK_SET) != 0) {
@@ -415,9 +426,12 @@ private:
return false;
}
+#ifdef WITH_ICU
if (decoder) {
process_file_icu(fd, decoder.get(), func);
- } else {
+ } else
+#endif
+ {
process_file_utf8(fd, func);
}
}
@@ -526,12 +540,17 @@ main(int argc,
}
if (options.list()) {
+#ifdef WITH_ICU
auto charsets = vte::base::get_icu_charsets(true);
for (auto i = 0; charsets[i]; ++i)
g_print("%s\n", charsets[i]);
g_strfreev(charsets);
return EXIT_SUCCESS;
+#else
+ g_printerr("ICU support not available.\n");
+ return EXIT_FAILURE;
+#endif
}
auto rv = bool{};
diff --git a/src/meson.build b/src/meson.build
index 447e96df..2802aa8b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -254,10 +254,14 @@ endif
# decoder cat
-decoder_cat_sources = glib_glue_sources + icu_sources + utf8_sources + debug_sources + files(
+decoder_cat_sources = glib_glue_sources + utf8_sources + debug_sources + files(
'decoder-cat.cc',
)
+if get_option('icu')
+ decoder_cat_sources += icu_sources
+endif
+
decoder_cat = executable(
'decoder-cat',
decoder_cat_sources,
diff --git a/src/vte.cc b/src/vte.cc
index 2f0d81d3..3d39bfc7 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -4165,6 +4165,7 @@ Terminal::send_child(std::string_view const& data)
_vte_byte_array_append(m_outgoing, data.data(), data.size());
break;
+#ifdef WITH_ICU
case DataSyntax::eECMA48_PCTERM: {
auto converted = m_converter->convert(data);
@@ -4173,6 +4174,7 @@ Terminal::send_child(std::string_view const& data)
_vte_byte_array_append(m_outgoing, converted.data(), converted.size());
break;
}
+#endif
default:
g_assert_not_reached();
@@ -9896,9 +9898,11 @@ Terminal::reset_decoder()
m_utf8_decoder.reset();
break;
+#ifdef WITH_ICU
case DataSyntax::eECMA48_PCTERM:
m_converter->decoder().reset();
break;
+#endif
default:
g_assert_not_reached();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]