mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 02:54:29 +08:00
Change default build option to use static linking for the
MySQL client library, and support perconaserverclient as a valid link target.
This commit is contained in:
@ -41,16 +41,12 @@ def get_config():
|
|||||||
static = enabled(options, 'static')
|
static = enabled(options, 'static')
|
||||||
if enabled(options, 'embedded'):
|
if enabled(options, 'embedded'):
|
||||||
libs = mysql_config("libmysqld-libs")
|
libs = mysql_config("libmysqld-libs")
|
||||||
client = "mysqld"
|
|
||||||
elif enabled(options, 'threadsafe'):
|
elif enabled(options, 'threadsafe'):
|
||||||
libs = mysql_config("libs_r")
|
libs = mysql_config("libs_r")
|
||||||
client = "mysqlclient_r"
|
|
||||||
if not libs:
|
if not libs:
|
||||||
libs = mysql_config("libs")
|
libs = mysql_config("libs")
|
||||||
client = "mysqlclient"
|
|
||||||
else:
|
else:
|
||||||
libs = mysql_config("libs")
|
libs = mysql_config("libs")
|
||||||
client = "mysqlclient"
|
|
||||||
|
|
||||||
library_dirs = [dequote(i[2:]) for i in libs if i.startswith('-L')]
|
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')]
|
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
|
||||||
@ -68,6 +64,16 @@ def get_config():
|
|||||||
include_dirs = [dequote(i[2:])
|
include_dirs = [dequote(i[2:])
|
||||||
for i in mysql_config('include') if i.startswith('-I')]
|
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:
|
if static:
|
||||||
extra_objects.append(os.path.join(library_dirs[0], 'lib%s.a' % client))
|
extra_objects.append(os.path.join(library_dirs[0], 'lib%s.a' % client))
|
||||||
if client in libraries:
|
if client in libraries:
|
||||||
|
2
site.cfg
2
site.cfg
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
embedded = False
|
embedded = False
|
||||||
threadsafe = True
|
threadsafe = True
|
||||||
static = False
|
static = True
|
||||||
|
|
||||||
# The path to mysql_config.
|
# The path to mysql_config.
|
||||||
# Only use this if mysql_config is not on your PATH, or you have some weird
|
# Only use this if mysql_config is not on your PATH, or you have some weird
|
||||||
|
Reference in New Issue
Block a user