TT#55204 Support building against mariadb 10.3.13

Instead of hardcoding -I/usr/include/mysql for CFLAGS and -lmysqlclient
for LDFLAGS, let's use mariadb_config if available (e.g. on
Debian/buster), try mysql_config otherwise (e.g. on Debian/stretch) or
if neither of them is available, fallback to -I/usr/include/mysql +
-lmysqlclient.

No longer include `m_string.h`, it was moved towards
/usr/include/mariadb/server/m_string.h and is no longer compatible when
used as such:

| /usr/include/mariadb/server/m_string.h:89:23: error: unknown type name 'uchar'; did you mean 'char'?
|  extern void bmove_upp(uchar *dst,const uchar *src,size_t len);

Also no longer use libmysqlclient15-dev as alternative Build-Depend,
it's not available in neither stretch nor buster.

While at it drop include for my_global.h, since it shouldn't be included
anymore (and it doesn't seem to be relevant for us, compiling fine as-is
on Debian/stretch and Debian/buster):

| /usr/include/mariadb/my_global.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]

Change-Id: I74a75ea24f72880adb8117ae5808095f03bc0edb
changes/33/28133/2
Michael Prokop 7 years ago
parent f15a2924f8
commit ba5da32f2a

@ -7,14 +7,29 @@ CC := gcc
CPPFLAGS := -DMEDIATOR_VERSION="\"$(VERSION)\""
GLIB_CFLAGS := $(shell pkg-config glib-2.0 --cflags)
CFLAGS := -I/usr/include/mysql $(GLIB_CFLAGS) -g -Wall -Wextra -O2 -D_GNU_SOURCE
# mariadb/mysql support
ifneq ($(shell which mariadb_config),)
MYSQL_CFLAGS := $(shell mariadb_config --cflags)
MYSQL_LDFLAGS := $(shell mariadb_config --libs)
else ifneq ($(shell which mysql_config),)
MYSQL_CFLAGS := $(shell mysql_config --cflags)
MYSQL_LDFLAGS := $(shell mysql_config --libs)
else
MYSQL_CFLAGS := -I/usr/include/mysql
MYSQL_LDFLAGS := -lmysqlclient
endif
CFLAGS := $(GLIB_CFLAGS) -g -Wall -Wextra -O2 -D_GNU_SOURCE
CFLAGS += $(MYSQL_CFLAGS)
#CFLAGS += -DWITH_TIME_CALC
CFLAGS += $(shell pkg-config json-c --cflags)
CFLAGS += $(shell pkg-config hiredis --cflags)
CFLAGS += $(shell pkg-config libsystemd --cflags)
GLIB_LDFLAGS := $(shell pkg-config glib-2.0 --libs)
LDFLAGS := $(GLIB_LDFLAGS) -lmysqlclient
LDFLAGS := $(GLIB_LDFLAGS)
LDFLAGS += $(MYSQL_LDFLAGS)
LDFLAGS += $(shell pkg-config json-c --libs)
LDFLAGS += $(shell pkg-config hiredis --libs)
LDFLAGS += $(shell pkg-config libsystemd --libs)

2
debian/control vendored

@ -4,7 +4,7 @@ Priority: optional
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends:
debhelper (>= 10),
default-libmysqlclient-dev | libmysqlclient15-dev,
default-libmysqlclient-dev,
libglib2.0-dev,
libhiredis-dev,
libjson-c-dev,

@ -1,5 +1,3 @@
#include <my_global.h>
#include <m_string.h>
#include <mysql.h>
#include <mysql/errmsg.h>
#include <mysql/mysqld_error.h>

Loading…
Cancel
Save