diff options
author | Vladislav Vaintroub <wlad@sol> | 2009-12-11 18:33:00 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@sol> | 2009-12-11 18:33:00 +0000 |
commit | 3a6b75949c44709fec9841a3b216dec2f46826e1 (patch) | |
tree | a7d5625c5003cd5f0091afebc7934a0260ad1e71 | |
parent | 55ccb35ba66e4e9168c412c95ebbb85106db8b2c (diff) | |
download | mariadb-git-3a6b75949c44709fec9841a3b216dec2f46826e1.tar.gz |
Introduce macro DTRACE_INSTRUMENT_STATIC_LIBS,to hide
the ugly Solaris dtrace workarounds
-rw-r--r-- | cmake/dtrace.cmake | 35 | ||||
-rwxr-xr-x | sql/CMakeLists.txt | 38 |
2 files changed, 38 insertions, 35 deletions
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index 960a7aa4c84..653114d4963 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -103,10 +103,41 @@ MACRO (DTRACE_INSTRUMENT target) COMMAND ${CMAKE_RANLIB} ${target_location} ) - # Remember the object directory (it is used to workaround lack of static - # library support when linking mysqld) + # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "") ENDIF() ENDIF() ENDIF() ENDMACRO() + + +# Ugly workaround for Solaris' DTrace inability to use probes +# from static libraries, discussed e.g in this thread +# (http://opensolaris.org/jive/thread.jspa?messageID=432454) +# We have to collect all object files that may be instrumented +# and go into the mysqld (also those that come from in static libs) +# run them again through dtrace -G to generate an ELF file that links +# to mysqld. +MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs) +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) + FOREACH(lib ${libs}) + SET(dirs ${dirs} ${TARGET_OBJECT_DIRECTORY_${lib}}) + ENDFOREACH() + SET (obj ${CMAKE_BINARY_DIR}/${target}_dtrace_all.o) + ADD_CUSTOM_COMMAND( + OUTPUT ${obj} + DEPENDS ${libs} + COMMAND ${CMAKE_COMMAND} + -DDTRACE=${DTRACE} + -DOUTFILE=${obj} + -DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d + -DDTRACE_FLAGS=${DTRACE_FLAGS} + "-DDIRS=${dirs}" + -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake + VERBATIM + ) + ADD_CUSTOM_TARGET(${target}_dtrace_all DEPENDS ${obj}) + ADD_DEPENDENCIES(${target} ${target}_dtrace_all) + TARGET_LINK_LIBRARIES(${target} ${obj}) +ENDIF() +ENDMACRO() diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 92cf55aa4ff..8062fd62c1a 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -91,39 +91,7 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${SSL_LIBRARIES}) - - -# Ugly workaround for Solaris' DTrace inability to use probes -# from static libraries currently, discussed e.g in this thread -# (http://opensolaris.org/jive/thread.jspa?messageID=432454) -# We have to collect all object files that may be instrumented -# and go into the mysqld (also those that come from in static libs) -# run them again through dtrace -G to generate an ELF file that links -# to mysqld. -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) - SET(DTRACE_PROBES_ALL ${CMAKE_CURRENT_BINARY_DIR}/dtrace_probes_all.o) - SET(DTRACED_LIBS sql ${MYSQLD_STATIC_PLUGIN_LIBS} mysys) - FOREACH(lib ${DTRACED_LIBS}) - SET(DTRACE_DIRS ${DTRACE_DIRS} ${TARGET_OBJECT_DIRECTORY_${lib}}) - ENDFOREACH() - MESSAGE("DTRACE_DIRS=${DTRACE_DIRS}") - ADD_CUSTOM_COMMAND( - OUTPUT ${DTRACE_PROBES_ALL} - DEPENDS ${DTRACED_LIBS} - COMMAND ${CMAKE_COMMAND} - -DDTRACE=${DTRACE} - -DOUTFILE=${DTRACE_PROBES_ALL} - -DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d - -DDTRACE_FLAGS=${DTRACE_FLAGS} - "-DDIRS=${DTRACE_DIRS}" - -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake - VERBATIM - ) -ELSE() - SET(DTRACE_PROBES_ALL) -ENDIF() - IF(WIN32) SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h) @@ -132,7 +100,6 @@ ELSE() ENDIF() ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) - IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -168,6 +135,11 @@ IF(INTERFACE_LIBS) "${INTERFACE_LIBS}") ENDIF() +# On Solaris, some extra effort is required in order to get dtrace probes +# from static libraries +DTRACE_INSTRUMENT_STATIC_LIBS(mysqld + "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") + INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) |