summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2015-10-10 15:22:13 (GMT)
committerTony Theodore <tonyt@logyst.com>2015-10-10 15:22:26 (GMT)
commitc1cd55957116fa20209a872534bddc069fd6c13a (patch)
tree91f889b6d267cff9487d201651c11b0c1947a6ec /src
parent6d5a460ee8961637c35258a69c69231f24d6e1a2 (diff)
downloadmxe-c1cd55957116fa20209a872534bddc069fd6c13a.zip
mxe-c1cd55957116fa20209a872534bddc069fd6c13a.tar.gz
mxe-c1cd55957116fa20209a872534bddc069fd6c13a.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/libmysqlclient-test.c23
-rw-r--r--src/libmysqlclient.mk9
2 files changed, 31 insertions, 1 deletions
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 <mysql.h>
+#include <stdio.h>
+
+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