Compatibility between MySQL versions improved, ease compilation

This commit is contained in:
Juan Ferrer 2019-12-04 14:43:02 +01:00
parent dbeaaecc03
commit cb74130ca3
4 changed files with 36 additions and 36 deletions

View File

@ -4,29 +4,14 @@ mysql_CFLAGS = `mysql_config --cflags`
vn_mysql_libdir = /usr/lib/mysql/plugin
if MYSQL8
MYSQLD_SOURCE = /var/mysql/mysql-8.0.15
vn_mysql_CFLAGS = \
-Wall -O3 \
-DMYSQL8=1 \
-I$(MYSQLD_SOURCE)/include \
-I$(MYSQLD_SOURCE) \
-I$(MYSQLD_SOURCE)/bld/include \
-I$(MYSQLD_SOURCE)libbinlogevents/export \
$(mysql_CFLAGS)
else
vn_mysql_CFLAGS = \
-Wall -O3 \
$(mysql_CFLAGS)
endif
vn_mysql_LDFLAGS = \
-no-undefined \
-module \
-avoid-version \
-export-dynamic \
$(mysql_LIBS)
$(mysql_LIBS)

View File

@ -10,21 +10,37 @@ Install basic tools for compiling.
$ apt-get install build-essential devscripts dh-autoreconf
```
Install MySQL and GLib development libraries.
Install MySQL development libraries.
```
$ apt-get install libmysqld-dev libglib2.0-dev
$ apt-get install libmysqld-dev
```
Compile and generate Debian package for MySQL 5.
If MySQL development libraries are not available for your distribution or MySQL
version you can obtain MySQL server source code from apt sources repository or
from MySQL page.
```
$ apt-get source mysql-community
```
Install GLib development libraries.
```
$ apt-get install libglib2.0-dev
```
Run autogen.
```
$ ./autogen.sh
```
Compile and generate Debian package.
```
$ debuild -uc -us -b
```
Compile and generate Debian package for MySQL 8.
If development libraries are not available and you have downloaded the server
source code, you can tell the build command it's location.
```
$ ./autogen.sh
$ debuild --set-envvar MYSQL8=TRUE -uc -us -b
$ debuild --set-envvar MYSQLD_SOURCE=[mysqld_source_dir] -uc -us -b
```
## Installing
@ -52,6 +68,13 @@ DROP FUNCTION IF EXISTS multimax;
DROP FUNCTION IF EXISTS sql_printf;
```
## Commands
Obtain MySQL version from commandline.
```
$ mysql_config --version | cut -d "." -f 1
```
## Built with
* [MySQL](https://dev.mysql.com/doc/refman/8.0/en/extending-mysql.html)

View File

@ -13,8 +13,6 @@ AC_PROG_CXX
AC_PROG_CC
PKG_CHECK_MODULES([glib], [glib-2.0])
AM_CONDITIONAL([MYSQL8], [test ! -z "$MYSQL8"])
AC_CONFIG_FILES([
Makefile
proxy-auth/Makefile

View File

@ -20,22 +20,14 @@
#include <string.h>
#include <glib-unix.h>
#ifndef MYSQL8
#define MYSQL_ABI_CHECK
#endif
//#include <stdbool.h>
#include <mysql.h>
#include <mysql/errmsg.h>
#include <mysql/plugin_auth.h>
#ifdef MYSQL8
#include <ctype.h>
#include <mysql/plugin.h>
#endif
#define CONFIG_FILE _CONFIG_DIR"/proxy-auth.ini"
#define SQL_FILE _SQL_DIR"/proxy-auth.sql"
#define CONFIG_FILE _CONFIG_DIR"/proxy-auth.ini"
#define SQL_FILE _SQL_DIR"/proxy-auth.sql"
typedef struct {
gboolean initialized;
@ -416,13 +408,15 @@ proxy_auth_handler = {
MYSQL_AUTHENTICATION_INTERFACE_VERSION,
"mysql_clear_password", // Cleartext plugin required in the client
proxy_auth_plugin_main,
#if MYSQL_VERSION_ID >= 50700
generate_auth_string_hash,
validate_auth_string_hash,
set_salt,
AUTH_FLAG_PRIVILEGED_USER_FOR_PASSWORD_CHANGE,
#ifdef MYSQL8
#if MYSQL_VERSION_ID >= 80000
NULL
#endif
#endif
};
mysql_declare_plugin(proxy_auth) {
@ -433,7 +427,7 @@ mysql_declare_plugin(proxy_auth) {
"Proxy user authentication server-side plugin",
PLUGIN_LICENSE_GPL,
proxy_auth_plugin_init,
#ifdef MYSQL8
#if MYSQL_VERSION_ID >= 80000
NULL,
#endif
proxy_auth_plugin_deinit,