| 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.130 2010/02/02 02:59:03 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 | |
| 18 | WANT_AUTOCONF="latest" |
18 | WANT_AUTOCONF="latest" |
| 19 | WANT_AUTOMAKE="latest" |
19 | WANT_AUTOMAKE="latest" |
| 20 | |
20 | |
| 21 | inherit eutils flag-o-matic gnuconfig autotools mysql_fx versionator |
21 | inherit 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 |
|
|
25 | S="${WORKDIR}/mysql" |
|
|
26 | |
|
|
27 | [[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" |
|
|
28 | if [[ "${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 |
|
|
32 | fi |
| 22 | |
33 | |
| 23 | case "${EAPI:-0}" in |
34 | case "${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}" ;; |
| 43 | esac |
54 | esac |
| 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 |
|
|
| 47 | S="${WORKDIR}/mysql" |
|
|
| 48 | |
|
|
| 49 | [[ "${MY_EXTRAS_VER}" == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" |
|
|
| 50 | if [[ "${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 |
|
|
| 54 | fi |
|
|
| 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 |
| 84 | elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then |
84 | elif [ "${PV#5.0}" != "${PV}" ] && mysql_version_is_at_least "5.0.82"; then |
| 85 | MYSQL_COMMUNITY_FEATURES=1 |
85 | MYSQL_COMMUNITY_FEATURES=1 |
| 86 | elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then |
86 | elif [ "${PV#5.1}" != "${PV}" ] && mysql_version_is_at_least "5.1.28"; then |
| 87 | MYSQL_COMMUNITY_FEATURES=1 |
87 | MYSQL_COMMUNITY_FEATURES=1 |
| 88 | elif [ "${PV#5.4}" != "${PV}" ]; then |
88 | elif [ "${PV#5.4}" != "${PV}" ] || [ "${PV#5.4}" != "${PV}" ]; then |
| 89 | MYSQL_COMMUNITY_FEATURES=1 |
89 | MYSQL_COMMUNITY_FEATURES=1 |
| 90 | else |
90 | else |
| 91 | MYSQL_COMMUNITY_FEATURES=0 |
91 | MYSQL_COMMUNITY_FEATURES=0 |
| 92 | fi |
92 | fi |
| 93 | |
93 | |
| … | |
… | |
| 146 | fi |
146 | fi |
| 147 | |
147 | |
| 148 | # Define correct SRC_URIs |
148 | # Define correct SRC_URIs |
| 149 | SRC_URI="${SERVER_URI}" |
149 | SRC_URI="${SERVER_URI}" |
| 150 | |
150 | |
| 151 | [[ ${MY_EXTRAS_VER} != live ]] && SRC_URI="${SRC_URI} |
151 | # Gentoo patches to MySQL |
|
|
152 | [[ ${MY_EXTRAS_VER} != live ]] \ |
|
|
153 | && SRC_URI="${SRC_URI} |
| 152 | mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
154 | mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
| 153 | http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
155 | http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
| 154 | PBXT_SRC_URI="mirror://sourceforge/pbxt/pbxt-${PBXT_VERSION}.tar.gz" |
156 | http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
|
|
157 | |
|
|
158 | # PBXT engine |
| 155 | mysql_version_is_at_least "5.1.12" \ |
159 | mysql_version_is_at_least "5.1.12" \ |
| 156 | && [[ -n "${PBXT_VERSION}" ]] \ |
160 | && [[ -n "${PBXT_VERSION}" ]] \ |
|
|
161 | && PBXT_P="pbxt-${PBXT_VERSION}" \ |
|
|
162 | && PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ |
| 157 | && SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URIPBXT_SRC_URI} )" |
163 | && SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" |
| 158 | |
164 | |
| 159 | # Get the percona tarball if XTRADB_VER and PERCONA_VER are both set |
165 | # Get the percona tarball if XTRADB_VER and PERCONA_VER are both set |
| 160 | XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/percona-xtradb-${XTRADB_VER}.tar.gz" |
|
|
| 161 | mysql_version_is_at_least "5.1.26" \ |
166 | mysql_version_is_at_least "5.1.26" \ |
| 162 | && [[ -n ${XTRADB_VER} && -n ${PERCONA_VER} ]] \ |
167 | && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ |
|
|
168 | && XTRADB_P="percona-xtradb-${XTRADB_VER}" \ |
|
|
169 | && 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} )" |
170 | && SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" |
| 164 | |
171 | |
| 165 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." |
172 | DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." |
| 166 | HOMEPAGE="http://www.mysql.com/" |
173 | HOMEPAGE="http://www.mysql.com/" |
| 167 | LICENSE="GPL-2" |
174 | LICENSE="GPL-2" |
| … | |
… | |
| 182 | |
189 | |
| 183 | mysql_version_is_at_least "5.1" \ |
190 | mysql_version_is_at_least "5.1" \ |
| 184 | || IUSE="${IUSE} berkdb" |
191 | || IUSE="${IUSE} berkdb" |
| 185 | |
192 | |
| 186 | mysql_version_is_at_least "5.1.12" \ |
193 | mysql_version_is_at_least "5.1.12" \ |
|
|
194 | && [[ -n "${PBXT_VERSION}" ]] \ |
| 187 | && IUSE="${IUSE} pbxt" |
195 | && IUSE="${IUSE} pbxt" |
| 188 | |
196 | |
| 189 | mysql_version_is_at_least "5.1.26" \ |
197 | mysql_version_is_at_least "5.1.26" \ |
|
|
198 | && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ |
| 190 | && IUSE="${IUSE} xtradb" |
199 | && IUSE="${IUSE} xtradb" |
| 191 | |
200 | |
| 192 | [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ |
201 | [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ |
| 193 | && IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" |
202 | && IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" |
| 194 | |
203 | |
| … | |
… | |
| 198 | |
207 | |
| 199 | # @FUNCTION: mysql_disable_test |
208 | # @FUNCTION: mysql_disable_test |
| 200 | # @DESCRIPTION: |
209 | # @DESCRIPTION: |
| 201 | # Helper function to disable specific tests. |
210 | # Helper function to disable specific tests. |
| 202 | mysql_disable_test() { |
211 | mysql_disable_test() { |
|
|
212 | local rawtestname testname testsuite reason mysql_disable_file |
| 203 | local testname="${1}" ; shift |
213 | rawtestname="${1}" ; shift |
| 204 | local reason="${@}" |
214 | reason="${@}" |
|
|
215 | ewarn "test '${rawtestname}' disabled: '${reason}'" |
|
|
216 | |
|
|
217 | testsuite="${rawtestname/.*}" |
|
|
218 | testname="${rawtestname/*.}" |
| 205 | local mysql_disable_file="${S}/mysql-test/t/disabled.def" |
219 | mysql_disable_file="${S}/mysql-test/t/disabled.def" |
|
|
220 | einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" |
| 206 | echo ${testname} : ${reason} >> "${mysql_disable_file}" |
221 | echo ${testname} : ${reason} >> "${mysql_disable_file}" |
| 207 | ewarn "test '${testname}' disabled: '${reason}'" |
222 | |
|
|
223 | # ${S}/mysql-tests/t/disabled.def |
|
|
224 | # |
|
|
225 | # ${S}/mysql-tests/suite/federated/disabled.def |
|
|
226 | # |
|
|
227 | # ${S}/mysql-tests/suite/jp/t/disabled.def |
|
|
228 | # ${S}/mysql-tests/suite/ndb/t/disabled.def |
|
|
229 | # ${S}/mysql-tests/suite/rpl/t/disabled.def |
|
|
230 | # ${S}/mysql-tests/suite/parts/t/disabled.def |
|
|
231 | # ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def |
|
|
232 | # ${S}/mysql-tests/suite/ndb_team/t/disabled.def |
|
|
233 | # ${S}/mysql-tests/suite/binlog/t/disabled.def |
|
|
234 | # ${S}/mysql-tests/suite/innodb/t/disabled.def |
|
|
235 | if [ -n "${testsuite}" ]; then |
|
|
236 | for mysql_disable_file in \ |
|
|
237 | ${S}/mysql-test/suite/${testsuite}/disabled.def \ |
|
|
238 | ${S}/mysql-test/suite/${testsuite}/t/disabled.def \ |
|
|
239 | FAILED ; do |
|
|
240 | [ -f "${mysql_disable_file}" ] && break |
|
|
241 | done |
|
|
242 | if [ "${mysql_disabled_file}" != "FAILED" ]; then |
|
|
243 | echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
|
|
244 | else |
|
|
245 | ewarn "Could not find testsuite disabled.def location for ${rawtestname}" |
|
|
246 | fi |
|
|
247 | fi |
| 208 | } |
248 | } |
| 209 | |
249 | |
| 210 | # @FUNCTION: mysql_init_vars |
250 | # @FUNCTION: mysql_init_vars |
| 211 | # @DESCRIPTION: |
251 | # @DESCRIPTION: |
| 212 | # void mysql_init_vars() |
252 | # void mysql_init_vars() |
| … | |
… | |
| 447 | # 5.1 introduces a new way to manage storage engines (plugins) |
487 | # 5.1 introduces a new way to manage storage engines (plugins) |
| 448 | # like configuration=none |
488 | # like configuration=none |
| 449 | local plugins="csv,myisam,myisammrg,heap" |
489 | local plugins="csv,myisam,myisammrg,heap" |
| 450 | if use extraengine ; then |
490 | if use extraengine ; then |
| 451 | # like configuration=max-no-ndb, archive and example removed in 5.1.11 |
491 | # like configuration=max-no-ndb, archive and example removed in 5.1.11 |
|
|
492 | # not added yet: ibmdb2i |
|
|
493 | # Not supporting as examples: example,daemon_example,ftexample |
| 452 | plugins="${plugins},archive,blackhole,example,federated,partition" |
494 | plugins="${plugins},archive,blackhole,federated,partition" |
| 453 | |
495 | |
| 454 | elog "Before using the Federated storage engine, please be sure to read" |
496 | 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" |
497 | elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" |
| 456 | fi |
498 | fi |
| 457 | |
499 | |
| 458 | # Upstream specifically requests that InnoDB always be built. |
500 | # Upstream specifically requests that InnoDB always be built: |
| 459 | plugins="${plugins},innobase" |
501 | # - innobase, innodb_plugin |
|
|
502 | # Build falcon if available for 6.x series. |
|
|
503 | for i in innobase innodb_plugin falcon ; do |
|
|
504 | [ -e "${S}"/storage/${i} ] && plugins="${plugins},${i}" |
|
|
505 | done |
| 460 | |
506 | |
| 461 | # like configuration=max-no-ndb |
507 | # like configuration=max-no-ndb |
| 462 | if use cluster ; then |
508 | if use cluster ; then |
| 463 | plugins="${plugins},ndbcluster" |
509 | plugins="${plugins},ndbcluster" |
| 464 | myconf="${myconf} --with-ndb-binlog" |
510 | myconf="${myconf} --with-ndb-binlog" |
| 465 | fi |
|
|
| 466 | |
|
|
| 467 | if mysql_version_is_at_least "5.2" ; then |
|
|
| 468 | plugins="${plugins},falcon" |
|
|
| 469 | fi |
511 | fi |
| 470 | |
512 | |
| 471 | myconf="${myconf} --with-plugins=${plugins}" |
513 | myconf="${myconf} --with-plugins=${plugins}" |
| 472 | } |
514 | } |
| 473 | |
515 | |
| … | |
… | |
| 542 | && use minimal ; then |
584 | && use minimal ; then |
| 543 | eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" |
585 | eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" |
| 544 | die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" |
586 | die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" |
| 545 | fi |
587 | fi |
| 546 | |
588 | |
|
|
589 | # Bug #290570 fun. Upstream made us need a fairly new GCC4. |
|
|
590 | if mysql_version_is_at_least "5.0.83" ; then |
|
|
591 | GCC_VER=$(gcc-version) |
|
|
592 | case ${GCC_VER} in |
|
|
593 | 2*|3*|4.0|4.1|4.2) die "Active GCC too old! Must have at least GCC4.3" ;; |
|
|
594 | esac |
|
|
595 | fi |
|
|
596 | |
| 547 | # This should come after all of the die statements |
597 | # This should come after all of the die statements |
| 548 | enewgroup mysql 60 || die "problem adding 'mysql' group" |
598 | enewgroup mysql 60 || die "problem adding 'mysql' group" |
| 549 | enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
599 | enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
| 550 | |
600 | |
| 551 | mysql_check_version_range "4.0 to 5.0.99.99" \ |
601 | mysql_check_version_range "4.0 to 5.0.99.99" \ |
| … | |
… | |
| 598 | find . -name 'Makefile.am' \ |
648 | find . -name 'Makefile.am' \ |
| 599 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
649 | -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
| 600 | |
650 | |
| 601 | if mysql_version_is_at_least "4.1" ; then |
651 | if mysql_version_is_at_least "4.1" ; then |
| 602 | # Remove what needs to be recreated, so we're sure it's actually done |
652 | # Remove what needs to be recreated, so we're sure it's actually done |
|
|
653 | einfo "Cleaning up old buildscript files" |
| 603 | find . -name Makefile \ |
654 | find . -name Makefile \ |
| 604 | -o -name Makefile.in \ |
655 | -o -name Makefile.in \ |
| 605 | -o -name configure \ |
656 | -o -name configure \ |
| 606 | -exec rm -f {} \; |
657 | -exec rm -f {} \; |
| 607 | rm -f "ltmain.sh" |
658 | rm -f "ltmain.sh" |
| 608 | rm -f "scripts/mysqlbug" |
659 | rm -f "scripts/mysqlbug" |
| 609 | fi |
660 | fi |
| 610 | |
661 | |
| 611 | local rebuilddirlist d |
662 | local rebuilddirlist d |
| 612 | |
663 | |
|
|
664 | if mysql_version_is_at_least "5.1.26" && use xtradb ; then |
|
|
665 | einfo "Replacing InnoDB with Percona XtraDB" |
|
|
666 | pushd "${S}"/storage |
|
|
667 | i="innobase" |
|
|
668 | o="${WORKDIR}/storage-${i}.mysql-upstream" |
|
|
669 | # Have we been here already? |
|
|
670 | [ -h "${i}" ] && rm -f "${i}" |
|
|
671 | # Or maybe we haven't |
|
|
672 | [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" |
|
|
673 | ln -s "${WORKDIR}/${XTRADB_P}" "${i}" |
|
|
674 | popd |
|
|
675 | fi |
|
|
676 | |
| 613 | if mysql_version_is_at_least "5.1.12" ; then |
677 | if mysql_version_is_at_least "5.1.12" ; then |
|
|
678 | einfo "Updating innobase cmake" |
| 614 | rebuilddirlist="." |
679 | rebuilddirlist="." |
| 615 | # TODO: check this with a cmake expert |
680 | # TODO: check this with a cmake expert |
| 616 | cmake \ |
681 | cmake \ |
| 617 | -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ |
682 | -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ |
| 618 | -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ |
683 | -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ |
| … | |
… | |
| 628 | popd &>/dev/null |
693 | popd &>/dev/null |
| 629 | done |
694 | done |
| 630 | |
695 | |
| 631 | if mysql_check_version_range "4.1 to 5.0.99.99" \ |
696 | if mysql_check_version_range "4.1 to 5.0.99.99" \ |
| 632 | && use berkdb ; then |
697 | && use berkdb ; then |
|
|
698 | einfo "Fixing up berkdb buildsystem" |
| 633 | [[ -w "bdb/dist/ltmain.sh" ]] && cp -f "ltmain.sh" "bdb/dist/ltmain.sh" |
699 | [[ -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" \ |
700 | cp -f "/usr/share/aclocal/libtool.m4" "bdb/dist/aclocal/libtool.ac" \ |
| 635 | || die "Could not copy libtool.m4 to bdb/dist/" |
701 | || die "Could not copy libtool.m4 to bdb/dist/" |
| 636 | #These files exist only with libtool-2*, and need to be included. |
702 | #These files exist only with libtool-2*, and need to be included. |
| 637 | if [ -f '/usr/share/aclocal/ltsugar.m4' ]; then |
703 | if [ -f '/usr/share/aclocal/ltsugar.m4' ]; then |