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

Diff of /eclass/mysql.eclass

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

Revision 1.142 Revision 1.166
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2011 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.eclass,v 1.142 2010/03/24 20:37:54 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.166 2011/09/25 12:43:28 grobian Exp $
4 4
5# @ECLASS: mysql.eclass 5# @ECLASS: mysql.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
8# Maintainers: MySQL Team <mysql-bugs@gentoo.org> 7# MySQL Team <mysql-bugs@gentoo.org>
9# - Luca Longinotti <chtekk@gentoo.org> 8# Luca Longinotti <chtekk@gentoo.org>
10# - Robin H. Johnson <robbat2@gentoo.org> 9# Robin H. Johnson <robbat2@gentoo.org>
10# @AUTHOR:
11# Francesco Riosa (Retired) <vivo@gentoo.org>
11# @BLURB: This eclass provides most of the functions for mysql ebuilds 12# @BLURB: This eclass provides most of the functions for mysql ebuilds
12# @DESCRIPTION: 13# @DESCRIPTION:
13# The mysql.eclass provides almost all the code to build the mysql ebuilds 14# The mysql.eclass provides almost all the code to build the mysql ebuilds
14# including the src_unpack, src_prepare, src_configure, src_compile, 15# including the src_unpack, src_prepare, src_configure, src_compile,
15# scr_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm 16# scr_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
59# Upstream MySQL considers the first two parts of the version number to be the 60# Upstream MySQL considers the first two parts of the version number to be the
60# major version. Upgrades that change major version should always run 61# major version. Upgrades that change major version should always run
61# mysql_upgrade. 62# mysql_upgrade.
62MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" 63MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
63 64
65# Cluster is a special case...
66if [[ "${PN}" == "mysql-cluster" ]]; then
67 case $PV in
68 6.1*|7.0*|7.1*) MYSQL_PV_MAJOR=5.1 ;;
69 esac
70fi
71
72
64# @ECLASS-VARIABLE: MYSQL_VERSION_ID 73# @ECLASS-VARIABLE: MYSQL_VERSION_ID
65# @DESCRIPTION: 74# @DESCRIPTION:
66# MYSQL_VERSION_ID will be: 75# MYSQL_VERSION_ID will be:
67# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] 76# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
68# This is an important part, because many of the choices the MySQL ebuild will do 77# This is an important part, because many of the choices the MySQL ebuild will do
95 MYSQL_COMMUNITY_FEATURES=1 104 MYSQL_COMMUNITY_FEATURES=1
96elif [ "${PV#5.4}" != "${PV}" ] ; then 105elif [ "${PV#5.4}" != "${PV}" ] ; then
97 MYSQL_COMMUNITY_FEATURES=1 106 MYSQL_COMMUNITY_FEATURES=1
98elif [ "${PV#5.5}" != "${PV}" ] ; then 107elif [ "${PV#5.5}" != "${PV}" ] ; then
99 MYSQL_COMMUNITY_FEATURES=1 108 MYSQL_COMMUNITY_FEATURES=1
100elif [ "${PV#6.0}" != "${PV}" ] ; then 109elif [ "${PV#6}" != "${PV}" ] ; then
110 MYSQL_COMMUNITY_FEATURES=1
111elif [ "${PV#7}" != "${PV}" ] ; then
101 MYSQL_COMMUNITY_FEATURES=1 112 MYSQL_COMMUNITY_FEATURES=1
102else 113else
103 MYSQL_COMMUNITY_FEATURES=0 114 MYSQL_COMMUNITY_FEATURES=0
104fi 115fi
105 116
124 135
125[[ "${PN}" == "mariadb" ]] \ 136[[ "${PN}" == "mariadb" ]] \
126&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )" 137&& DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )"
127 138
128# Having different flavours at the same time is not a good idea 139# Having different flavours at the same time is not a good idea
129for i in "mysql" "mysql-community" "mariadb" ; do 140for i in "mysql" "mysql-community" "mysql-cluster" "mariadb" ; do
130 [[ "${i}" == ${PN} ]] || 141 [[ "${i}" == ${PN} ]] ||
131 DEPEND="${DEPEND} !dev-db/${i}" 142 DEPEND="${DEPEND} !dev-db/${i}"
132done 143done
133 144
145# prefix: first need to implement something for #196294
134RDEPEND="${DEPEND} 146RDEPEND="${DEPEND}
135 !minimal? ( dev-db/mysql-init-scripts ) 147 !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )
136 selinux? ( sec-policy/selinux-mysql )" 148 selinux? ( sec-policy/selinux-mysql )"
149
150DEPEND="${DEPEND}
151 virtual/yacc"
152
153if [ "${EAPI:-0}" = "2" ]; then
154 DEPEND="${DEPEND} static? ( || ( sys-libs/ncurses[static-libs] <=sys-libs/ncurses-5.7-r3 ) )"
155fi
137 156
138# compile-time-only 157# compile-time-only
139mysql_version_is_at_least "5.1" \ 158mysql_version_is_at_least "5.1" \
140|| DEPEND="${DEPEND} berkdb? ( sys-apps/ed )" 159|| DEPEND="${DEPEND} berkdb? ( sys-apps/ed )"
141 160
142# compile-time-only 161# compile-time-only
143mysql_version_is_at_least "5.1.12" \ 162mysql_version_is_at_least "5.1.12" \
144&& DEPEND="${DEPEND} >=dev-util/cmake-2.4.3" 163&& DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
164
165[[ "${PN}" == "mariadb" ]] \
166&& mysql_version_is_at_least "5.2" \
167&& DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )"
168#SphinxSE is included but is not available in 5.2.4 due to a missing plug.in file
169# sphinx? ( app-misc/sphinx )"
145 170
146# dev-perl/DBD-mysql is needed by some scripts installed by MySQL 171# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
147PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" 172PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
148 173
149# For other stuff to bring us in 174# For other stuff to bring us in
152# Work out the default SERVER_URI correctly 177# Work out the default SERVER_URI correctly
153if [ -z "${SERVER_URI}" ]; then 178if [ -z "${SERVER_URI}" ]; then
154 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}" 179 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}"
155 if [ "${PN}" == "mariadb" ]; then 180 if [ "${PN}" == "mariadb" ]; then
156 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${PV})" 181 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${PV})"
182 MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
183 SERVER_URI="
184 http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
185 http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
186 http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
157 SERVER_URI="http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/mariadb-${MARIA_FULL_PV}.tar.gz" 187 http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz
188 http://mirrors.fe.up.pt/pub/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
189 http://ftp-stud.hs-esslingen.de/pub/Mirrors/${PN}/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
190 "
158 # The community build is on the mirrors 191 # The community and cluster builds are on the mirrors
159 elif [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then 192 elif [[ "${MYSQL_COMMUNITY_FEATURES}" == "1" || ${PN} == "mysql-cluster" ]] ; then
160 SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${MY_PV}.tar.gz" 193 if [[ "${PN}" == "mysql-cluster" ]] ; then
194 URI_DIR="MySQL-Cluster"
195 URI_FILE="mysql-cluster-gpl"
196 else
197 URI_DIR="MySQL"
198 URI_FILE="mysql"
199 fi
200 URI_A="${URI_FILE}-${MY_PV}.tar.gz"
201 MIRROR_PV=$(get_version_component_range 1-2 ${PV})
202 # Recently upstream switched to an archive site, and not on mirrors
203 SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A}
204 mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}"
161 # The (old) enterprise source is on the primary site only 205 # The (old) enterprise source is on the primary site only
162 elif [ "${PN}" == "mysql" ]; then 206 elif [ "${PN}" == "mysql" ]; then
163 SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz" 207 SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz"
164 fi 208 fi
165fi 209fi
188IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static test" 232IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static test"
189 233
190mysql_version_is_at_least "4.1" \ 234mysql_version_is_at_least "4.1" \
191&& IUSE="${IUSE} latin1" 235&& IUSE="${IUSE} latin1"
192 236
193mysql_version_is_at_least "4.1.3" \ 237if mysql_version_is_at_least "4.1.3" ; then
194&& IUSE="${IUSE} cluster extraengine" 238 IUSE="${IUSE} extraengine"
239 if [[ "${PN}" != "mysql-cluster" ]] ; then
240 IUSE="${IUSE} cluster"
241 fi
242fi
195 243
196mysql_version_is_at_least "5.0" \ 244mysql_version_is_at_least "5.0" \
197|| IUSE="${IUSE} raid" 245|| IUSE="${IUSE} raid"
198 246
199mysql_version_is_at_least "5.0.18" \ 247mysql_version_is_at_least "5.0.18" \
205[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ 253[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
206&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" 254&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
207 255
208[[ "${PN}" == "mariadb" ]] \ 256[[ "${PN}" == "mariadb" ]] \
209&& IUSE="${IUSE} libevent" 257&& IUSE="${IUSE} libevent"
258
259[[ "${PN}" == "mariadb" ]] \
260&& mysql_version_is_at_least "5.2" \
261&& IUSE="${IUSE} oqgraph"
262#SphinxSE is included but is not available in 5.2.4 due to a missing plug.in file
263#&& IUSE="${IUSE} oqgraph sphinx"
210 264
211# MariaDB has integrated PBXT 265# MariaDB has integrated PBXT
212# PBXT_VERSION means that we have a PBXT patch for this PV 266# PBXT_VERSION means that we have a PBXT patch for this PV
213# PBXT was only introduced after 5.1.12 267# PBXT was only introduced after 5.1.12
214pbxt_patch_available() { 268pbxt_patch_available() {
232 && mysql_version_is_at_least "5.1.26" \ 286 && mysql_version_is_at_least "5.1.26" \
233 && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] 287 && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]]
234 return $? 288 return $?
235} 289}
236 290
291
237pbxt_patch_available \ 292pbxt_patch_available \
238&& PBXT_P="pbxt-${PBXT_VERSION}" \ 293&& PBXT_P="pbxt-${PBXT_VERSION}" \
239&& PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ 294&& PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
240&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \ 295&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \
241 296
297# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
298# vs. built outside the dir
242pbxt_available \ 299pbxt_available \
243&& IUSE="${IUSE} pbxt" 300&& IUSE="${IUSE} pbxt" \
301&& mysql_version_is_at_least "5.1.40" \
302&& PBXT_NEWSTYLE=1
244 303
245xtradb_patch_available \ 304xtradb_patch_available \
246&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ 305&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \
247&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ 306&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
248&& XTRADB_SRC_URI1="http://www.percona.com/percona-builds/xtradb/${XTRADB_SRC_URI_COMMON}" \ 307&& XTRADB_SRC_B1="http://www.percona.com/" \
308&& XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" \
309&& XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" \
249&& XTRADB_SRC_URI2="http://www.percona.com/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \ 310&& XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" \
311&& XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \
250&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} )" \ 312&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" \
251&& IUSE="${IUSE} xtradb" 313&& IUSE="${IUSE} xtradb"
252 314
253# 315#
254# HELPER FUNCTIONS: 316# HELPER FUNCTIONS:
255# 317#
260mysql_disable_test() { 322mysql_disable_test() {
261 local rawtestname testname testsuite reason mysql_disable_file 323 local rawtestname testname testsuite reason mysql_disable_file
262 rawtestname="${1}" ; shift 324 rawtestname="${1}" ; shift
263 reason="${@}" 325 reason="${@}"
264 ewarn "test '${rawtestname}' disabled: '${reason}'" 326 ewarn "test '${rawtestname}' disabled: '${reason}'"
265 327
266 testsuite="${rawtestname/.*}" 328 testsuite="${rawtestname/.*}"
267 testname="${rawtestname/*.}" 329 testname="${rawtestname/*.}"
268 mysql_disable_file="${S}/mysql-test/t/disabled.def" 330 mysql_disable_file="${S}/mysql-test/t/disabled.def"
269 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" 331 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
270 echo ${testname} : ${reason} >> "${mysql_disable_file}" 332 echo ${testname} : ${reason} >> "${mysql_disable_file}"
352 MY_DATADIR="${new_MY_DATADIR}" 414 MY_DATADIR="${new_MY_DATADIR}"
353 fi 415 fi
354 fi 416 fi
355 fi 417 fi
356 418
419 if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then
357 MY_SOURCEDIR=${SERVER_URI##*/} 420 MY_SOURCEDIR=${SERVER_URI##*/}
358 MY_SOURCEDIR=${MY_SOURCEDIR%.tar*} 421 MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
422 fi
359 423
360 export MY_SHAREDSTATEDIR MY_SYSCONFDIR 424 export MY_SHAREDSTATEDIR MY_SYSCONFDIR
361 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR 425 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
362 export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR 426 export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR
363} 427}
410 if use debug ; then 474 if use debug ; then
411 myconf="${myconf} --with-debug=full" 475 myconf="${myconf} --with-debug=full"
412 else 476 else
413 myconf="${myconf} --without-debug" 477 myconf="${myconf} --without-debug"
414 mysql_version_is_at_least "4.1.3" \ 478 mysql_version_is_at_least "4.1.3" \
415 && use cluster \ 479 && ( use cluster || [[ "${PN}" == "mysql-cluster" ]] ) \
416 && myconf="${myconf} --without-ndb-debug" 480 && myconf="${myconf} --without-ndb-debug"
417 fi 481 fi
418 482
419 if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then 483 if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then
420 ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" 484 ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
477 myconf="${myconf} --without-berkeley-db" 541 myconf="${myconf} --without-berkeley-db"
478 fi 542 fi
479 543
480 if mysql_version_is_at_least "4.1.3" ; then 544 if mysql_version_is_at_least "4.1.3" ; then
481 myconf="${myconf} --with-geometry" 545 myconf="${myconf} --with-geometry"
546 if [[ "${PN}" != "mysql-cluster" ]] ; then
482 myconf="${myconf} $(use_with cluster ndbcluster)" 547 myconf="${myconf} $(use_with cluster ndbcluster)"
548 fi
483 fi 549 fi
484 550
485 if mysql_version_is_at_least "4.1.3" && use extraengine ; then 551 if mysql_version_is_at_least "4.1.3" && use extraengine ; then
486 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html 552 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html
487 myconf="${myconf} --with-archive-storage-engine" 553 myconf="${myconf} --with-archive-storage-engine"
524 myconf="${myconf} --enable-assembler" 590 myconf="${myconf} --enable-assembler"
525 myconf="${myconf} --with-geometry" 591 myconf="${myconf} --with-geometry"
526 myconf="${myconf} --with-readline" 592 myconf="${myconf} --with-readline"
527 myconf="${myconf} --with-zlib-dir=/usr/" 593 myconf="${myconf} --with-zlib-dir=/usr/"
528 myconf="${myconf} --without-pstack" 594 myconf="${myconf} --without-pstack"
595 myconf="${myconf} --with-plugindir=/usr/$(get_libdir)/mysql/plugin"
596
597 # This is an explict die here, because if we just forcibly disable it, then the
598 # user's data is not accessible.
599 use max-idx-128 && die "Bug #336027: upstream has a corruption issue with max-idx-128 presently"
529 use max-idx-128 && myconf="${myconf} --with-max-indexes=128" 600 #use max-idx-128 && myconf="${myconf} --with-max-indexes=128"
530 if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then 601 if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then
531 myconf="${myconf} $(use_enable community community-features)" 602 myconf="${myconf} $(use_enable community community-features)"
532 if use community; then 603 if use community; then
533 myconf="${myconf} $(use_enable profiling)" 604 myconf="${myconf} $(use_enable profiling)"
534 else 605 else
535 myconf="${myconf} --disable-profiling" 606 myconf="${myconf} --disable-profiling"
536 fi 607 fi
537 fi 608 fi
538 609
610 # Scan for all available plugins
611 local plugins_avail="$(
612 LANG=C \
613 find "${S}" \
614 \( \
615 -name 'plug.in' \
616 -o -iname 'configure.in' \
617 -o -iname 'configure.ac' \
618 \) \
619 -print0 \
620 | xargs -0 sed -r -n \
621 -e '/^MYSQL_STORAGE_ENGINE/{
622 s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ;
623 s~^([^ ]+).*~\1~gp;
624 }' \
625 | tr -s '\n' ' '
626 )"
627
539 # 5.1 introduces a new way to manage storage engines (plugins) 628 # 5.1 introduces a new way to manage storage engines (plugins)
540 # like configuration=none 629 # like configuration=none
541 # This base set are required, and will always be statically built. 630 # This base set are required, and will always be statically built.
542 local plugins="csv,myisam,myisammrg,heap" 631 local plugins_sta="csv myisam myisammrg heap"
632 local plugins_dyn=""
633 local plugins_dis="example ibmdb2i"
634
635 # These aren't actually required by the base set, but are really useful:
636 plugins_sta="${plugins_sta} archive blackhole"
637
638 # default in 5.5.4
639 if mysql_version_is_at_least "5.5.4" ; then
640 plugins_sta="${plugins_sta} partition"
641 fi
642 # Now the extras
543 if use extraengine ; then 643 if use extraengine ; then
544 # like configuration=max-no-ndb, archive and example removed in 5.1.11 644 # like configuration=max-no-ndb, archive and example removed in 5.1.11
545 # not added yet: ibmdb2i 645 # not added yet: ibmdb2i
546 # Not supporting as examples: example,daemon_example,ftexample 646 # Not supporting as examples: example,daemon_example,ftexample
547 plugins="${plugins},archive,blackhole,federated,partition" 647 plugins_sta="${plugins_sta} partition"
548 648
549 if [[ "${PN}" != "mariadb" ]] ; then 649 if [[ "${PN}" != "mariadb" ]] ; then
550 elog "Before using the Federated storage engine, please be sure to read" 650 elog "Before using the Federated storage engine, please be sure to read"
551 elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" 651 elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html"
652 plugins_dyn="${plugins_sta} federated"
552 else 653 else
553 elog "MariaDB includes the FederatedX engine. Be sure to read" 654 elog "MariaDB includes the FederatedX engine. Be sure to read"
554 elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine" 655 elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine"
656 plugins_dyn="${plugins_sta} federatedx"
555 fi 657 fi
658 else
659 plugins_dis="${plugins_dis} partition federated"
556 fi 660 fi
557 661
558 # Upstream specifically requests that InnoDB always be built: 662 # Upstream specifically requests that InnoDB always be built:
559 # - innobase, innodb_plugin 663 # - innobase, innodb_plugin
560 # Build falcon if available for 6.x series. 664 # Build falcon if available for 6.x series.
561 for i in innobase innodb_plugin falcon ; do 665 for i in innobase falcon ; do
562 [ -e "${S}"/storage/${i} ] && plugins="${plugins},${i}" 666 [ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}"
563 done 667 done
668 for i in innodb_plugin ; do
669 [ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}"
670 done
564 671
565 # like configuration=max-no-ndb 672 # like configuration=max-no-ndb
566 if use cluster ; then 673 if ( use cluster || [[ "${PN}" == "mysql-cluster" ]] ) ; then
567 plugins="${plugins},ndbcluster" 674 plugins_sta="${plugins_sta} ndbcluster partition"
675 plugins_dis="${plugins_dis//partition}"
568 myconf="${myconf} --with-ndb-binlog" 676 myconf="${myconf} --with-ndb-binlog"
677 else
678 plugins_dis="${plugins_dis} ndbcluster"
569 fi 679 fi
570 680
571 if [[ "${PN}" == "mariadb" ]] ; then 681 if [[ "${PN}" == "mariadb" ]] ; then
572 # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not 682 # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not
573 # caught above. 683 # caught above.
574 plugins="${plugins},maria,innobase"
575 if use pbxt ; then
576 plugins="${plugins},pbxt"
577 else
578 myconf="${myconf} --without-plugin-pbxt"
579 fi
580 myconf="${myconf} $(use_with libevent)"
581 # This is not optional, without it several upstream testcases fail. 684 # This is not optional, without it several upstream testcases fail.
582 # Also strongly recommended by upstream. 685 # Also strongly recommended by upstream.
686 if [[ "${PV}" < "5.2.0" ]] ; then
583 myconf="${myconf} --with-maria-tmp-tables" 687 myconf="${myconf} --with-maria-tmp-tables"
688 plugins_sta="${plugins_sta} maria"
689 else
690 myconf="${myconf} --with-aria-tmp-tables"
691 plugins_sta="${plugins_sta} aria"
584 fi 692 fi
585 693
694 [ -e "${S}"/storage/innobase ] || [ -e "${S}"/storage/xtradb ] ||
695 die "The ${P} package doesn't provide innobase nor xtradb"
696
697 for i in innobase xtradb ; do
698 [ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}"
699 done
700
701 myconf="${myconf} $(use_with libevent)"
702
703 if mysql_version_is_at_least "5.2" ; then
704 #This should include sphinx, but the 5.2.4 archive forgot the plug.in file
705 #for i in oqgraph sphinx ; do
706 for i in oqgraph ; do
707 use ${i} \
708 && plugins_dyn="${plugins_dyn} ${i}" \
709 || plugins_dis="${plugins_dis} ${i}"
710 done
711 fi
712 fi
713
714 if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then
715 use pbxt \
716 && plugins_dyn="${plugins_dyn} pbxt" \
717 || plugins_dis="${plugins_dis} pbxt"
718 fi
719
720 use static && \
721 plugins_sta="${plugins_sta} ${plugins_dyn}" && \
722 plugins_dyn=""
723
724 einfo "Available plugins: ${plugins_avail}"
725 einfo "Dynamic plugins: ${plugins_dyn}"
726 einfo "Static plugins: ${plugins_sta}"
727 einfo "Disabled plugins: ${plugins_dis}"
728
729 # These are the static plugins
586 myconf="${myconf} --with-plugins=${plugins}" 730 myconf="${myconf} --with-plugins=${plugins_sta// /,}"
731 # And the disabled ones
732 for i in ${plugins_dis} ; do
733 myconf="${myconf} --without-plugin-${i}"
734 done
587} 735}
588 736
589pbxt_src_configure() { 737pbxt_src_configure() {
590 mysql_init_vars 738 mysql_init_vars
591 739
592 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null 740 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
593 741
594 einfo "Reconfiguring dir '${PWD}'" 742 einfo "Reconfiguring dir '${PWD}'"
595 AT_GNUCONF_UPDATE="yes" eautoreconf 743 eautoreconf
596 744
597 local myconf="" 745 local myconf=""
598 myconf="${myconf} --with-mysql=${S} --libdir=/usr/$(get_libdir)" 746 myconf="${myconf} --with-mysql=${S} --libdir=/usr/$(get_libdir)"
599 use debug && myconf="${myconf} --with-debug=full" 747 use debug && myconf="${myconf} --with-debug=full"
600 econf ${myconf} || die "Problem configuring PBXT storage engine" 748 econf ${myconf} || die "Problem configuring PBXT storage engine"
601} 749}
602 750
603pbxt_src_compile() { 751pbxt_src_compile() {
752
604 # Be backwards compatible for now 753 # Be backwards compatible for now
605 if [[ $EAPI != 2 ]]; then 754 if [[ $EAPI != 2 ]]; then
606 pbxt_src_configure 755 pbxt_src_configure
607 fi 756 fi
608 # TODO: is it safe/needed to use emake here ? 757 # TODO: is it safe/needed to use emake here ?
627# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv" 776# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv"
628# check for conflicting use flags 777# check for conflicting use flags
629# create new user and group for mysql 778# create new user and group for mysql
630# warn about deprecated features 779# warn about deprecated features
631mysql_pkg_setup() { 780mysql_pkg_setup() {
632 if hasq test ${FEATURES} ; then 781 if has test ${FEATURES} ; then
633 if ! use minimal ; then 782 if ! use minimal ; then
634 if [[ $UID -eq 0 ]]; then 783 if [[ $UID -eq 0 ]]; then
635 eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." 784 eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
636 fi 785 fi
637 fi 786 fi
638 fi 787 fi
639 788
789 # bug 350844
790 case "${EAPI:-0}" in
791 0 | 1)
792 if use static && !built_with_use sys-libs/ncurses static-libs; then
793 die "To build MySQL statically you need to enable static-libs for sys-libs/ncurses"
794 fi
795 ;;
796 esac
797
640 # Check for USE flag problems in pkg_setup 798 # Check for USE flag problems in pkg_setup
641 if use static && use ssl ; then 799 if use static && use ssl ; then
642 eerror "MySQL does not support being built statically with SSL support enabled!"
643 die "MySQL does not support being built statically with SSL support enabled!" 800 M="MySQL does not support being built statically with SSL support enabled!"
801 eerror "${M}"
802 die "${M}"
803 fi
804
805 if mysql_version_is_at_least "5.1.51" \
806 && ! mysql_version_is_at_least "5.2" \
807 && use debug ; then
808 # Also in package.use.mask
809 die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51"
644 fi 810 fi
645 811
646 if ! mysql_version_is_at_least "5.0" \ 812 if ! mysql_version_is_at_least "5.0" \
647 && use raid \ 813 && use raid \
648 && use static ; then 814 && use static ; then
650 eerror "with RAID support enabled." 816 eerror "with RAID support enabled."
651 die "USE flags 'raid' and 'static' conflict!" 817 die "USE flags 'raid' and 'static' conflict!"
652 fi 818 fi
653 819
654 if mysql_version_is_at_least "4.1.3" \ 820 if mysql_version_is_at_least "4.1.3" \
655 && ( use cluster || use extraengine ) \ 821 && ( use cluster || use extraengine || use embedded ) \
656 && use minimal ; then 822 && use minimal ; then
657 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
658 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 823 M="USE flags 'cluster', 'extraengine', 'embedded' conflict with 'minimal' USE flag!"
824 eerror "${M}"
825 die "${M}"
659 fi 826 fi
660 827
661 # Bug #290570 fun. Upstream made us need a fairly new GCC4.
662 if mysql_version_is_at_least "5.0.83" ; then 828 if mysql_version_is_at_least "5.1" \
829 && xtradb_patch_available \
830 && use xtradb \
831 && use embedded ; then
832 M="USE flags 'xtradb' and 'embedded' conflict and cause build failures"
833 eerror "${M}"
834 die "${M}"
835 fi
836
837 # Bug #290570, 284946, 307251
838 # Upstream changes made us need a fairly new GCC4.
839 # But only for 5.0.8[3-6]!
840 if mysql_version_is_at_least "5.0.83" && ! mysql_version_is_at_least 5.0.87 ; then
663 GCC_VER=$(gcc-version) 841 GCC_VER=$(gcc-version)
664 case ${GCC_VER} in 842 case ${GCC_VER} in
665 2*|3*|4.0|4.1|4.2) die "Active GCC too old! Must have at least GCC4.3" ;; 843 2*|3*|4.0|4.1|4.2)
844 eerror "Some releases of MySQL required a very new GCC, and then"
845 eerror "later release relaxed that requirement again. Either pick a"
846 eerror "MySQL >=5.0.87, or use a newer GCC."
847 die "Active GCC too old!" ;;
666 esac 848 esac
667 fi 849 fi
668 850
669 # This should come after all of the die statements 851 # This should come after all of the die statements
670 enewgroup mysql 60 || die "problem adding 'mysql' group" 852 enewgroup mysql 60 || die "problem adding 'mysql' group"
720 mysql_mv_patches 902 mysql_mv_patches
721 # And apply 903 # And apply
722 epatch 904 epatch
723 905
724 # last -fPIC fixup, per bug #305873 906 # last -fPIC fixup, per bug #305873
725 i="${S}"/storage/innodb_plugin/plug.in 907 i="${S}"/storage/innodb_plugin/plug.in
726 [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" 908 [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
727 909
728 # Additional checks, remove bundled zlib 910 # Additional checks, remove bundled zlib (Cluster needs this, for static
911 # memory management in zlib, leave available for Cluster)
912 if [[ "${PN}" != "mysql-cluster" ]] ; then
729 rm -f "${S}/zlib/"*.[ch] 913 rm -f "${S}/zlib/"*.[ch]
730 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 914 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
915 fi
731 rm -f "scripts/mysqlbug" 916 rm -f "scripts/mysqlbug"
732 917
733 # Make charsets install in the right place 918 # Make charsets install in the right place
734 find . -name 'Makefile.am' \ 919 find . -name 'Makefile.am' \
735 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; 920 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \;
746 fi 931 fi
747 932
748 local rebuilddirlist d 933 local rebuilddirlist d
749 934
750 if xtradb_patch_available && use xtradb ; then 935 if xtradb_patch_available && use xtradb ; then
751 einfo "Replacing InnoDB with Percona XtraDB" 936 einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)"
752 pushd "${S}"/storage 937 pushd "${S}"/storage >/dev/null
753 i="innobase" 938 i="innobase"
754 o="${WORKDIR}/storage-${i}.mysql-upstream" 939 o="${WORKDIR}/storage-${i}.mysql-upstream"
755 # Have we been here already? 940 # Have we been here already?
756 [ -d "${o}" ] && rm -f "${i}" 941 [ -d "${o}" ] && rm -f "${i}"
757 # Or maybe we haven't 942 # Or maybe we haven't
758 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" 943 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
759 cp -ra "${WORKDIR}/${XTRADB_P}" "${i}" 944 cp -ral "${WORKDIR}/${XTRADB_P}" "${i}"
760 popd 945 popd >/dev/null
946 fi
947
948 if pbxt_patch_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then
949 einfo "Adding storage engine: PBXT"
950 pushd "${S}"/storage >/dev/null
951 i='pbxt'
952 [ -d "${i}" ] && rm -rf "${i}"
953 cp -ral "${WORKDIR}/${PBXT_P}" "${i}"
954 popd >/dev/null
761 fi 955 fi
762 956
763 if mysql_version_is_at_least "5.1.12" ; then 957 if mysql_version_is_at_least "5.1.12" ; then
764 rebuilddirlist="." 958 rebuilddirlist="."
765 # This does not seem to be needed presently. robbat2 2010/02/23 959 # This does not seem to be needed presently. robbat2 2010/02/23
774 fi 968 fi
775 969
776 for d in ${rebuilddirlist} ; do 970 for d in ${rebuilddirlist} ; do
777 einfo "Reconfiguring dir '${d}'" 971 einfo "Reconfiguring dir '${d}'"
778 pushd "${d}" &>/dev/null 972 pushd "${d}" &>/dev/null
779 AT_GNUCONF_UPDATE="yes" eautoreconf 973 eautoreconf
780 popd &>/dev/null 974 popd &>/dev/null
781 done 975 done
782 976
783 if mysql_check_version_range "4.1 to 5.0.99.99" \ 977 if mysql_check_version_range "4.1 to 5.0.99.99" \
784 && use berkdb ; then 978 && use berkdb ; then
840 export CXXFLAGS 1034 export CXXFLAGS
841 1035
842 # bug #283926, with GCC4.4, this is required to get correct behavior. 1036 # bug #283926, with GCC4.4, this is required to get correct behavior.
843 append-flags -fno-strict-aliasing 1037 append-flags -fno-strict-aliasing
844 1038
1039 # bug #335185, #335995, with >= GCC4.3.3 on x86 only, omit-frame-pointer
1040 # causes a mis-compile.
1041 # Upstream bugs:
1042 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38562
1043 # http://bugs.mysql.com/bug.php?id=45205
1044 use x86 && version_is_at_least "4.3.3" "$(gcc-fullversion)" && \
1045 append-flags -fno-omit-frame-pointer && \
1046 filter-flags -fomit-frame-pointer
1047
845 econf \ 1048 econf \
846 --libexecdir="/usr/sbin" \ 1049 --libexecdir="/usr/sbin" \
847 --sysconfdir="${MY_SYSCONFDIR}" \ 1050 --sysconfdir="${MY_SYSCONFDIR}" \
848 --localstatedir="${MY_LOCALSTATEDIR}" \ 1051 --localstatedir="${MY_LOCALSTATEDIR}" \
849 --sharedstatedir="${MY_SHAREDSTATEDIR}" \ 1052 --sharedstatedir="${MY_SHAREDSTATEDIR}" \
852 --with-low-memory \ 1055 --with-low-memory \
853 --with-client-ldflags=-lstdc++ \ 1056 --with-client-ldflags=-lstdc++ \
854 --enable-thread-safe-client \ 1057 --enable-thread-safe-client \
855 --with-comment="Gentoo Linux ${PF}" \ 1058 --with-comment="Gentoo Linux ${PF}" \
856 --without-docs \ 1059 --without-docs \
1060 --with-LIBDIR="$(get_libdir)" \
857 ${myconf} || die "econf failed" 1061 ${myconf} || die "econf failed"
858 1062
859 # TODO: Move this before autoreconf !!! 1063 # TODO: Move this before autoreconf !!!
860 find . -type f -name Makefile -print0 \ 1064 find . -type f -name Makefile -print0 \
861 | xargs -0 -n100 sed -i \ 1065 | xargs -0 -n100 sed -i \
862 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' 1066 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
863 1067
864 if [[ $EAPI == 2 ]]; then 1068 if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
865 pbxt_patch_available && use pbxt && pbxt_src_configure 1069 pbxt_patch_available && use pbxt && pbxt_src_configure
866 fi 1070 fi
867} 1071}
868 1072
869# @FUNCTION: mysql_src_compile 1073# @FUNCTION: mysql_src_compile
876 0 | 1) mysql_src_configure ;; 1080 0 | 1) mysql_src_configure ;;
877 esac 1081 esac
878 1082
879 emake || die "emake failed" 1083 emake || die "emake failed"
880 1084
1085 if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
881 pbxt_patch_available && use pbxt && pbxt_src_compile 1086 pbxt_patch_available && use pbxt && pbxt_src_compile
1087 fi
882} 1088}
883 1089
884# @FUNCTION: mysql_src_install 1090# @FUNCTION: mysql_src_install
885# @DESCRIPTION: 1091# @DESCRIPTION:
886# Install mysql. 1092# Install mysql.
892 DESTDIR="${D}" \ 1098 DESTDIR="${D}" \
893 benchdir_root="${MY_SHAREDSTATEDIR}" \ 1099 benchdir_root="${MY_SHAREDSTATEDIR}" \
894 testroot="${MY_SHAREDSTATEDIR}" \ 1100 testroot="${MY_SHAREDSTATEDIR}" \
895 || die "emake install failed" 1101 || die "emake install failed"
896 1102
1103 if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
897 pbxt_patch_available && use pbxt && pbxt_src_install 1104 pbxt_patch_available && use pbxt && pbxt_src_install
1105 fi
898 1106
899 # Convenience links 1107 # Convenience links
900 einfo "Making Convenience links for mysqlcheck multi-call binary" 1108 einfo "Making Convenience links for mysqlcheck multi-call binary"
901 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" 1109 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
902 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 1110 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
926 if use !test ; then 1134 if use !test ; then
927 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test 1135 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
928 fi 1136 fi
929 1137
930 # Configuration stuff 1138 # Configuration stuff
931 if mysql_version_is_at_least "5.1" ; then 1139 case ${MYSQL_PV_MAJOR} in
932 mysql_mycnf_version="5.1"
933 elif mysql_version_is_at_least "4.1" ; then
934 mysql_mycnf_version="4.1"
935 else
936 mysql_mycnf_version="4.0" 1140 3*|4.0) mysql_mycnf_version="4.0" ;;
937 fi 1141 4.[1-9]|5.0) mysql_mycnf_version="4.1" ;;
938 einfo "Building default my.cnf" 1142 5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;;
1143 esac
1144 einfo "Building default my.cnf (${mysql_mycnf_version})"
939 insinto "${MY_SYSCONFDIR}" 1145 insinto "${MY_SYSCONFDIR}"
940 doins scripts/mysqlaccess.conf 1146 doins scripts/mysqlaccess.conf
1147 mycnf_src="my.cnf-${mysql_mycnf_version}"
941 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ 1148 sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
942 "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \ 1149 "${FILESDIR}/${mycnf_src}" \
943 > "${TMPDIR}/my.cnf.ok" 1150 > "${TMPDIR}/my.cnf.ok"
944 if mysql_version_is_at_least "4.1" && use latin1 ; then 1151 if use latin1 ; then
945 sed -i \ 1152 sed -i \
946 -e "/character-set/s|utf8|latin1|g" \ 1153 -e "/character-set/s|utf8|latin1|g" \
947 "${TMPDIR}/my.cnf.ok" 1154 "${TMPDIR}/my.cnf.ok"
948 fi 1155 fi
949 newins "${TMPDIR}/my.cnf.ok" my.cnf 1156 newins "${TMPDIR}/my.cnf.ok" my.cnf
967 done 1174 done
968 fi 1175 fi
969 1176
970 # Docs 1177 # Docs
971 einfo "Installing docs" 1178 einfo "Installing docs"
972 dodoc README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE 1179 for i in README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE ; do
1180 [[ -f "$i" ]] && dodoc "$i"
1181 done
973 doinfo "${S}"/Docs/mysql.info 1182 doinfo "${S}"/Docs/mysql.info
974 1183
975 # Minimal builds don't have the MySQL server 1184 # Minimal builds don't have the MySQL server
976 if ! use minimal ; then 1185 if ! use minimal ; then
977 einfo "Including support files and sample configurations" 1186 einfo "Including support files and sample configurations"
1043 1252
1044 einfo 1253 einfo
1045 elog "You might want to run:" 1254 elog "You might want to run:"
1046 elog "\"emerge --config =${CATEGORY}/${PF}\"" 1255 elog "\"emerge --config =${CATEGORY}/${PF}\""
1047 elog "if this is a new install." 1256 elog "if this is a new install."
1257 einfo
1258
1259 einfo
1260 elog "If you are upgrading major versions, you should run the"
1261 elog "mysql_upgrade tool."
1048 einfo 1262 einfo
1049 fi 1263 fi
1050 1264
1051 if pbxt_available && use pbxt ; then 1265 if pbxt_available && use pbxt ; then
1052 # TODO: explain it better 1266 # TODO: explain it better
1107 fi 1321 fi
1108 fi 1322 fi
1109 1323
1110 local pwd1="a" 1324 local pwd1="a"
1111 local pwd2="b" 1325 local pwd2="b"
1112 local MYSQL_ROOT_PASSWORD=''
1113 local maxtry=15 1326 local maxtry=15
1114 1327
1115 if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${ROOT}/root/.my.cnf" ]; then 1328 if [ -z "${MYSQL_ROOT_PASSWORD}" -a -f "${ROOT}/root/.my.cnf" ]; then
1116 MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${ROOT}/root/.my.cnf")" 1329 MYSQL_ROOT_PASSWORD="$(sed -n -e '/^password=/s,^password=,,gp' "${ROOT}/root/.my.cnf")"
1117 fi 1330 fi
1127 # localhost. Also causes weird failures. 1340 # localhost. Also causes weird failures.
1128 [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" 1341 [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1129 1342
1130 if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then 1343 if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1131 1344
1132 einfo "Please provide a password for the mysql 'root' user now," 1345 einfo "Please provide a password for the mysql 'root' user now, in the"
1133 einfo "or in the MYSQL_ROOT_PASSWORD env var." 1346 einfo "MYSQL_ROOT_PASSWORD env var or through the /root/.my.cnf file."
1134 ewarn "Avoid [\"'\\_%] characters in the password" 1347 ewarn "Avoid [\"'\\_%] characters in the password"
1135 read -rsp " >" pwd1 ; echo 1348 read -rsp " >" pwd1 ; echo
1136 1349
1137 einfo "Retype the password" 1350 einfo "Retype the password"
1138 read -rsp " >" pwd2 ; echo 1351 read -rsp " >" pwd2 ; echo
1168 # Figure out which options we need to disable to do the setup 1381 # Figure out which options we need to disable to do the setup
1169 helpfile="${TMPDIR}/mysqld-help" 1382 helpfile="${TMPDIR}/mysqld-help"
1170 ${ROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null 1383 ${ROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
1171 for opt in grant-tables host-cache name-resolve networking slave-start bdb \ 1384 for opt in grant-tables host-cache name-resolve networking slave-start bdb \
1172 federated innodb ssl log-bin relay-log slow-query-log external-locking \ 1385 federated innodb ssl log-bin relay-log slow-query-log external-locking \
1386 ndbcluster \
1173 ; do 1387 ; do
1174 optexp="--(skip-)?${opt}" optfull="--skip-${opt}" 1388 optexp="--(skip-)?${opt}" optfull="--skip-${opt}"
1175 egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" 1389 egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1176 done 1390 done
1177 # But some options changed names 1391 # But some options changed names
1185 1399
1186 if [[ -r "${help_tables}" ]] ; then 1400 if [[ -r "${help_tables}" ]] ; then
1187 cat "${help_tables}" >> "${sqltmp}" 1401 cat "${help_tables}" >> "${sqltmp}"
1188 fi 1402 fi
1189 fi 1403 fi
1190 1404
1191 einfo "Creating the mysql database and setting proper" 1405 einfo "Creating the mysql database and setting proper"
1192 einfo "permissions on it ..." 1406 einfo "permissions on it ..."
1193 1407
1194 local socket="${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock" 1408 local socket="${ROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
1195 local pidfile="${ROOT}/var/run/mysqld/mysqld${RANDOM}.pid" 1409 local pidfile="${ROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
1198 --user=mysql \ 1412 --user=mysql \
1199 --basedir=${ROOT}/usr \ 1413 --basedir=${ROOT}/usr \
1200 --datadir=${ROOT}/${MY_DATADIR} \ 1414 --datadir=${ROOT}/${MY_DATADIR} \
1201 --max_allowed_packet=8M \ 1415 --max_allowed_packet=8M \
1202 --net_buffer_length=16K \ 1416 --net_buffer_length=16K \
1417 --default-storage-engine=MyISAM \
1203 --socket=${socket} \ 1418 --socket=${socket} \
1204 --pid-file=${pidfile}" 1419 --pid-file=${pidfile}"
1205 #einfo "About to start mysqld: ${mysqld}" 1420 #einfo "About to start mysqld: ${mysqld}"
1206 ebegin "Starting mysqld" 1421 ebegin "Starting mysqld"
1207 ${mysqld} & 1422 ${mysqld} &

Legend:
Removed from v.1.142  
changed lines
  Added in v.1.166

  ViewVC Help
Powered by ViewVC 1.1.20