From 46805facbc099a7c4887e2acf7bbea4fe0218459 Mon Sep 17 00:00:00 2001 From: "e. ravyn deadbunny" Date: Tue, 15 May 2018 17:37:58 -0700 Subject: [PATCH] Change default build option to use static linking for the MySQL client library, and support perconaserverclient as a valid link target. --- setup_posix.py | 14 ++++++++++---- site.cfg | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/setup_posix.py b/setup_posix.py index 14cffca..216347e 100644 --- a/setup_posix.py +++ b/setup_posix.py @@ -41,16 +41,12 @@ def get_config(): static = enabled(options, 'static') if enabled(options, 'embedded'): libs = mysql_config("libmysqld-libs") - client = "mysqld" elif enabled(options, 'threadsafe'): libs = mysql_config("libs_r") - client = "mysqlclient_r" if not libs: libs = mysql_config("libs") - client = "mysqlclient" else: libs = mysql_config("libs") - client = "mysqlclient" library_dirs = [dequote(i[2:]) for i in libs if i.startswith('-L')] libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')] @@ -68,6 +64,16 @@ def get_config(): include_dirs = [dequote(i[2:]) for i in mysql_config('include') if i.startswith('-I')] + + # properly handle mysql client libraries that are not called libmysqlclient + client = None + CLIENT_LIST = ['mysqlclient', 'mysqlclient_r', 'mysqld', + 'perconaserverclient', 'perconaserverclient_r'] + for c in CLIENT_LIST: + if c in libraries: + client = c + break + if static: extra_objects.append(os.path.join(library_dirs[0], 'lib%s.a' % client)) if client in libraries: diff --git a/site.cfg b/site.cfg index 8e2ab99..8afdef7 100644 --- a/site.cfg +++ b/site.cfg @@ -5,7 +5,7 @@ embedded = False threadsafe = True -static = False +static = True # The path to mysql_config. # Only use this if mysql_config is not on your PATH, or you have some weird