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

Diff of /eclass/mysql.eclass

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

Revision 1.132 Revision 1.133
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.132 2010/02/02 22:16:04 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.133 2010/02/21 00:18:16 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>
158&& SRC_URI="${SRC_URI} 158&& SRC_URI="${SRC_URI}
159 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 159 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
160 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 160 http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
161 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" 161 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
162 162
163DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
164HOMEPAGE="http://www.mysql.com/"
165LICENSE="GPL-2"
166SLOT="0"
167IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static test"
168
169mysql_version_is_at_least "4.1" \
170&& IUSE="${IUSE} latin1"
171
172mysql_version_is_at_least "4.1.3" \
173&& IUSE="${IUSE} cluster extraengine"
174
175mysql_version_is_at_least "5.0" \
176|| IUSE="${IUSE} raid"
177
178mysql_version_is_at_least "5.0.18" \
179&& IUSE="${IUSE} max-idx-128"
180
181mysql_version_is_at_least "5.1" \
182|| IUSE="${IUSE} berkdb"
183
184[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
185&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
186
163# PBXT engine 187# PBXT engine
164mysql_version_is_at_least "5.1.12" \ 188mysql_version_is_at_least "5.1.12" \
165&& [[ -n "${PBXT_VERSION}" ]] \ 189&& [[ -n "${PBXT_VERSION}" ]] \
166&& PBXT_P="pbxt-${PBXT_VERSION}" \ 190&& PBXT_P="pbxt-${PBXT_VERSION}" \
167&& PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ 191&& PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
168&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" 192&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \
193&& IUSE="${IUSE} pbxt"
169 194
170# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set 195# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
171mysql_version_is_at_least "5.1.26" \ 196mysql_version_is_at_least "5.1.26" \
172&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ 197&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
173&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ 198&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \
174&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ 199&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
175&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" 200&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" \
176
177DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
178HOMEPAGE="http://www.mysql.com/"
179LICENSE="GPL-2"
180SLOT="0"
181IUSE="big-tables debug embedded minimal ${IUSE_DEFAULT_ON}perl selinux ssl static"
182
183mysql_version_is_at_least "4.1" \
184&& IUSE="${IUSE} latin1"
185
186mysql_version_is_at_least "4.1.3" \
187&& IUSE="${IUSE} cluster extraengine"
188
189mysql_version_is_at_least "5.0" \
190|| IUSE="${IUSE} raid"
191
192mysql_version_is_at_least "5.0.18" \
193&& IUSE="${IUSE} max-idx-128"
194
195mysql_version_is_at_least "5.1" \
196|| IUSE="${IUSE} berkdb"
197
198mysql_version_is_at_least "5.1.12" \
199&& [[ -n "${PBXT_VERSION}" ]] \
200&& IUSE="${IUSE} pbxt"
201
202mysql_version_is_at_least "5.1.26" \
203&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
204&& IUSE="${IUSE} xtradb" 201&& IUSE="${IUSE} xtradb"
205
206[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
207&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
208 202
209# 203#
210# HELPER FUNCTIONS: 204# HELPER FUNCTIONS:
211# 205#
212 206
482 # readline.h instead of history.h 476 # readline.h instead of history.h
483 myconf="${myconf} $(use_with ssl)" 477 myconf="${myconf} $(use_with ssl)"
484 myconf="${myconf} --enable-assembler" 478 myconf="${myconf} --enable-assembler"
485 myconf="${myconf} --with-geometry" 479 myconf="${myconf} --with-geometry"
486 myconf="${myconf} --with-readline" 480 myconf="${myconf} --with-readline"
487 myconf="${myconf} --with-row-based-replication"
488 myconf="${myconf} --with-zlib=/usr/$(get_libdir)" 481 myconf="${myconf} --with-zlib-dir=/usr/"
489 myconf="${myconf} --without-pstack" 482 myconf="${myconf} --without-pstack"
490 use max-idx-128 && myconf="${myconf} --with-max-indexes=128" 483 use max-idx-128 && myconf="${myconf} --with-max-indexes=128"
491 484
492 # 5.1 introduces a new way to manage storage engines (plugins) 485 # 5.1 introduces a new way to manage storage engines (plugins)
493 # like configuration=none 486 # like configuration=none
514 plugins="${plugins},ndbcluster" 507 plugins="${plugins},ndbcluster"
515 myconf="${myconf} --with-ndb-binlog" 508 myconf="${myconf} --with-ndb-binlog"
516 fi 509 fi
517 510
518 myconf="${myconf} --with-plugins=${plugins}" 511 myconf="${myconf} --with-plugins=${plugins}"
512}
513
514xtradb_applicable() {
515 mysql_version_is_at_least "5.1.26" \
516 && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
517 && use xtradb
518 return $?
519}
520
521pbxt_applicable() {
522 mysql_version_is_at_least "5.1.12" \
523 && [[ -n "${PBXT_VERSION}" ]] \
524 && use pbxt
525 return $?
519} 526}
520 527
521pbxt_src_configure() { 528pbxt_src_configure() {
522 mysql_init_vars 529 mysql_init_vars
523 530
604 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 611 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
605 612
606 mysql_check_version_range "4.0 to 5.0.99.99" \ 613 mysql_check_version_range "4.0 to 5.0.99.99" \
607 && use berkdb \ 614 && use berkdb \
608 && elog "Berkeley DB support is deprecated and will be removed in future versions!" 615 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
616
617 if [ "${PN}" != "mysql-cluster" ] && use cluster; then
618 ewarn "Upstream has noted that the NDB cluster support in the 5.0 and"
619 ewarn "5.1 series should NOT be put into production. In the near"
620 ewarn "future, it will be disabled from building."
621 ewarn ""
622 ewarn "If you need NDB support, you should instead move to the new"
623 ewarn "mysql-cluster package that represents that upstream NDB"
624 ewarn "development."
625 fi
609} 626}
610 627
611# @FUNCTION: mysql_src_unpack 628# @FUNCTION: mysql_src_unpack
612# @DESCRIPTION: 629# @DESCRIPTION:
613# Unpack the source code and call mysql_src_prepare for EAPI < 2. 630# Unpack the source code and call mysql_src_prepare for EAPI < 2.
642 # Now link in right patches 659 # Now link in right patches
643 mysql_mv_patches 660 mysql_mv_patches
644 # And apply 661 # And apply
645 epatch 662 epatch
646 663
664 # last -fPIC fixup, per bug #305873
665 i="${S}"/storage/innodb_plugin/plug.in
666 [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
667
647 # Additional checks, remove bundled zlib 668 # Additional checks, remove bundled zlib
648 rm -f "${S}/zlib/"*.[ch] 669 rm -f "${S}/zlib/"*.[ch]
649 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 670 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
650 rm -f "scripts/mysqlbug" 671 rm -f "scripts/mysqlbug"
651 672
664 rm -f "scripts/mysqlbug" 685 rm -f "scripts/mysqlbug"
665 fi 686 fi
666 687
667 local rebuilddirlist d 688 local rebuilddirlist d
668 689
669 if mysql_version_is_at_least "5.1.26" && use xtradb ; then 690 if xtradb_applicable ; then
670 einfo "Replacing InnoDB with Percona XtraDB" 691 einfo "Replacing InnoDB with Percona XtraDB"
671 pushd "${S}"/storage 692 pushd "${S}"/storage
672 i="innobase" 693 i="innobase"
673 o="${WORKDIR}/storage-${i}.mysql-upstream" 694 o="${WORKDIR}/storage-${i}.mysql-upstream"
674 # Have we been here already? 695 # Have we been here already?
778 find . -type f -name Makefile -print0 \ 799 find . -type f -name Makefile -print0 \
779 | xargs -0 -n100 sed -i \ 800 | xargs -0 -n100 sed -i \
780 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' 801 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
781 802
782 if [[ $EAPI == 2 ]]; then 803 if [[ $EAPI == 2 ]]; then
783 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_configure 804 pbxt_applicable && pbxt_src_configure
784 fi 805 fi
785} 806}
786 807
787# @FUNCTION: mysql_src_compile 808# @FUNCTION: mysql_src_compile
788# @DESCRIPTION: 809# @DESCRIPTION:
794 0 | 1) mysql_src_configure ;; 815 0 | 1) mysql_src_configure ;;
795 esac 816 esac
796 817
797 emake || die "emake failed" 818 emake || die "emake failed"
798 819
799 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_compile 820 pbxt_applicable && pbxt_src_compile
800} 821}
801 822
802# @FUNCTION: mysql_src_install 823# @FUNCTION: mysql_src_install
803# @DESCRIPTION: 824# @DESCRIPTION:
804# Install mysql. 825# Install mysql.
805mysql_src_install() { 826mysql_src_install() {
806 # Make sure the vars are correctly initialized 827 # Make sure the vars are correctly initialized
807 mysql_init_vars 828 mysql_init_vars
808 829
809 emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die "emake install failed" 830 emake install \
831 DESTDIR="${D}" \
832 benchdir_root="${MY_SHAREDSTATEDIR}" \
833 testroot="${MY_SHAREDSTATEDIR}" \
834 || die "emake install failed"
810 835
811 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_install 836 pbxt_applicable && pbxt_src_install
812 837
813 # Convenience links 838 # Convenience links
814 einfo "Making Convenience links for mysqlcheck multi-call binary" 839 einfo "Making Convenience links for mysqlcheck multi-call binary"
815 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" 840 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
816 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 841 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
820 einfo "Removing duplicate /usr/share/mysql files" 845 einfo "Removing duplicate /usr/share/mysql files"
821 rm -Rf "${D}/usr/share/info" 846 rm -Rf "${D}/usr/share/info"
822 for removeme in "mysql-log-rotate" mysql.server* \ 847 for removeme in "mysql-log-rotate" mysql.server* \
823 binary-configure* my-*.cnf mi_test_all* 848 binary-configure* my-*.cnf mi_test_all*
824 do 849 do
825 rm -f "${D}"/usr/share/mysql/${removeme} 850 rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme}
826 done 851 done
827 852
828 # Clean up stuff for a minimal build 853 # Clean up stuff for a minimal build
829 if use minimal ; then 854 if use minimal ; then
830 einfo "Remove all extra content for minimal build" 855 einfo "Remove all extra content for minimal build"
831 rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} 856 rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench}
832 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} 857 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}
833 rm -f "${D}/usr/sbin/mysqld" 858 rm -f "${D}/usr/sbin/mysqld"
834 rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a 859 rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
860 fi
861
862 # Unless they explicitly specific USE=test, then do not install the
863 # testsuite. It DOES have a use to be installed, esp. when you want to do a
864 # validation of your database configuration after tuning it.
865 if use !test ; then
866 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
835 fi 867 fi
836 868
837 # Configuration stuff 869 # Configuration stuff
838 if mysql_version_is_at_least "4.1" ; then 870 if mysql_version_is_at_least "4.1" ; then
839 mysql_mycnf_version="4.1" 871 mysql_mycnf_version="4.1"
870 done 902 done
871 fi 903 fi
872 904
873 # Docs 905 # Docs
874 einfo "Installing docs" 906 einfo "Installing docs"
875 dodoc README COPYING ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE 907 dodoc README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE
876 doinfo "${S}"/Docs/mysql.info 908 doinfo "${S}"/Docs/mysql.info
877 909
878 # Minimal builds don't have the MySQL server 910 # Minimal builds don't have the MySQL server
879 if ! use minimal ; then 911 if ! use minimal ; then
880 einfo "Including support files and sample configurations" 912 einfo "Including support files and sample configurations"
946 elog "\"emerge --config =${CATEGORY}/${PF}\"" 978 elog "\"emerge --config =${CATEGORY}/${PF}\""
947 elog "if this is a new install." 979 elog "if this is a new install."
948 einfo 980 einfo
949 fi 981 fi
950 982
951 if mysql_version_is_at_least "5.1.12" && use pbxt ; then 983 if pbxt_applicable ; then
952 # TODO: explain it better 984 # TODO: explain it better
953 elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';" 985 elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
954 elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;" 986 elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"
955 elog "if, after that, you cannot start the MySQL server," 987 elog "if, after that, you cannot start the MySQL server,"
956 elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then" 988 elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then"

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

  ViewVC Help
Powered by ViewVC 1.1.20