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.
This commit is contained in:
Tony Theodore 2015-10-11 02:22:13 +11:00
parent 6d5a460ee8
commit c1cd559571
2 changed files with 31 additions and 1 deletions

23
src/libmysqlclient-test.c Normal file
View File

@ -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;
}

View File

@ -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