Description: Guard my_bool typedef to fix build against MariaDB headers
 MySQL >= 8.0 removed my_bool from the public client headers, while
 MariaDB still defines it there (typedef char my_bool). Only define the
 local typedef when the installed client library does not provide it,
 avoiding a conflicting-types error (FTBFS) against MariaDB headers.
Origin: vendor
Forwarded: no
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Last-Update: 2026-09-04

--- mysql-ocaml-1.2.4.orig/mysql_stubs.c
+++ mysql-ocaml-1.2.4/mysql_stubs.c
@@ -71,7 +71,13 @@
 #define STMTval(x) (*(MYSQL_STMT**)Data_custom_val(x))
 #define ROWval(x) (*(row_t**)Data_custom_val(x))
 
+/* MySQL >= 8.0 removed my_bool from the public client headers, while
+ * MariaDB still defines it there (typedef char my_bool). Only define it
+ * locally when the installed client library does not provide it, to
+ * avoid a conflicting-types error with MariaDB headers. */
+#if !defined(MARIADB_BASE_VERSION) && (!defined(MYSQL_VERSION_ID) || MYSQL_VERSION_ID >= 80000)
 typedef bool my_bool;
+#endif
 static void mysqlfailwith(char *err) Noreturn;
 static void mysqlfailmsg(const char *fmt, ...) Noreturn;
 
