Skip to content

Commit

Permalink
Really fix gettext on Android (#1306)
Browse files Browse the repository at this point in the history
* Fix the gettext Android patch

Writing stupid patches in a hurry at 3AM is generally not a great idea ;p.

* Really fix it.

* Duh, we need a shell for the shell redirection to work.
  • Loading branch information
NiLuJe committed Feb 15, 2021
1 parent e414b20 commit 31ff9fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion thirdparty/gettext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ ExternalProject_Add(
PATCH_COMMAND COMMAND ${PATCH_CMD}
CONFIGURE_COMMAND ${CFG_CMD}
BUILD_COMMAND ${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} --silent
INSTALL_COMMAND ${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} --silent install 2>&1 >/dev/null
INSTALL_COMMAND sh -c ${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} --silent install 2>&1 >/dev/null
)
26 changes: 21 additions & 5 deletions thirdparty/gettext/gettext-0.21-android-pre21-build.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
diff -NuarpZ gettext-0.21-ori/libtextstyle/lib/glib/gstrfuncs.c gettext-0.21/libtextstyle/lib/glib/gstrfuncs.c
--- gettext-0.21-ori/libtextstyle/lib/glib/gstrfuncs.c 2020-04-11 12:01:49.000000000 +0200
+++ gettext-0.21/libtextstyle/lib/glib/gstrfuncs.c 2021-02-15 01:46:57.774772752 +0100
@@ -588,7 +588,11 @@ g_ascii_formatd (gchar *buffer,
+++ gettext-0.21/libtextstyle/lib/glib/gstrfuncs.c 2021-02-15 16:10:30.130191728 +0100
@@ -555,9 +555,6 @@ g_ascii_formatd (gchar *buffer,
const gchar *format,
gdouble d)
{
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
gchar *p;
int rest_len;
gchar format_char;
@@ -587,9 +584,16 @@ g_ascii_formatd (gchar *buffer,

_g_snprintf (buffer, buf_len, format, d);

locale_data = localeconv ();
+#if defined(__ANDROID__) && __ANDROID_API__ < 21
+ decimal_point = '.';
+ const char decimal_point[] = ".";
+ int decimal_point_len = 1;
+#else
+ struct lconv *locale_data;
+ const char *decimal_point;
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
+ int decimal_point_len = strlen (decimal_point);
+#endif
decimal_point_len = strlen (decimal_point);

g_assert (decimal_point_len != 0);

0 comments on commit 31ff9fa

Please sign in to comment.