blob: e4f84472fb06db9b9711ef7461e8027895628e84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
SET(CMAKE_SYSTEM_NAME @CMAKE_SYSTEM_NAME@)
SET(UNIX @UNIX@)
SET(WIN32 @WIN32@)
SET(MSVC @MSVC@)
SET(CFLAGS "@CMAKE_C_FLAGS_RELWITHDEBINFO@")
SET(CXXFLAGS "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@")
SET(LDFLAGS "@CMAKE_SHARED_LIBRARY_LINK_FLAGS@")
SET(mysqlclient_LIB_DEPENDS "@mysqlclient_LIB_DEPENDS@")
SET(mysqlserver_LIB_DEPENDS "@mysqlserver_LIB_DEPENDS@")
SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
SET(CMAKE_COMPILER_IS_GNUCXX "@CMAKE_COMPILER_IS_GNUCXX@")
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
SET(VERSION "@VERSION@")
SET(MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@")
SET(MYSQL_TCP_PORT_DEFAULT "@MYSQL_TCP_PORT_DEFAULT@")
SET(MYSQL_TCP_PORT "@MYSQL_TCP_PORT@")
SET(LIBDL "@LIBDL@")
SET(LIBWRAP "@LIBWRAP@")
IF(UNIX)
# FIND_PROC and CHECK_PID are used by mysqld_safe
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET (FIND_PROC
"ps wwwp $PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" > /dev/null")
ENDIF()
IF(NOT FIND_PROC AND CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET (FIND_PROC
"ps -p $PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" > /dev/null")
ENDIF()
IF(NOT FIND_PROC)
# BSD style
EXECUTE_PROCESS(COMMAND ps -uaxww OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0)
SET( FIND_PROC
"ps -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- "\$MYSQLD\" | grep \" $PID \" > /dev/null")
ENDIF()
ENDIF()
IF(NOT FIND_PROC)
# SysV style
EXECUTE_PROCESS(COMMAND ps -ef OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0)
SET( FIND_PROC "ps -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- "\$MYSQLD\" | grep \" $PID \" > /dev/null")
ENDIF()
ENDIF()
EXECUTE_PROCESS(COMMAND sh -c "kill -0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result2)
IF(result3 MATCHES 0)
SET(CHECK_PID "kill -0 $PID > /dev/null 2> /dev/null")
ELSE()
EXECUTE_PROCESS(COMMAND sh -c "kill -s 0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result3)
IF(result4 MATCHES 0)
SET(CHECK_PID "kill -s 0 $PID > /dev/null 2> /dev/null")
ELSE()
SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null")
ENDIF()
ENDIF()
ENDIF(UNIX)
set(prefix "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
SET(bindir ${prefix}/bin)
SET(libexecdir ${prefix}/bin)
SET(scriptdir ${prefix}/bin)
SET(datadir ${prefix}/share)
SET(pkgdatadir ${prefix}/share)
SET(pkgincludedir ${prefix}/include)
SET(pkglibdir ${prefix}/lib)
SET(pkgplugindir ${prefix}/lib/plugin)
SET(localstatedir ${prefix}/data)
# some scripts use @TARGET_LINUX@
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(TARGET_LINUX 1)
ELSE()
SET(TARGET_LINUX 0)
ENDIF()
# Use cmake variables to inspect dependencies for
# mysqlclient library (add -l stuff)
SET(CLIENT_LIBS "")
SET(LIBS "")
LIST(REMOVE_ITEM mysqlclient_LIB_DEPENDS "")
LIST(REMOVE_DUPLICATES mysqlclient_LIB_DEPENDS)
FOREACH(lib ${mysqlclient_LIB_DEPENDS})
# Filter out "general", it is not a library, just CMake hint
IF(NOT lib STREQUAL "general" AND NOT CLIENT_LIBS MATCHES "-l${lib} ")
IF (lib MATCHES "^\\-l")
SET(CLIENT_LIBS "${CLIENT_LIBS} ${lib} ")
ELSEIF(lib MATCHES "^/")
# Full path, convert to just filename, strip "lib" prefix and extension
GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
STRING(REGEX REPLACE "^lib" "" lib "${lib}")
SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " )
ELSE()
SET(CLIENT_LIBS "${CLIENT_LIBS}-l${lib} " )
ENDIF()
ENDIF()
ENDFOREACH()
IF(LIBDL AND NOT LIBDL MATCHES "-l")
SET(LIBDL "-l${LIBDL}")
ENDIF()
IF(LIBWRAP)
SET(WRAPLIBS "-lwrap")
ENDIF()
SET(LIBS "${CLIENT_LIBS}")
IF(MSVC)
STRING(REPLACE "-l" "" CLIENT_LIBS "${CLIENT_LIBS}")
STRING(REPLACE "-l" "" LIBS "${LIBS}" )
ENDIF()
SET(NON_THREADED_LIBS ${CLIENT_LIBS})
IF(WIN32)
# On Windows, some .sh and some .pl.in files are configured
# The resulting files will have .pl extension (those are perl scripts)
# Input files with pl.in extension
SET(PLIN_FILES mysql_config mysql_secure_installation)
# Input files with .sh extension
SET(SH_FILES mysql_convert_table_format mysqld_multi)
FOREACH(file ${PLIN_FILES})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
FILE(INSTALL DESTINATION
"${CMAKE_INSTALL_PREFIX}/scripts" TYPE FILE
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE FILES
"${CMAKE_CURRENT_BINARY_DIR}/${file}.pl")
ENDFOREACH()
FOREACH(file ${SH_FILES})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
FILE(INSTALL DESTINATION
"${CMAKE_INSTALL_PREFIX}/scripts" TYPE FILE
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE FILES
"${CMAKE_CURRENT_BINARY_DIR}/${file}.pl")
ENDFOREACH()
ELSE()
# On Unix, most of the files end up in the bin directory
SET(BIN_SCRIPTS
msql2mysql
mysql_config
mysql_fix_extensions
mysql_setpermission
mysql_secure_installation
mysql_zap
mysqlaccess
mysqlbug
mysql_convert_table_format
mysql_find_rows
mysqlhotcopy
mysqldumpslow
mysqld_multi
mysqlaccess
mysqlaccess.conf
mysql_install_db
)
FOREACH(file ${BIN_SCRIPTS})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
${CMAKE_CURRENT_BINARY_DIR}/${file} COPYONLY)
ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
FILE(INSTALL DESTINATION
"${CMAKE_INSTALL_PREFIX}/bin" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES
"${CMAKE_CURRENT_BINARY_DIR}/${file}")
ENDFOREACH()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqld_safe.sh
${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe @ONLY)
FILE(INSTALL DESTINATION
"${CMAKE_INSTALL_PREFIX}/bin" TYPE FILE
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE FILES
"${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe"
)
# For some reason, mysqld_safe needs to be also in scripts directory
FILE(INSTALL DESTINATION
"${CMAKE_INSTALL_PREFIX}/scripts" TYPE FILE
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE FILES
"${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db")
ENDIF()
# Install libgcc as mylibgcc.a
IF(CMAKE_COMPILER_IS_GNUCXX)
EXECUTE_PROCESS (
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}
${CMAKE_CXX_FLAGS} --print-libgcc
OUTPUT_VARIABLE LIBGCC_LOCATION
RESULT_VARIABLE RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
IF(${RESULT} EQUAL 0 AND EXISTS ${LIBGCC_LOCATION})
FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
TYPE FILE OPTIONAL FILES "${LIBGCC_LOCATION}")
ENDIF()
ENDIF()
|