/[gentoo-x86]/eclass/mysql-cmake.eclass
Gentoo

Diff of /eclass/mysql-cmake.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.13 Revision 1.28
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2015 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-cmake.eclass,v 1.13 2013/01/20 02:37:51 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-cmake.eclass,v 1.28 2015/07/28 01:58:13 grknight Exp $
4 4
5# @ECLASS: mysql-cmake.eclass 5# @ECLASS: mysql-cmake.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Maintainers: 7# Maintainers:
8# - MySQL Team <mysql-bugs@gentoo.org> 8# - MySQL Team <mysql-bugs@gentoo.org>
9# - Robin H. Johnson <robbat2@gentoo.org> 9# - Robin H. Johnson <robbat2@gentoo.org>
10# - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> 10# - Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
11# - Brian Evans <grknight@gentoo.org>
11# @BLURB: This eclass provides the support for cmake based mysql releases 12# @BLURB: This eclass provides the support for cmake based mysql releases
12# @DESCRIPTION: 13# @DESCRIPTION:
13# The mysql-cmake.eclass provides the support to build the mysql 14# The mysql-cmake.eclass provides the support to build the mysql
14# ebuilds using the cmake build system. This eclass provides 15# ebuilds using the cmake build system. This eclass provides
15# the src_unpack, src_prepare, src_configure, src_compile, scr_install, 16# the src_prepare, src_configure, src_compile, and src_install
16# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. 17# phase hooks.
17 18
18inherit cmake-utils flag-o-matic multilib prefix 19inherit cmake-utils flag-o-matic multilib prefix eutils
19 20
20# 21#
21# HELPER FUNCTIONS: 22# HELPER FUNCTIONS:
22# 23#
23 24
32 ewarn "test '${rawtestname}' disabled: '${reason}'" 33 ewarn "test '${rawtestname}' disabled: '${reason}'"
33 34
34 testsuite="${rawtestname/.*}" 35 testsuite="${rawtestname/.*}"
35 testname="${rawtestname/*.}" 36 testname="${rawtestname/*.}"
36 for mysql_disabled_file in \ 37 for mysql_disabled_file in \
37 ${S}/mysql-test/disabled.def \ 38 ${S}/mysql-test/disabled.def \
38 ${S}/mysql-test/t/disabled.def ; do 39 ${S}/mysql-test/t/disabled.def ; do
39 [ -f "${mysql_disabled_file}" ] && break 40 [[ -f ${mysql_disabled_file} ]] && break
40 done 41 done
41 #mysql_disabled_file="${S}/mysql-test/t/disabled.def" 42 #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
42 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" 43 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
43 echo ${testname} : ${reason} >> "${mysql_disabled_file}" 44 echo ${testname} : ${reason} >> "${mysql_disabled_file}"
44 45
45 if [ -n "${testsuite}" ] && [ "${testsuite}" != "main" ]; then 46 if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then
46 for mysql_disabled_file in \ 47 for mysql_disabled_file in \
47 ${S}/mysql-test/suite/${testsuite}/disabled.def \ 48 ${S}/mysql-test/suite/${testsuite}/disabled.def \
48 ${S}/mysql-test/suite/${testsuite}/t/disabled.def \ 49 ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
49 FAILED ; do 50 FAILED ; do
50 [ -f "${mysql_disabled_file}" ] && break 51 [[ -f ${mysql_disabled_file} ]] && break
51 done 52 done
52 if [ "${mysql_disabled_file}" != "FAILED" ]; then 53 if [[ ${mysql_disabled_file} != "FAILED" ]]; then
53 echo "${testname} : ${reason}" >> "${mysql_disabled_file}" 54 echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
54 else 55 else
55 for mysql_disabled_dir in \ 56 for mysql_disabled_dir in \
56 ${S}/mysql-test/suite/${testsuite} \ 57 ${S}/mysql-test/suite/${testsuite} \
57 ${S}/mysql-test/suite/${testsuite}/t \ 58 ${S}/mysql-test/suite/${testsuite}/t \
58 FAILED ; do 59 FAILED ; do
59 [ -d "${mysql_disabled_dir}" ] && break 60 [[ -d ${mysql_disabled_dir} ]] && break
60 done 61 done
61 if [ "${mysql_disabled_dir}" != "FAILED" ]; then 62 if [[ ${mysql_disabled_dir} != "FAILED" ]]; then
62 echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def" 63 echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
63 else 64 else
64 ewarn "Could not find testsuite disabled.def location for ${rawtestname}" 65 ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
65 fi 66 fi
66 fi 67 fi
67 fi 68 fi
68} 69}
69 70
71# @FUNCTION: mysql-cmake_use_plugin
72# @DESCRIPTION:
73# Helper function to enable/disable plugins by use flags
74# cmake-utils_use_with is not enough as some references check WITH_ (0|1)
75# and some check WITHOUT_. Also, this can easily extend to non-storage plugins.
76mysql-cmake_use_plugin() {
77 [[ -z $2 ]] && die "mysql-cmake_use_plugin <USE flag> <flag name>"
78 if use_if_iuse $1 ; then
79 echo "-DWITH_$2=1 -DPLUGIN_$2=YES"
80 else
81 echo "-DWITHOUT_$2=1 -DWITH_$2=0 -DPLUGIN_$2=NO"
82 fi
83}
84
70# @FUNCTION: configure_cmake_locale 85# @FUNCTION: configure_cmake_locale
71# @DESCRIPTION: 86# @DESCRIPTION:
72# Helper function to configure locale cmake options 87# Helper function to configure locale cmake options
73configure_cmake_locale() { 88configure_cmake_locale() {
74 89
90 if use_if_iuse minimal ; then
91 :
92 elif ! in_iuse server || use_if_iuse server ; then
75 if ! use minimal && [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then 93 if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
76 ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" 94 ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
77 ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." 95 ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
78 ewarn "You MUST file bugs without these variables set." 96 ewarn "You MUST file bugs without these variables set."
79 97
80 mycmakeargs+=( 98 mycmakeargs+=(
81 -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} 99 -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
82 -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} 100 -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
83 ) 101 )
84 102
85 elif ! use latin1 ; then 103 elif ! use latin1 ; then
86 mycmakeargs+=( 104 mycmakeargs+=(
87 -DDEFAULT_CHARSET=utf8 105 -DDEFAULT_CHARSET=utf8
88 -DDEFAULT_COLLATION=utf8_general_ci 106 -DDEFAULT_COLLATION=utf8_general_ci
89 ) 107 )
90 else 108 else
91 mycmakeargs+=( 109 mycmakeargs+=(
92 -DDEFAULT_CHARSET=latin1 110 -DDEFAULT_CHARSET=latin1
93 -DDEFAULT_COLLATION=latin1_swedish_ci 111 -DDEFAULT_COLLATION=latin1_swedish_ci
94 ) 112 )
113 fi
95 fi 114 fi
96} 115}
97 116
98# @FUNCTION: configure_cmake_minimal 117# @FUNCTION: configure_cmake_minimal
99# @DESCRIPTION: 118# @DESCRIPTION:
101configure_cmake_minimal() { 120configure_cmake_minimal() {
102 121
103 mycmakeargs+=( 122 mycmakeargs+=(
104 -DWITHOUT_SERVER=1 123 -DWITHOUT_SERVER=1
105 -DWITHOUT_EMBEDDED_SERVER=1 124 -DWITHOUT_EMBEDDED_SERVER=1
106 -DENABLED_LOCAL_INFILE=1
107 -DEXTRA_CHARSETS=none 125 -DEXTRA_CHARSETS=none
108 -DINSTALL_SQLBENCHDIR= 126 -DINSTALL_SQLBENCHDIR=
109 -DWITH_SSL=system
110 -DWITH_ZLIB=system
111 -DWITHOUT_LIBWRAP=1
112 -DWITH_READLINE=0
113 -DWITH_LIBEDIT=0
114 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 127 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
115 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 128 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
116 -DWITHOUT_CSV_STORAGE_ENGINE=1 129 -DWITHOUT_CSV_STORAGE_ENGINE=1
117 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 130 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
118 -DWITHOUT_HEAP_STORAGE_ENGINE=1 131 -DWITHOUT_HEAP_STORAGE_ENGINE=1
119 -DWITHOUT_INNOBASE_STORAGE_ENGINE=1 132 -DWITHOUT_INNOBASE_STORAGE_ENGINE=1
120 -DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1 133 -DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1
121 -DWITHOUT_MYISAM_STORAGE_ENGINE=1 134 -DWITHOUT_MYISAM_STORAGE_ENGINE=1
122 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 135 -DWITHOUT_PARTITION_STORAGE_ENGINE=1
123 -DWITHOUT_INNOBASE_STORAGE_ENGINE=1 136 -DPLUGIN_ARCHIVE=NO
137 -DPLUGIN_BLACKHOLE=NO
138 -DPLUGIN_CSV=NO
139 -DPLUGIN_FEDERATED=NO
140 -DPLUGIN_HEAP=NO
141 -DPLUGIN_INNOBASE=NO
142 -DPLUGIN_MYISAMMRG=NO
143 -DPLUGIN_MYISAM=NO
144 -DPLUGIN_PARTITION=NO
124 ) 145 )
125} 146}
126 147
127# @FUNCTION: configure_cmake_standard 148# @FUNCTION: configure_cmake_standard
128# @DESCRIPTION: 149# @DESCRIPTION:
129# Helper function to configure standard build 150# Helper function to configure standard build
130configure_cmake_standard() { 151configure_cmake_standard() {
131 152
132 mycmakeargs+=( 153 mycmakeargs+=(
133 -DENABLED_LOCAL_INFILE=1
134 -DEXTRA_CHARSETS=all 154 -DEXTRA_CHARSETS=all
135 -DMYSQL_USER=mysql 155 -DMYSQL_USER=mysql
136 -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock 156 -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
137 -DWITH_READLINE=0
138 -DWITH_LIBEDIT=0
139 -DWITH_ZLIB=system
140 -DWITHOUT_LIBWRAP=1
141 )
142
143 mycmakeargs+=(
144 $(cmake-utils_use_disable !static SHARED) 157 $(cmake-utils_use_disable !static SHARED)
145 $(cmake-utils_use_with debug) 158 $(cmake-utils_use_with debug)
146 $(cmake-utils_use_with embedded EMBEDDED_SERVER) 159 $(cmake-utils_use_with embedded EMBEDDED_SERVER)
147 $(cmake-utils_use_with profiling) 160 $(cmake-utils_use_with profiling)
148 $(cmake-utils_use_enable systemtap DTRACE) 161 $(cmake-utils_use_enable systemtap DTRACE)
149 ) 162 )
150 163
151 if use ssl; then 164 if use static; then
152 mycmakeargs+=( -DWITH_SSL=system )
153 else
154 mycmakeargs+=( -DWITH_SSL=0 ) 165 mycmakeargs+=( -DWITH_PIC=1 )
155 fi 166 fi
156 167
157 if mysql_version_is_at_least "5.5" && use jemalloc; then 168 if use jemalloc; then
158 mycmakeargs+=( -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF ) 169 mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
159 fi 170 fi
160 171
161 if mysql_version_is_at_least "5.5" && use tcmalloc; then 172 if use tcmalloc; then
162 mycmakeargs+=( -DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF ) 173 mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
163 fi 174 fi
164 175
165 # Storage engines 176 # Storage engines
166 mycmakeargs+=( 177 mycmakeargs+=(
167 -DWITH_ARCHIVE_STORAGE_ENGINE=1 178 -DWITH_ARCHIVE_STORAGE_ENGINE=1
170 -DWITH_HEAP_STORAGE_ENGINE=1 181 -DWITH_HEAP_STORAGE_ENGINE=1
171 -DWITH_INNOBASE_STORAGE_ENGINE=1 182 -DWITH_INNOBASE_STORAGE_ENGINE=1
172 -DWITH_MYISAMMRG_STORAGE_ENGINE=1 183 -DWITH_MYISAMMRG_STORAGE_ENGINE=1
173 -DWITH_MYISAM_STORAGE_ENGINE=1 184 -DWITH_MYISAM_STORAGE_ENGINE=1
174 -DWITH_PARTITION_STORAGE_ENGINE=1 185 -DWITH_PARTITION_STORAGE_ENGINE=1
175 $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE)
176 ) 186 )
177 187
178 if pbxt_available ; then 188 if in_iuse pbxt ; then
179 mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) ) 189 mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) )
180 fi 190 fi
181 191
182 if [ "${PN}" == "mariadb" ]; then 192 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
193
194 # Federated{,X} must be treated special otherwise they will not be built as plugins
195 if ! use extraengine ; then
196 mycmakeargs+=(
197 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
198 -DPLUGIN_FEDERATED=0
199 -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1
200 -DPLUGIN_FEDERATEDX=0 )
201 fi
202
183 mycmakeargs+=( 203 mycmakeargs+=(
184 $(cmake-utils_use_with oqgraph OQGRAPH_STORAGE_ENGINE) 204 $(mysql-cmake_use_plugin oqgraph OQGRAPH)
185 $(cmake-utils_use_with sphinx SPHINX_STORAGE_ENGINE) 205 $(mysql-cmake_use_plugin sphinx SPHINX)
206 $(mysql-cmake_use_plugin tokudb TOKUDB)
207 $(mysql-cmake_use_plugin pam AUTH_PAM)
208 )
209
210 if mysql_version_is_at_least 10.0.5 ; then
211 # CassandraSE needs Apache Thrift which is not in portage
212 mycmakeargs+=(
213 -DWITHOUT_CASSANDRA=1 -DWITH_CASSANDRA=0
214 -DPLUGIN_CASSANDRA=NO
215 $(mysql-cmake_use_plugin extraengine SEQUENCE)
216 $(mysql-cmake_use_plugin extraengine SPIDER)
217 $(mysql-cmake_use_plugin extraengine CONNECT)
218 -DCONNECT_WITH_MYSQL=1
219 $(cmake-utils_use xml CONNECT_WITH_LIBXML2)
220 $(cmake-utils_use odbc CONNECT_WITH_ODBC)
221 )
222 fi
223
224 if in_iuse mroonga ; then
225 use mroonga || mycmakeargs+=( -DWITHOUT_MROONGA=1 )
226 else
227 mycmakeargs+=( -DWITHOUT_MROONGA=1 )
228 fi
229
230 if in_iuse galera ; then
231 mycmakeargs+=( $(cmake-utils_use_with galera WSREP) )
232 fi
233
234 if mysql_version_is_at_least "10.1.1" ; then
235 mycmakeargs+=( $(cmake-utils_use_with innodb-lz4 INNODB_LZ4)
236 $(cmake-utils_use_with innodb-lzo INNODB_LZO) )
237 fi
238
239 if mysql_version_is_at_least "10.1.2" ; then
240 mycmakeargs+=( $(mysql-cmake_use_plugin cracklib CRACKLIB_PASSWORD_CHECK ) )
241 fi
242 else
186 $(cmake-utils_use_with extraengine FEDERATEDX_STORAGE_ENGINE) 243 mycmakeargs+=( $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE) )
244 fi
245
246 if [[ ${PN} == "percona-server" ]]; then
247 mycmakeargs+=(
248 $(cmake-utils_use_with pam)
249 )
250 fi
251
252 if [[ ${PN} == "mysql-cluster" ]]; then
253 # TODO: This really should include the following options,
254 # but the memcached package doesn't install the files it seeks.
255 # -DWITH_BUNDLED_MEMCACHED=OFF
256 # -DMEMCACHED_HOME=${EPREFIX}/usr
257 mycmakeargs+=(
258 -DWITH_BUNDLED_LIBEVENT=OFF
259 $(cmake-utils_use_with java NDB_JAVA)
187 ) 260 )
188 fi 261 fi
189} 262}
190 263
191# 264#
199 272
200 debug-print-function ${FUNCNAME} "$@" 273 debug-print-function ${FUNCNAME} "$@"
201 274
202 cd "${S}" 275 cd "${S}"
203 276
277 if [[ ${MY_EXTRAS_VER} != none ]]; then
278
204 # Apply the patches for this MySQL version 279 # Apply the patches for this MySQL version
205 EPATCH_SUFFIX="patch" 280 EPATCH_SUFFIX="patch"
206 mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" 281 mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
207 # Clean out old items 282 # Clean out old items
208 rm -f "${EPATCH_SOURCE}"/* 283 rm -f "${EPATCH_SOURCE}"/*
209 # Now link in right patches 284 # Now link in right patches
210 mysql_mv_patches 285 mysql_mv_patches
211 # And apply 286 # And apply
212 epatch 287 epatch
288 fi
213 289
214 # last -fPIC fixup, per bug #305873 290 # last -fPIC fixup, per bug #305873
215 i="${S}"/storage/innodb_plugin/plug.in 291 i="${S}"/storage/innodb_plugin/plug.in
216 [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" 292 [[ -f ${i} ]] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
217 293
218 rm -f "scripts/mysqlbug" 294 rm -f "scripts/mysqlbug"
295 if use jemalloc && ! ( [[ ${PN} == "mariadb" ]] && mysql_version_is_at_least "5.5.33" ); then
296 echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
297 fi
298
299 if use tcmalloc; then
300 echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
301 fi
302
303 if in_iuse tokudb ; then
304 # Don't build bundled xz-utils
305 rm -f "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake"
306 touch "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake"
307 sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
308 fi
309
310 # Remove the bundled groonga if it exists
311 # There is no CMake flag, it simply checks for existance
312 if [[ -d "${S}"/storage/mroonga/vendor/groonga ]] ; then
313 rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
314 fi
315
316 epatch_user
219} 317}
220 318
221# @FUNCTION: mysql-cmake_src_configure 319# @FUNCTION: mysql-cmake_src_configure
222# @DESCRIPTION: 320# @DESCRIPTION:
223# Configure mysql to build the code for Gentoo respecting the use flags. 321# Configure mysql to build the code for Gentoo respecting the use flags.
225 323
226 debug-print-function ${FUNCNAME} "$@" 324 debug-print-function ${FUNCNAME} "$@"
227 325
228 CMAKE_BUILD_TYPE="RelWithDebInfo" 326 CMAKE_BUILD_TYPE="RelWithDebInfo"
229 327
328 # debug hack wrt #497532
230 mycmakeargs=( 329 mycmakeargs=(
330 -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
331 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
231 -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr 332 -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
232 -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql 333 -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
233 -DSYSCONFDIR=${EPREFIX}/etc/mysql 334 -DSYSCONFDIR=${EPREFIX}/etc/mysql
234 -DINSTALL_BINDIR=bin 335 -DINSTALL_BINDIR=bin
235 -DINSTALL_DOCDIR=share/doc/${P} 336 -DINSTALL_DOCDIR=share/doc/${P}
236 -DINSTALL_DOCREADMEDIR=share/doc/${P} 337 -DINSTALL_DOCREADMEDIR=share/doc/${P}
237 -DINSTALL_INCLUDEDIR=include/mysql 338 -DINSTALL_INCLUDEDIR=include/mysql
238 -DINSTALL_INFODIR=share/info 339 -DINSTALL_INFODIR=share/info
340 -DINSTALL_LIBDIR=$(get_libdir)
239 -DINSTALL_LIBDIR=$(get_libdir)/mysql 341 -DINSTALL_ELIBDIR=$(get_libdir)/mysql
240 -DINSTALL_MANDIR=share/man 342 -DINSTALL_MANDIR=share/man
241 -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql 343 -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql
242 -DINSTALL_MYSQLSHAREDIR=share/mysql 344 -DINSTALL_MYSQLSHAREDIR=share/mysql
243 -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test 345 -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test
244 -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin 346 -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
245 -DINSTALL_SBINDIR=sbin 347 -DINSTALL_SBINDIR=sbin
246 -DINSTALL_SCRIPTDIR=share/mysql/scripts 348 -DINSTALL_SCRIPTDIR=share/mysql/scripts
247 -DINSTALL_SQLBENCHDIR=share/mysql 349 -DINSTALL_SQLBENCHDIR=share/mysql
248 -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql 350 -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql
249 -DWITH_COMMENT="Gentoo Linux ${PF}" 351 -DWITH_COMMENT="Gentoo Linux ${PF}"
250 -DWITHOUT_UNIT_TESTS=1 352 $(cmake-utils_use_with test UNIT_TESTS)
353 -DWITH_LIBEDIT=0
354 -DWITH_ZLIB=system
355 -DWITHOUT_LIBWRAP=1
356 -DENABLED_LOCAL_INFILE=1
357 $(cmake-utils_use_enable static-libs STATIC_LIBS)
358 -DWITH_SSL=$(usex ssl system bundled)
359 -DWITH_DEFAULT_COMPILER_OPTIONS=0
360 -DWITH_DEFAULT_FEATURE_SET=0
251 ) 361 )
252 362
253 # Bug 412851 363 if in_iuse bindist ; then
254 # MariaDB requires this flag to compile with GPLv3 readline linked 364 mycmakeargs+=(
255 # Adds a warning about redistribution to configure 365 -DWITH_READLINE=$(usex bindist 1 0)
256 if [[ "${PN}" == "mariadb" ]] ; then 366 -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
257 mycmakeargs+=( -DNOT_FOR_DISTRIBUTION=1 ) 367 $(usex bindist -DHAVE_BFD_H=0 '')
368 )
369 fi
370
371 mycmakeargs+=( -DWITH_EDITLINE=system )
372
373 if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
374 mycmakeargs+=(
375 -DWITH_JEMALLOC=$(usex jemalloc system)
376 )
377 mysql_version_is_at_least "10.0.9" && mycmakeargs+=( -DWITH_PCRE=system )
258 fi 378 fi
259 379
260 configure_cmake_locale 380 configure_cmake_locale
261 381
262 if use minimal ; then 382 if use_if_iuse minimal ; then
263 configure_cmake_minimal 383 configure_cmake_minimal
264 else 384 else
265 configure_cmake_standard 385 configure_cmake_standard
266 fi 386 fi
267 387
268 # Bug #114895, bug #110149 388 # Bug #114895, bug #110149
269 filter-flags "-O" "-O[01]" 389 filter-flags "-O" "-O[01]"
270 390
271 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" 391 CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
272 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" 392 CXXFLAGS="${CXXFLAGS} -felide-constructors"
393 # Causes linkage failures. Upstream bug #59607 removes it
394 if ! mysql_version_is_at_least "5.6" ; then
273 CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" 395 CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
396 fi
397 # As of 5.7, exceptions and rtti are used!
398 if ! mysql_version_is_at_least "5.7" ; then
399 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
400 fi
274 export CXXFLAGS 401 export CXXFLAGS
275 402
276 # bug #283926, with GCC4.4, this is required to get correct behavior. 403 # bug #283926, with GCC4.4, this is required to get correct behavior.
277 append-flags -fno-strict-aliasing 404 append-flags -fno-strict-aliasing
278 405
299 # Make sure the vars are correctly initialized 426 # Make sure the vars are correctly initialized
300 mysql_init_vars 427 mysql_init_vars
301 428
302 cmake-utils_src_install 429 cmake-utils_src_install
303 430
431 if ! in_iuse tools || use_if_iuse tools ; then
304 # Convenience links 432 # Convenience links
305 einfo "Making Convenience links for mysqlcheck multi-call binary" 433 einfo "Making Convenience links for mysqlcheck multi-call binary"
306 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" 434 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
307 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 435 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
308 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" 436 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
437 fi
438
439 # Create a mariadb_config symlink
440 [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && dosym "/usr/bin/mysql_config" "/usr/bin/mariadb_config"
309 441
310 # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir 442 # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
311 rm -Rf "${ED}/usr/data" 443 rm -Rf "${ED}/usr/data"
312 444
313 # Various junk (my-*.cnf moved elsewhere) 445 # Various junk (my-*.cnf moved elsewhere)
314 einfo "Removing duplicate /usr/share/mysql files" 446 einfo "Removing duplicate /usr/share/mysql files"
315
316 # Clean up stuff for a minimal build
317# if use minimal ; then
318# einfo "Remove all extra content for minimal build"
319# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench}
320# rm -f "${ED}"/usr/bin/{mysql{_install_db,manager*,_secure_installation,_fix_privilege_tables,hotcopy,_convert_table_format,d_multi,_fix_extensions,_zap,_explain_log,_tableinfo,d_safe,_install,_waitpid,binlog,test},myisam*,isam*,pack_isam}
321# rm -f "${ED}/usr/sbin/mysqld"
322# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
323# fi
324 447
325 # Unless they explicitly specific USE=test, then do not install the 448 # Unless they explicitly specific USE=test, then do not install the
326 # testsuite. It DOES have a use to be installed, esp. when you want to do a 449 # testsuite. It DOES have a use to be installed, esp. when you want to do a
327 # validation of your database configuration after tuning it. 450 # validation of your database configuration after tuning it.
328 if ! use test ; then 451 if ! use test ; then
330 fi 453 fi
331 454
332 # Configuration stuff 455 # Configuration stuff
333 case ${MYSQL_PV_MAJOR} in 456 case ${MYSQL_PV_MAJOR} in
334 5.[1-4]*) mysql_mycnf_version="5.1" ;; 457 5.[1-4]*) mysql_mycnf_version="5.1" ;;
335 5.[5-9]|6*|7*) mysql_mycnf_version="5.5" ;; 458 5.5) mysql_mycnf_version="5.5" ;;
459 5.[6-9]|6*|7*|8*|9*|10*) mysql_mycnf_version="5.6" ;;
336 esac 460 esac
337 einfo "Building default my.cnf (${mysql_mycnf_version})" 461 einfo "Building default my.cnf (${mysql_mycnf_version})"
338 insinto "${MY_SYSCONFDIR#${EPREFIX}}" 462 insinto "${MY_SYSCONFDIR#${EPREFIX}}"
339 doins scripts/mysqlaccess.conf 463 [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
340 mycnf_src="my.cnf-${mysql_mycnf_version}" 464 mycnf_src="my.cnf-${mysql_mycnf_version}"
341 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ 465 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
342 "${FILESDIR}/${mycnf_src}" \ 466 "${FILESDIR}/${mycnf_src}" \
343 > "${TMPDIR}/my.cnf.ok" 467 > "${TMPDIR}/my.cnf.ok" || die
468 use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
344 if use latin1 ; then 469 if use latin1 ; then
345 sed -i \ 470 sed -i \
346 -e "/character-set/s|utf8|latin1|g" \ 471 -e "/character-set/s|utf8|latin1|g" \
347 "${TMPDIR}/my.cnf.ok" 472 "${TMPDIR}/my.cnf.ok" || die
348 fi 473 fi
349 eprefixify "${TMPDIR}/my.cnf.ok" 474 eprefixify "${TMPDIR}/my.cnf.ok"
350 newins "${TMPDIR}/my.cnf.ok" my.cnf 475 newins "${TMPDIR}/my.cnf.ok" my.cnf
351 476
352 # Minimal builds don't have the MySQL server 477 # Minimal builds don't have the MySQL server
353 if ! use minimal ; then 478 if use_if_iuse minimal ; then
479 :
480 elif ! in_iuse server || use_if_iuse server ; then
354 einfo "Creating initial directories" 481 einfo "Creating initial directories"
355 # Empty directories ... 482 # Empty directories ...
356 diropts "-m0750" 483 diropts "-m0750"
357 if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then 484 if [[ ${PREVIOUS_DATADIR} != "yes" ]] ; then
358 dodir "${MY_DATADIR#${EPREFIX}}" 485 dodir "${MY_DATADIR#${EPREFIX}}"
359 keepdir "${MY_DATADIR#${EPREFIX}}" 486 keepdir "${MY_DATADIR#${EPREFIX}}"
360 chown -R mysql:mysql "${D}/${MY_DATADIR}" 487 chown -R mysql:mysql "${D}/${MY_DATADIR}"
361 fi 488 fi
362 489
363 diropts "-m0755" 490 diropts "-m0755"
364 for folder in "${MY_LOGDIR#${EPREFIX}}" "/var/run/mysqld" ; do 491 for folder in "${MY_LOGDIR#${EPREFIX}}" ; do
365 dodir "${folder}" 492 dodir "${folder}"
366 keepdir "${folder}" 493 keepdir "${folder}"
367 chown -R mysql:mysql "${ED}/${folder}" 494 chown -R mysql:mysql "${ED}/${folder}"
368 done 495 done
369 fi 496 fi
370 497
371 # Minimal builds don't have the MySQL server 498 # Minimal builds don't have the MySQL server
372 if ! use minimal ; then 499 if use_if_iuse minimal ; then
500 :
501 elif ! in_iuse server || use_if_iuse server; then
373 einfo "Including support files and sample configurations" 502 einfo "Including support files and sample configurations"
374 docinto "support-files" 503 docinto "support-files"
375 for script in \ 504 for script in \
376 "${S}"/support-files/my-*.cnf.sh \ 505 "${S}"/support-files/my-*.cnf.sh \
377 "${S}"/support-files/magic \ 506 "${S}"/support-files/magic \
378 "${S}"/support-files/ndb-config-2-node.ini.sh 507 "${S}"/support-files/ndb-config-2-node.ini.sh
379 do 508 do
380 [[ -f "$script" ]] && dodoc "${script}" 509 [[ -f $script ]] && dodoc "${script}"
381 done 510 done
382 511
383 docinto "scripts" 512 docinto "scripts"
384 for script in "${S}"/scripts/mysql* ; do 513 for script in "${S}"/scripts/mysql* ; do
385 [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" 514 [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
386 done 515 done
516 fi
387 517
518 #Remove mytop if perl is not selected
519 [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && ! use perl \
520 && rm -f "${ED}/usr/bin/mytop"
521
522 in_iuse client-libs && ! use client-libs && return
523
524 # Percona has decided to rename libmysqlclient to libperconaserverclient
525 # Use a symlink to preserve linkages for those who don't use mysql_config
526 if [[ ${PN} == "percona-server" ]] && mysql_version_is_at_least "5.5.36" ; then
527 dosym libperconaserverclient.so /usr/$(get_libdir)/libmysqlclient.so
528 dosym libperconaserverclient.so /usr/$(get_libdir)/libmysqlclient_r.so
529 if use static-libs ; then
530 dosym libperconaserverclient.a /usr/$(get_libdir)/libmysqlclient.a
531 dosym libperconaserverclient.a /usr/$(get_libdir)/libmysqlclient_r.a
388 fi 532 fi
389 533 fi
390 mysql_lib_symlinks "${ED}"
391} 534}

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20