From c1cd55957116fa20209a872534bddc069fd6c13a Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sun, 11 Oct 2015 02:22:13 +1100 Subject: libmysqlclient: fix x86_64 shared build and add test program see #914, I'm not sure why the `def` file is needed on i686 shared. --- src/libmysqlclient-test.c | 23 +++++++++++++++++++++++ src/libmysqlclient.mk | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/libmysqlclient-test.c diff --git a/src/libmysqlclient-test.c b/src/libmysqlclient-test.c new file mode 100644 index 0000000..bea0046 --- /dev/null +++ b/src/libmysqlclient-test.c @@ -0,0 +1,23 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include +#include + +int main(int argc, char *argv[]) +{ + (void)argc; + (void)argv; + + if (mysql_library_init(0, NULL, NULL)) { + fprintf(stderr, "Could not initialize MySQL library\n"); + exit(1); + } + + printf("MySQL client library initialized: %s\n", mysql_get_client_info()); + mysql_library_end(); + + return EXIT_SUCCESS; +} diff --git a/src/libmysqlclient.mk b/src/libmysqlclient.mk index 104ef7f..ee22205 100644 --- a/src/libmysqlclient.mk +++ b/src/libmysqlclient.mk @@ -36,7 +36,8 @@ define $(PKG)_BUILD '$(1)' # def file created by cmake creates link errors - cp '$(PWD)/src/$(PKG).def' '$(1).build/libmysql/libmysql_exports.def' + $(if $(findstring i686-w64-mingw32.shared,$(TARGET)), + cp '$(PWD)/src/$(PKG).def' '$(1).build/libmysql/libmysql_exports.def') $(MAKE) -C '$(1).build' -j '$(JOBS)' VERBOSE=1 $(MAKE) -C '$(1).build/include' -j 1 install VERBOSE=1 @@ -48,4 +49,10 @@ define $(PKG)_BUILD # missing headers $(INSTALL) -m644 '$(1)/include/'thr_* '$(1)/include/'my_thr* '$(PREFIX)/$(TARGET)/include' + + # build test with mysql_config + '$(TARGET)-g++' \ + -W -Wall -Werror -ansi -pedantic \ + '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \ + `'$(PREFIX)/$(TARGET)/bin/mysql_config' --cflags --libs` endef -- cgit v0.12