Browse Source

mariadb: use system libedit for mysql

libedit changed its interface a while back. mariadb currently does not
recognize this interface and instead uses a static old readline version.
It does not link in the system readline due to licence incompatibility.

This commit adds a patch that enables mariadb to detect and use the
system libedit. The patch was sent upstream already ([1]).

[1] https://github.com/MariaDB/server/pull/1001

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
lilik-openwrt-22.03
Sebastian Kemper 6 years ago
parent
commit
a117d027bc
2 changed files with 106 additions and 3 deletions
  1. +1
    -3
      utils/mariadb/Makefile
  2. +105
    -0
      utils/mariadb/patches/180-libedit.patch

+ 1
- 3
utils/mariadb/Makefile View File

@ -219,7 +219,7 @@ define Package/mariadb-client
TITLE:=MariaDB database core client binaries
DEPENDS:= \
$(MARIADB_COMMON_DEPENDS) \
+libncursesw
+libedit
endef
define Package/mariadb-client/description
@ -361,13 +361,11 @@ CMAKE_OPTIONS += \
-DWITH_INNODB_LZMA=ON \
-DWITH_INNODB_LZO=OFF \
-DWITH_INNODB_SNAPPY=OFF \
-DWITH_LIBEDIT=OFF \
-DWITH_LIBNUMA=NO \
-DWITH_LIBWRAP=OFF \
-DWITH_LIBWSEP=OFF \
-DWITH_MARIABACKUP=ON \
-DWITH_PCRE=system \
-DWITH_READLINE=OFF \
-DWITH_SAFEMALLOC=OFF \
-DWITH_SSL=system \
-DWITH_SYSTEMD=no \


+ 105
- 0
utils/mariadb/patches/180-libedit.patch View File

@ -0,0 +1,105 @@
commit 2220f7458ef90829eacc457167a28aeba75ca1bc
Author: Sebastian Kemper <sebastian_ml@gmx.net>
Date: Sun Dec 9 21:19:24 2018 +0100
cmake: support new libedit interface
libedit changed it's interface a while ago. MariaDB's cmake file doesn't
recognize the new interface, the compile test fails:
/mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx: In function 'int main(int, char**)':
/mariadb-10.2.19/CMakeFiles/CMakeTmp/src.cxx:6:47: error: invalid conversion from 'char*' to 'int' [-fpermissive]
int res= (*rl_completion_entry_function)(0,0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Fix this by adding a detection for the new interface as well.
In client/mysql.cc the ifdefs for the new readline interface are
extended to also check for the new libedit interface. They work the same
way.
Run-tested on a MIPS machine.
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2577,7 +2577,7 @@ C_MODE_END
if not.
*/
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
static int fake_magic_space(int, int);
extern "C" char *no_completion(const char*,int)
#elif defined(USE_LIBEDIT_INTERFACE)
@@ -2659,7 +2659,7 @@ static int not_in_history(const char *li
}
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
static int fake_magic_space(int, int)
#else
static int fake_magic_space(const char *, int)
@@ -2676,7 +2676,7 @@ static void initialize_readline (char *n
rl_readline_name = name;
/* Tell the completer that we want a crack first. */
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
@@ -2706,7 +2706,7 @@ static char **new_mysql_completion(const
int end __attribute__((unused)))
{
if (!status.batch && !quick)
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_READLINE_INTERFACE) || defined(USE_NEW_LIBEDIT_INTERFACE)
return rl_completion_matches(text, new_command_generator);
#else
return completion_matches((char *)text, (CPFunction *)new_command_generator);
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@ -160,8 +160,20 @@ MACRO (MYSQL_FIND_SYSTEM_LIBEDIT)
int res= (*rl_completion_entry_function)(0,0);
completion_matches(0,0);
}"
- LIBEDIT_INTERFACE)
- SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE})
+ LIBEDIT_HAVE_COMPLETION_INT)
+
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <stdio.h>
+ #include <readline.h>
+ int main(int argc, char **argv)
+ {
+ char res= *(*rl_completion_entry_function)(0,0);
+ completion_matches(0,0);
+ }"
+ LIBEDIT_HAVE_COMPLETION_CHAR)
+ IF(LIBEDIT_HAVE_COMPLETION_INT OR LIBEDIT_HAVE_COMPLETION_CHAR)
+ SET(USE_LIBEDIT_INTERFACE 1)
+ ENDIF()
ENDIF()
ENDMACRO()
@@ -187,6 +199,7 @@ MACRO (MYSQL_CHECK_READLINE)
IF(USE_LIBEDIT_INTERFACE)
SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR})
SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY})
+ SET(USE_NEW_LIBEDIT_INTERFACE ${LIBEDIT_HAVE_COMPLETION_CHAR})
ELSE()
MYSQL_USE_BUNDLED_READLINE()
ENDIF()
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -113,6 +113,7 @@
/* Readline */
#cmakedefine HAVE_HIST_ENTRY 1
#cmakedefine USE_LIBEDIT_INTERFACE 1
+#cmakedefine USE_NEW_LIBEDIT_INTERFACE 1
#cmakedefine USE_NEW_READLINE_INTERFACE 1
#cmakedefine FIONREAD_IN_SYS_IOCTL 1

Loading…
Cancel
Save