/[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.1 Revision 1.13
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2012 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.1 2011/07/13 07:07:15 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-cmake.eclass,v 1.13 2013/01/20 02:37:51 robbat2 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>
13# The mysql-cmake.eclass provides the support to build the mysql 13# The mysql-cmake.eclass provides the support to build the mysql
14# ebuilds using the cmake build system. This eclass provides 14# ebuilds using the cmake build system. This eclass provides
15# the src_unpack, src_prepare, src_configure, src_compile, scr_install, 15# the src_unpack, src_prepare, src_configure, src_compile, scr_install,
16# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. 16# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks.
17 17
18inherit cmake-utils 18inherit cmake-utils flag-o-matic multilib prefix
19 19
20# 20#
21# HELPER FUNCTIONS: 21# HELPER FUNCTIONS:
22# 22#
23 23
24# @FUNCTION: mysql_cmake_disable_test 24# @FUNCTION: mysql_cmake_disable_test
25# @DESCRIPTION: 25# @DESCRIPTION:
26# Helper function to disable specific tests. 26# Helper function to disable specific tests.
27mysql-cmake_disable_test() { 27mysql-cmake_disable_test() {
28 28
29 local rawtestname testname testsuite reason mysql_disable_file 29 local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir
30 rawtestname="${1}" ; shift 30 rawtestname="${1}" ; shift
31 reason="${@}" 31 reason="${@}"
32 ewarn "test '${rawtestname}' disabled: '${reason}'" 32 ewarn "test '${rawtestname}' disabled: '${reason}'"
33 33
34 testsuite="${rawtestname/.*}" 34 testsuite="${rawtestname/.*}"
35 testname="${rawtestname/*.}" 35 testname="${rawtestname/*.}"
36 for mysql_disabled_file in \
37 ${S}/mysql-test/disabled.def \
38 ${S}/mysql-test/t/disabled.def ; do
39 [ -f "${mysql_disabled_file}" ] && break
40 done
36 mysql_disable_file="${S}/mysql-test/t/disabled.def" 41 #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
37 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" 42 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
38 echo ${testname} : ${reason} >> "${mysql_disable_file}" 43 echo ${testname} : ${reason} >> "${mysql_disabled_file}"
39 44
40 if [ -n "${testsuite}" ]; then 45 if [ -n "${testsuite}" ] && [ "${testsuite}" != "main" ]; then
41 for mysql_disable_file in \ 46 for mysql_disabled_file in \
42 ${S}/mysql-test/suite/${testsuite}/disabled.def \ 47 ${S}/mysql-test/suite/${testsuite}/disabled.def \
43 ${S}/mysql-test/suite/${testsuite}/t/disabled.def \ 48 ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
44 FAILED ; do 49 FAILED ; do
45 [ -f "${mysql_disable_file}" ] && break 50 [ -f "${mysql_disabled_file}" ] && break
46 done 51 done
47 if [ "${mysql_disabled_file}" != "FAILED" ]; then 52 if [ "${mysql_disabled_file}" != "FAILED" ]; then
48 echo "${testname} : ${reason}" >> "${mysql_disable_file}" 53 echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
49 else 54 else
55 for mysql_disabled_dir in \
56 ${S}/mysql-test/suite/${testsuite} \
57 ${S}/mysql-test/suite/${testsuite}/t \
58 FAILED ; do
59 [ -d "${mysql_disabled_dir}" ] && break
60 done
61 if [ "${mysql_disabled_dir}" != "FAILED" ]; then
62 echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
63 else
50 ewarn "Could not find testsuite disabled.def location for ${rawtestname}" 64 ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
65 fi
51 fi 66 fi
52 fi 67 fi
53} 68}
54 69
55# @FUNCTION: configure_cmake_locale 70# @FUNCTION: configure_cmake_locale
92 -DEXTRA_CHARSETS=none 107 -DEXTRA_CHARSETS=none
93 -DINSTALL_SQLBENCHDIR= 108 -DINSTALL_SQLBENCHDIR=
94 -DWITH_SSL=system 109 -DWITH_SSL=system
95 -DWITH_ZLIB=system 110 -DWITH_ZLIB=system
96 -DWITHOUT_LIBWRAP=1 111 -DWITHOUT_LIBWRAP=1
97 -DWITHOUT_READLINE=1 112 -DWITH_READLINE=0
113 -DWITH_LIBEDIT=0
98 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 114 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
99 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 115 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
100 -DWITHOUT_CSV_STORAGE_ENGINE=1 116 -DWITHOUT_CSV_STORAGE_ENGINE=1
101 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 117 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
102 -DWITHOUT_HEAP_STORAGE_ENGINE=1 118 -DWITHOUT_HEAP_STORAGE_ENGINE=1
115 131
116 mycmakeargs+=( 132 mycmakeargs+=(
117 -DENABLED_LOCAL_INFILE=1 133 -DENABLED_LOCAL_INFILE=1
118 -DEXTRA_CHARSETS=all 134 -DEXTRA_CHARSETS=all
119 -DMYSQL_USER=mysql 135 -DMYSQL_USER=mysql
120 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock 136 -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
121 -DWITHOUT_READLINE=1 137 -DWITH_READLINE=0
138 -DWITH_LIBEDIT=0
122 -DWITH_ZLIB=system 139 -DWITH_ZLIB=system
123 -DWITHOUT_LIBWRAP=1 140 -DWITHOUT_LIBWRAP=1
124 ) 141 )
125 142
126 if use static ; then
127 mycmakeargs+=( -DDISABLE_SHARED=1 )
128 else
129 mycmakeargs+=( -DDISABLED_SHARED=0 )
130 fi
131
132 mycmakeargs+=( 143 mycmakeargs+=(
144 $(cmake-utils_use_disable !static SHARED)
133 $(cmake-utils_use_with debug) 145 $(cmake-utils_use_with debug)
134 $(cmake-utils_use_with embedded EMBEDDED_SERVER) 146 $(cmake-utils_use_with embedded EMBEDDED_SERVER)
135 $(cmake-utils_use_with profiling) 147 $(cmake-utils_use_with profiling)
148 $(cmake-utils_use_enable systemtap DTRACE)
136 ) 149 )
137 150
138 if use ssl; then 151 if use ssl; then
139 mycmakeargs+=( -DWITH_SSL=system ) 152 mycmakeargs+=( -DWITH_SSL=system )
140 else 153 else
141 mycmakeargs+=( -DWITH_SSL=0 ) 154 mycmakeargs+=( -DWITH_SSL=0 )
155 fi
156
157 if mysql_version_is_at_least "5.5" && use jemalloc; then
158 mycmakeargs+=( -DCMAKE_EXE_LINKER_FLAGS='-ljemalloc' -DWITH_SAFEMALLOC=OFF )
159 fi
160
161 if mysql_version_is_at_least "5.5" && use tcmalloc; then
162 mycmakeargs+=( -DCMAKE_EXE_LINKER_FLAGS='-ltcmalloc' -DWITH_SAFEMALLOC=OFF )
142 fi 163 fi
143 164
144 # Storage engines 165 # Storage engines
145 mycmakeargs+=( 166 mycmakeargs+=(
146 -DWITH_ARCHIVE_STORAGE_ENGINE=1 167 -DWITH_ARCHIVE_STORAGE_ENGINE=1
151 -DWITH_MYISAMMRG_STORAGE_ENGINE=1 172 -DWITH_MYISAMMRG_STORAGE_ENGINE=1
152 -DWITH_MYISAM_STORAGE_ENGINE=1 173 -DWITH_MYISAM_STORAGE_ENGINE=1
153 -DWITH_PARTITION_STORAGE_ENGINE=1 174 -DWITH_PARTITION_STORAGE_ENGINE=1
154 $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE) 175 $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE)
155 ) 176 )
177
178 if pbxt_available ; then
179 mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) )
180 fi
181
182 if [ "${PN}" == "mariadb" ]; then
183 mycmakeargs+=(
184 $(cmake-utils_use_with oqgraph OQGRAPH_STORAGE_ENGINE)
185 $(cmake-utils_use_with sphinx SPHINX_STORAGE_ENGINE)
186 $(cmake-utils_use_with extraengine FEDERATEDX_STORAGE_ENGINE)
187 )
188 fi
156} 189}
157 190
158# 191#
159# EBUILD FUNCTIONS 192# EBUILD FUNCTIONS
160# 193#
190# Configure mysql to build the code for Gentoo respecting the use flags. 223# Configure mysql to build the code for Gentoo respecting the use flags.
191mysql-cmake_src_configure() { 224mysql-cmake_src_configure() {
192 225
193 debug-print-function ${FUNCNAME} "$@" 226 debug-print-function ${FUNCNAME} "$@"
194 227
228 CMAKE_BUILD_TYPE="RelWithDebInfo"
229
195 mycmakeargs=( 230 mycmakeargs=(
196 -DCMAKE_INSTALL_PREFIX=/usr 231 -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
197 -DMYSQL_DATADIR=/var/lib/mysql 232 -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
198 -DSYSCONFDIR=/etc/mysql 233 -DSYSCONFDIR=${EPREFIX}/etc/mysql
199 -DINSTALL_BINDIR=bin 234 -DINSTALL_BINDIR=bin
200 -DINSTALL_DOCDIR=share/doc/${P} 235 -DINSTALL_DOCDIR=share/doc/${P}
201 -DINSTALL_DOCREADMEDIR=share/doc/${P} 236 -DINSTALL_DOCREADMEDIR=share/doc/${P}
202 -DINSTALL_INCLUDEDIR=include/mysql 237 -DINSTALL_INCLUDEDIR=include/mysql
203 -DINSTALL_INFODIR=share/info 238 -DINSTALL_INFODIR=share/info
204 -DINSTALL_LIBDIR=$(get_libdir)/mysql 239 -DINSTALL_LIBDIR=$(get_libdir)/mysql
205 -DINSTALL_MANDIR=share/man 240 -DINSTALL_MANDIR=share/man
206 -DINSTALL_MYSQLDATADIR=/var/lib/mysql 241 -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql
207 -DINSTALL_MYSQLSHAREDIR=share/mysql 242 -DINSTALL_MYSQLSHAREDIR=share/mysql
208 -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test 243 -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test
209 -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin 244 -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
210 -DINSTALL_SBINDIR=sbin 245 -DINSTALL_SBINDIR=sbin
211 -DINSTALL_SCRIPTDIR=share/mysql/scripts 246 -DINSTALL_SCRIPTDIR=share/mysql/scripts
212 -DINSTALL_SQLBENCHDIR=share/mysql 247 -DINSTALL_SQLBENCHDIR=share/mysql
213 -DINSTALL_SUPPORTFILESDIR=/usr/share/mysql 248 -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql
214 -DWITH_COMMENT="Gentoo Linux ${PF}" 249 -DWITH_COMMENT="Gentoo Linux ${PF}"
215 -DWITHOUT_UNIT_TESTS=1 250 -DWITHOUT_UNIT_TESTS=1
216 ) 251 )
252
253 # Bug 412851
254 # MariaDB requires this flag to compile with GPLv3 readline linked
255 # Adds a warning about redistribution to configure
256 if [[ "${PN}" == "mariadb" ]] ; then
257 mycmakeargs+=( -DNOT_FOR_DISTRIBUTION=1 )
258 fi
217 259
218 configure_cmake_locale 260 configure_cmake_locale
219 261
220 if use minimal ; then 262 if use minimal ; then
221 configure_cmake_minimal 263 configure_cmake_minimal
264 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" 306 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
265 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 307 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
266 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" 308 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
267 309
268 # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir 310 # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
269 rm -Rf "${D}/usr/data" 311 rm -Rf "${ED}/usr/data"
270 312
271 # Various junk (my-*.cnf moved elsewhere) 313 # Various junk (my-*.cnf moved elsewhere)
272 einfo "Removing duplicate /usr/share/mysql files" 314 einfo "Removing duplicate /usr/share/mysql files"
273 315
274 # Clean up stuff for a minimal build 316 # Clean up stuff for a minimal build
275# if use minimal ; then 317# if use minimal ; then
276# einfo "Remove all extra content for minimal build" 318# einfo "Remove all extra content for minimal build"
277# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} 319# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench}
278# rm -f "${D}"/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} 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}
279# rm -f "${D}/usr/sbin/mysqld" 321# rm -f "${ED}/usr/sbin/mysqld"
280# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a 322# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
281# fi 323# fi
282 324
283 # Unless they explicitly specific USE=test, then do not install the 325 # Unless they explicitly specific USE=test, then do not install the
284 # testsuite. It DOES have a use to be installed, esp. when you want to do a 326 # testsuite. It DOES have a use to be installed, esp. when you want to do a
287 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test 329 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
288 fi 330 fi
289 331
290 # Configuration stuff 332 # Configuration stuff
291 case ${MYSQL_PV_MAJOR} in 333 case ${MYSQL_PV_MAJOR} in
334 5.[1-4]*) mysql_mycnf_version="5.1" ;;
292 5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;; 335 5.[5-9]|6*|7*) mysql_mycnf_version="5.5" ;;
293 esac 336 esac
294 einfo "Building default my.cnf (${mysql_mycnf_version})" 337 einfo "Building default my.cnf (${mysql_mycnf_version})"
295 insinto "${MY_SYSCONFDIR}" 338 insinto "${MY_SYSCONFDIR#${EPREFIX}}"
296 doins scripts/mysqlaccess.conf 339 doins scripts/mysqlaccess.conf
297 mycnf_src="my.cnf-${mysql_mycnf_version}" 340 mycnf_src="my.cnf-${mysql_mycnf_version}"
298 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ 341 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
299 "${FILESDIR}/${mycnf_src}" \ 342 "${FILESDIR}/${mycnf_src}" \
300 > "${TMPDIR}/my.cnf.ok" 343 > "${TMPDIR}/my.cnf.ok"
301 if use latin1 ; then 344 if use latin1 ; then
302 sed -i \ 345 sed -i \
303 -e "/character-set/s|utf8|latin1|g" \ 346 -e "/character-set/s|utf8|latin1|g" \
304 "${TMPDIR}/my.cnf.ok" 347 "${TMPDIR}/my.cnf.ok"
305 fi 348 fi
349 eprefixify "${TMPDIR}/my.cnf.ok"
306 newins "${TMPDIR}/my.cnf.ok" my.cnf 350 newins "${TMPDIR}/my.cnf.ok" my.cnf
307 351
308 # Minimal builds don't have the MySQL server 352 # Minimal builds don't have the MySQL server
309 if ! use minimal ; then 353 if ! use minimal ; then
310 einfo "Creating initial directories" 354 einfo "Creating initial directories"
311 # Empty directories ... 355 # Empty directories ...
312 diropts "-m0750" 356 diropts "-m0750"
313 if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then 357 if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
314 dodir "${MY_DATADIR}" 358 dodir "${MY_DATADIR#${EPREFIX}}"
315 keepdir "${MY_DATADIR}" 359 keepdir "${MY_DATADIR#${EPREFIX}}"
316 chown -R mysql:mysql "${D}/${MY_DATADIR}" 360 chown -R mysql:mysql "${D}/${MY_DATADIR}"
317 fi 361 fi
318 362
319 diropts "-m0755" 363 diropts "-m0755"
320 for folder in "${MY_LOGDIR}" "/var/run/mysqld" ; do 364 for folder in "${MY_LOGDIR#${EPREFIX}}" "/var/run/mysqld" ; do
321 dodir "${folder}" 365 dodir "${folder}"
322 keepdir "${folder}" 366 keepdir "${folder}"
323 chown -R mysql:mysql "${D}/${folder}" 367 chown -R mysql:mysql "${ED}/${folder}"
324 done 368 done
325 fi 369 fi
326 370
327 # Minimal builds don't have the MySQL server 371 # Minimal builds don't have the MySQL server
328 if ! use minimal ; then 372 if ! use minimal ; then
341 [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" 385 [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}"
342 done 386 done
343 387
344 fi 388 fi
345 389
346 mysql_lib_symlinks "${D}" 390 mysql_lib_symlinks "${ED}"
347} 391}

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

  ViewVC Help
Powered by ViewVC 1.1.20