Skip to content

Commit 46805fa

Browse files
author
e. ravyn deadbunny
committed
Change default build option to use static linking for the
MySQL client library, and support perconaserverclient as a valid link target.
1 parent cddc375 commit 46805fa

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

setup_posix.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,12 @@ def get_config():
4141
static = enabled(options, 'static')
4242
if enabled(options, 'embedded'):
4343
libs = mysql_config("libmysqld-libs")
44-
client = "mysqld"
4544
elif enabled(options, 'threadsafe'):
4645
libs = mysql_config("libs_r")
47-
client = "mysqlclient_r"
4846
if not libs:
4947
libs = mysql_config("libs")
50-
client = "mysqlclient"
5148
else:
5249
libs = mysql_config("libs")
53-
client = "mysqlclient"
5450

5551
library_dirs = [dequote(i[2:]) for i in libs if i.startswith('-L')]
5652
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
@@ -68,6 +64,16 @@ def get_config():
6864
include_dirs = [dequote(i[2:])
6965
for i in mysql_config('include') if i.startswith('-I')]
7066

67+
68+
# properly handle mysql client libraries that are not called libmysqlclient
69+
client = None
70+
CLIENT_LIST = ['mysqlclient', 'mysqlclient_r', 'mysqld',
71+
'perconaserverclient', 'perconaserverclient_r']
72+
for c in CLIENT_LIST:
73+
if c in libraries:
74+
client = c
75+
break
76+
7177
if static:
7278
extra_objects.append(os.path.join(library_dirs[0], 'lib%s.a' % client))
7379
if client in libraries:

site.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
embedded = False
77
threadsafe = True
8-
static = False
8+
static = True
99

1010
# The path to mysql_config.
1111
# Only use this if mysql_config is not on your PATH, or you have some weird

0 commit comments

Comments
 (0)