@@ -251,6 +251,25 @@ SET(CLIENT_API_FUNCTIONS
251
251
)
252
252
253
253
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" )
254
+ IF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING )
255
+
256
+ INCLUDE (CheckCSourceCompiles )
257
+ FILE (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY} /CMakeTmp/src.ld"
258
+ "VERSION {\n libmysqlclient_18 {\n global: *;\n };\n }\n " )
259
+ SET (CMAKE_REQUIRED_LIBRARIES "-Wl,src.ld" )
260
+ CHECK_C_SOURCE_COMPILES ("int main() { return 0; }"
261
+ SUPPORTS_VERSION_IN_LINK_SCRIPT )
262
+ SET (CMAKE_REQUIRED_LIBRARIES )
263
+
264
+ IF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT )
265
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=16895
266
+ MESSAGE (SEND_ERROR "Your current linker does not support VERSION "
267
+ "command in linker scripts like a GNU ld or any compatible linker "
268
+ "should. Perhaps you're using gold? Either switch to GNU ld compatible "
269
+ "linker or run cmake with -DDISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING=TRUE "
270
+ "to be able to complete the build" )
271
+ ENDIF (NOT SUPPORTS_VERSION_IN_LINK_SCRIPT )
272
+
254
273
# When building RPM, or DEB package on Debian, use ELF symbol versioning
255
274
# for compatibility with distribution packages, so client shared library can
256
275
# painlessly replace the one supplied by the distribution.
@@ -335,14 +354,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
335
354
make_scrambled_password_323
336
355
)
337
356
338
- # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529
339
- SET (VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR} /libmysql_versions.ld.in )
340
-
341
357
# Generate version script.
342
358
# Create semicolon separated lists of functions to export from
343
359
# Since RPM packages use separate versioning for 5.1 API
344
360
# and 5.5 API (libmysqlclient_16 vs libmysqlclient_18),
345
361
# we need 2 lists.
362
+ SET (VERSION_HEADER
363
+ "VERSION {
364
+ libmysqlclient_18 {
365
+ global:" )
366
+ SET (VERSION_FOOTER
367
+ " local:
368
+ *;
369
+ };
370
+
371
+ libmysqlclient_16 {
372
+ /* empty here. aliases are added above */
373
+ };
374
+ }
375
+ " )
376
+
346
377
SET (CLIENT_API_5_1_LIST )
347
378
SET (CLIENT_API_5_1_ALIASES )
348
379
FOREACH (f ${CLIENT_API_FUNCTIONS_5_1} ${CLIENT_API_5_1_EXTRA} )
@@ -355,6 +386,13 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
355
386
SET (CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST} \t ${f} ;\n " )
356
387
ENDFOREACH ()
357
388
389
+ ELSE (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING )
390
+ SET (CLIENT_API_5_1_ALIASES "/* Versioning disabled per user request. MDEV-5982 */" )
391
+ ENDIF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING )
392
+
393
+ # Linker script to version symbols in Fedora- and Debian- compatible way, MDEV-5529
394
+ SET (VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR} /libmysql_versions.ld.in )
395
+
358
396
CONFIGURE_FILE (
359
397
${VERSION_SCRIPT_TEMPLATE}
360
398
${CMAKE_CURRENT_BINARY_DIR} /libmysql_versions.ld
@@ -363,7 +401,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
363
401
SET (VERSION_SCRIPT_LINK_FLAGS
364
402
"-Wl,${CMAKE_CURRENT_BINARY_DIR} /libmysql_versions.ld" )
365
403
366
- ENDIF ()
404
+ ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux" )
367
405
368
406
369
407
SET (CLIENT_SOURCES
0 commit comments