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

Diff of /eclass/mysql.eclass

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

Revision 1.120 Revision 1.132
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.120 2009/12/09 18:46:53 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.132 2010/02/02 22:16:04 robbat2 Exp $
4 4
5# @ECLASS: mysql.eclass 5# @ECLASS: mysql.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Author: Francesco Riosa (Retired) <vivo@gentoo.org> 7# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
8# Maintainers: MySQL Team <mysql-bugs@gentoo.org> 8# Maintainers: MySQL Team <mysql-bugs@gentoo.org>
16# phase hooks. 16# phase hooks.
17 17
18WANT_AUTOCONF="latest" 18WANT_AUTOCONF="latest"
19WANT_AUTOMAKE="latest" 19WANT_AUTOMAKE="latest"
20 20
21inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator 21inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator toolchain-funcs
22
23# Shorten the path because the socket path length must be shorter than 107 chars
24# and we will run a mysql server during test phase
25S="${WORKDIR}/mysql"
26
27[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
28if [[ "${MY_EXTRAS_VER}" == "live" ]]; then
29 EGIT_PROJECT=mysql-extras
30 EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git"
31 inherit git
32fi
22 33
23case "${EAPI:-0}" in 34case "${EAPI:-0}" in
24 2) 35 2)
25 EXPORT_FUNCTIONS pkg_setup \ 36 EXPORT_FUNCTIONS pkg_setup \
26 src_unpack src_prepare \ 37 src_unpack src_prepare \
40 ;; 51 ;;
41 *) 52 *)
42 die "Unsupported EAPI: ${EAPI}" ;; 53 die "Unsupported EAPI: ${EAPI}" ;;
43esac 54esac
44 55
45# Shorten the path because the socket path length must be shorter than 107 chars
46# and we will run a mysql server during test phase
47S="${WORKDIR}/mysql"
48
49[[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
50if [[ "${MY_EXTRAS_VER}" == "live" ]]; then
51 EGIT_PROJECT=mysql-extras
52 EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/mysql-extras.git"
53 inherit git
54fi
55
56# @ECLASS-VARIABLE: MYSQL_VERSION_ID 56# @ECLASS-VARIABLE: MYSQL_VERSION_ID
57# @DESCRIPTION: 57# @DESCRIPTION:
58# MYSQL_VERSION_ID will be: 58# MYSQL_VERSION_ID will be:
59# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] 59# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
60# This is an important part, because many of the choices the MySQL ebuild will do 60# This is an important part, because many of the choices the MySQL ebuild will do
83 MYSQL_COMMUNITY_FEATURES=1 83 MYSQL_COMMUNITY_FEATURES=1
84elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then 84elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then
85 MYSQL_COMMUNITY_FEATURES=1 85 MYSQL_COMMUNITY_FEATURES=1
86elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then 86elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then
87 MYSQL_COMMUNITY_FEATURES=1 87 MYSQL_COMMUNITY_FEATURES=1
88elif [ "${PV#5.4}" != "${PV}" ]; then 88elif [ "${PV#5.4}" != "${PV}" ] ; then
89 MYSQL_COMMUNITY_FEATURES=1
90elif [ "${PV#5.5}" != "${PV}" ] ; then
91 MYSQL_COMMUNITY_FEATURES=1
92elif [ "${PV#6.0}" != "${PV}" ] ; then
89 MYSQL_COMMUNITY_FEATURES=1 93 MYSQL_COMMUNITY_FEATURES=1
90else 94else
91 MYSQL_COMMUNITY_FEATURES=0 95 MYSQL_COMMUNITY_FEATURES=0
92fi 96fi
93 97
134# For other stuff to bring us in 138# For other stuff to bring us in
135PDEPEND="${PDEPEND} =virtual/mysql-$(get_version_component_range 1-2 ${PV})" 139PDEPEND="${PDEPEND} =virtual/mysql-$(get_version_component_range 1-2 ${PV})"
136 140
137# Work out the default SERVER_URI correctly 141# Work out the default SERVER_URI correctly
138if [ -z "${SERVER_URI}" ]; then 142if [ -z "${SERVER_URI}" ]; then
143 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}"
139 # The community build is on the mirrors 144 # The community build is on the mirrors
140 if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then 145 if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then
141 SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${PV//_/-}.tar.gz" 146 SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${MY_PV}.tar.gz"
142 # The (old) enterprise source is on the primary site only 147 # The (old) enterprise source is on the primary site only
143 elif [ "${PN}" == "mysql" ]; then 148 elif [ "${PN}" == "mysql" ]; then
144 SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${PV//_/-}.tar.gz" 149 SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV}.tar.gz"
145 fi 150 fi
146fi 151fi
147 152
148# Define correct SRC_URIs 153# Define correct SRC_URIs
149SRC_URI="${SERVER_URI}" 154SRC_URI="${SERVER_URI}"
150 155
151[[ ${MY_EXTRAS_VER} != live ]] && SRC_URI="${SRC_URI} 156# Gentoo patches to MySQL
157[[ ${MY_EXTRAS_VER} != live ]] \
158&& SRC_URI="${SRC_URI}
152 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 159 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
153 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" 160 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
154PBXT_SRC_URI="mirror://sourceforge/pbxt/pbxt-${PBXT_VERSION}.tar.gz" 161 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
162
163# PBXT engine
155mysql_version_is_at_least "5.1.12" \ 164mysql_version_is_at_least "5.1.12" \
156&& [[ -n "${PBXT_VERSION}" ]] \ 165&& [[ -n "${PBXT_VERSION}" ]] \
166&& PBXT_P="pbxt-${PBXT_VERSION}" \
167&& PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
157&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URIPBXT_SRC_URI} )" 168&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
158 169
159# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set 170# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
160XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/percona-xtradb-${XTRADB_VER}.tar.gz"
161mysql_version_is_at_least "5.1.26" \ 171mysql_version_is_at_least "5.1.26" \
162&& [[ -n ${XTRADB_VER} && -n ${PERCONA_VER} ]] \ 172&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
173&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \
174&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
163&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" 175&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )"
164 176
165DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." 177DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
166HOMEPAGE="http://www.mysql.com/" 178HOMEPAGE="http://www.mysql.com/"
167LICENSE="GPL-2" 179LICENSE="GPL-2"
182 194
183mysql_version_is_at_least "5.1" \ 195mysql_version_is_at_least "5.1" \
184|| IUSE="${IUSE} berkdb" 196|| IUSE="${IUSE} berkdb"
185 197
186mysql_version_is_at_least "5.1.12" \ 198mysql_version_is_at_least "5.1.12" \
199&& [[ -n "${PBXT_VERSION}" ]] \
187&& IUSE="${IUSE} pbxt" 200&& IUSE="${IUSE} pbxt"
188 201
189mysql_version_is_at_least "5.1.26" \ 202mysql_version_is_at_least "5.1.26" \
203&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
190&& IUSE="${IUSE} xtradb" 204&& IUSE="${IUSE} xtradb"
191 205
192[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ 206[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
193&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" 207&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
194 208
198 212
199# @FUNCTION: mysql_disable_test 213# @FUNCTION: mysql_disable_test
200# @DESCRIPTION: 214# @DESCRIPTION:
201# Helper function to disable specific tests. 215# Helper function to disable specific tests.
202mysql_disable_test() { 216mysql_disable_test() {
217 local rawtestname testname testsuite reason mysql_disable_file
203 local testname="${1}" ; shift 218 rawtestname="${1}" ; shift
204 local reason="${@}" 219 reason="${@}"
220 ewarn "test '${rawtestname}' disabled: '${reason}'"
221
222 testsuite="${rawtestname/.*}"
223 testname="${rawtestname/*.}"
205 local mysql_disable_file="${S}/mysql-test/t/disabled.def" 224 mysql_disable_file="${S}/mysql-test/t/disabled.def"
225 #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
206 echo ${testname} : ${reason} >> "${mysql_disable_file}" 226 echo ${testname} : ${reason} >> "${mysql_disable_file}"
207 ewarn "test '${testname}' disabled: '${reason}'" 227
228 # ${S}/mysql-tests/t/disabled.def
229 #
230 # ${S}/mysql-tests/suite/federated/disabled.def
231 #
232 # ${S}/mysql-tests/suite/jp/t/disabled.def
233 # ${S}/mysql-tests/suite/ndb/t/disabled.def
234 # ${S}/mysql-tests/suite/rpl/t/disabled.def
235 # ${S}/mysql-tests/suite/parts/t/disabled.def
236 # ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def
237 # ${S}/mysql-tests/suite/ndb_team/t/disabled.def
238 # ${S}/mysql-tests/suite/binlog/t/disabled.def
239 # ${S}/mysql-tests/suite/innodb/t/disabled.def
240 if [ -n "${testsuite}" ]; then
241 for mysql_disable_file in \
242 ${S}/mysql-test/suite/${testsuite}/disabled.def \
243 ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
244 FAILED ; do
245 [ -f "${mysql_disable_file}" ] && break
246 done
247 if [ "${mysql_disabled_file}" != "FAILED" ]; then
248 echo "${testname} : ${reason}" >> "${mysql_disable_file}"
249 else
250 ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
251 fi
252 fi
208} 253}
209 254
210# @FUNCTION: mysql_init_vars 255# @FUNCTION: mysql_init_vars
211# @DESCRIPTION: 256# @DESCRIPTION:
212# void mysql_init_vars() 257# void mysql_init_vars()
447 # 5.1 introduces a new way to manage storage engines (plugins) 492 # 5.1 introduces a new way to manage storage engines (plugins)
448 # like configuration=none 493 # like configuration=none
449 local plugins="csv,myisam,myisammrg,heap" 494 local plugins="csv,myisam,myisammrg,heap"
450 if use extraengine ; then 495 if use extraengine ; then
451 # like configuration=max-no-ndb, archive and example removed in 5.1.11 496 # like configuration=max-no-ndb, archive and example removed in 5.1.11
497 # not added yet: ibmdb2i
498 # Not supporting as examples: example,daemon_example,ftexample
452 plugins="${plugins},archive,blackhole,example,federated,partition" 499 plugins="${plugins},archive,blackhole,federated,partition"
453 500
454 elog "Before using the Federated storage engine, please be sure to read" 501 elog "Before using the Federated storage engine, please be sure to read"
455 elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" 502 elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html"
456 fi 503 fi
457 504
458 # Upstream specifically requests that InnoDB always be built. 505 # Upstream specifically requests that InnoDB always be built:
459 plugins="${plugins},innobase" 506 # - innobase, innodb_plugin
507 # Build falcon if available for 6.x series.
508 for i in innobase innodb_plugin falcon ; do
509 [ -e "${S}"/storage/${i} ] && plugins="${plugins},${i}"
510 done
460 511
461 # like configuration=max-no-ndb 512 # like configuration=max-no-ndb
462 if use cluster ; then 513 if use cluster ; then
463 plugins="${plugins},ndbcluster" 514 plugins="${plugins},ndbcluster"
464 myconf="${myconf} --with-ndb-binlog" 515 myconf="${myconf} --with-ndb-binlog"
465 fi
466
467 if mysql_version_is_at_least "5.2" ; then
468 plugins="${plugins},falcon"
469 fi 516 fi
470 517
471 myconf="${myconf} --with-plugins=${plugins}" 518 myconf="${myconf} --with-plugins=${plugins}"
472} 519}
473 520
542 && use minimal ; then 589 && use minimal ; then
543 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 590 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
544 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 591 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
545 fi 592 fi
546 593
594 # Bug #290570 fun. Upstream made us need a fairly new GCC4.
595 if mysql_version_is_at_least "5.0.83" ; then
596 GCC_VER=$(gcc-version)
597 case ${GCC_VER} in
598 2*|3*|4.0|4.1|4.2) die "Active GCC too old! Must have at least GCC4.3" ;;
599 esac
600 fi
601
547 # This should come after all of the die statements 602 # This should come after all of the die statements
548 enewgroup mysql 60 || die "problem adding 'mysql' group" 603 enewgroup mysql 60 || die "problem adding 'mysql' group"
549 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 604 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
550 605
551 mysql_check_version_range "4.0 to 5.0.99.99" \ 606 mysql_check_version_range "4.0 to 5.0.99.99" \
598 find . -name 'Makefile.am' \ 653 find . -name 'Makefile.am' \
599 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; 654 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \;
600 655
601 if mysql_version_is_at_least "4.1" ; then 656 if mysql_version_is_at_least "4.1" ; then
602 # Remove what needs to be recreated, so we're sure it's actually done 657 # Remove what needs to be recreated, so we're sure it's actually done
658 einfo "Cleaning up old buildscript files"
603 find . -name Makefile \ 659 find . -name Makefile \
604 -o -name Makefile.in \ 660 -o -name Makefile.in \
605 -o -name configure \ 661 -o -name configure \
606 -exec rm -f {} \; 662 -exec rm -f {} \;
607 rm -f "ltmain.sh" 663 rm -f "ltmain.sh"
608 rm -f "scripts/mysqlbug" 664 rm -f "scripts/mysqlbug"
609 fi 665 fi
610 666
611 local rebuilddirlist d 667 local rebuilddirlist d
612 668
669 if mysql_version_is_at_least "5.1.26" && use xtradb ; then
670 einfo "Replacing InnoDB with Percona XtraDB"
671 pushd "${S}"/storage
672 i="innobase"
673 o="${WORKDIR}/storage-${i}.mysql-upstream"
674 # Have we been here already?
675 [ -h "${i}" ] && rm -f "${i}"
676 # Or maybe we haven't
677 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
678 ln -s "${WORKDIR}/${XTRADB_P}" "${i}"
679 popd
680 fi
681
613 if mysql_version_is_at_least "5.1.12" ; then 682 if mysql_version_is_at_least "5.1.12" ; then
683 einfo "Updating innobase cmake"
614 rebuilddirlist="." 684 rebuilddirlist="."
615 # TODO: check this with a cmake expert 685 # TODO: check this with a cmake expert
616 cmake \ 686 cmake \
617 -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ 687 -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \
618 -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ 688 -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \
628 popd &>/dev/null 698 popd &>/dev/null
629 done 699 done
630 700
631 if mysql_check_version_range "4.1 to 5.0.99.99" \ 701 if mysql_check_version_range "4.1 to 5.0.99.99" \
632 && use berkdb ; then 702 && use berkdb ; then
703 einfo "Fixing up berkdb buildsystem"
633 [[ -w "bdb/dist/ltmain.sh" ]] && cp -f "ltmain.sh" "bdb/dist/ltmain.sh" 704 [[ -w "bdb/dist/ltmain.sh" ]] && cp -f "ltmain.sh" "bdb/dist/ltmain.sh"
634 cp -f "/usr/share/aclocal/libtool.m4" "bdb/dist/aclocal/libtool.ac" \ 705 cp -f "/usr/share/aclocal/libtool.m4" "bdb/dist/aclocal/libtool.ac" \
635 || die "Could not copy libtool.m4 to bdb/dist/" 706 || die "Could not copy libtool.m4 to bdb/dist/"
636 #These files exist only with libtool-2*, and need to be included. 707 #These files exist only with libtool-2*, and need to be included.
637 if [ -f '/usr/share/aclocal/ltsugar.m4' ]; then 708 if [ -f '/usr/share/aclocal/ltsugar.m4' ]; then

Legend:
Removed from v.1.120  
changed lines
  Added in v.1.132

  ViewVC Help
Powered by ViewVC 1.1.20