/[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.135
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.135 2010/03/03 23:57:13 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="http://www.primebase.org/download/${PBXT_P}.tar.gz 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}" \
199&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
200&& XTRADB_SRC_URI1="http://www.percona.com/percona-builds/xtradb/${XTRADB_SRC_URI_COMMON}" \
174&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ 201&& XTRADB_SRC_URI2="http://www.percona.com/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \
175&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" 202&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} )" \
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" 203&& IUSE="${IUSE} xtradb"
205
206[ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \
207&& IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling"
208 204
209# 205#
210# HELPER FUNCTIONS: 206# HELPER FUNCTIONS:
211# 207#
212 208
409 if use ssl ; then 405 if use ssl ; then
410 mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio" 406 mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio"
411 fi 407 fi
412 408
413 if mysql_version_is_at_least "5.1.11" ; then 409 if mysql_version_is_at_least "5.1.11" ; then
414 myconf="${myconf} $(use_with ssl)" 410 myconf="${myconf} $(use_with ssl /usr)"
415 else 411 else
416 myconf="${myconf} $(use_with ssl openssl)" 412 myconf="${myconf} $(use_with ssl openssl)"
417 fi 413 fi
418 414
419 if mysql_version_is_at_least "5.0.60" ; then 415 if mysql_version_is_at_least "5.0.60" ; then
482 # readline.h instead of history.h 478 # readline.h instead of history.h
483 myconf="${myconf} $(use_with ssl)" 479 myconf="${myconf} $(use_with ssl)"
484 myconf="${myconf} --enable-assembler" 480 myconf="${myconf} --enable-assembler"
485 myconf="${myconf} --with-geometry" 481 myconf="${myconf} --with-geometry"
486 myconf="${myconf} --with-readline" 482 myconf="${myconf} --with-readline"
487 myconf="${myconf} --with-row-based-replication"
488 myconf="${myconf} --with-zlib=/usr/$(get_libdir)" 483 myconf="${myconf} --with-zlib-dir=/usr/"
489 myconf="${myconf} --without-pstack" 484 myconf="${myconf} --without-pstack"
490 use max-idx-128 && myconf="${myconf} --with-max-indexes=128" 485 use max-idx-128 && myconf="${myconf} --with-max-indexes=128"
491 486
492 # 5.1 introduces a new way to manage storage engines (plugins) 487 # 5.1 introduces a new way to manage storage engines (plugins)
493 # like configuration=none 488 # like configuration=none
516 fi 511 fi
517 512
518 myconf="${myconf} --with-plugins=${plugins}" 513 myconf="${myconf} --with-plugins=${plugins}"
519} 514}
520 515
516xtradb_applicable() {
517 mysql_version_is_at_least "5.1.26" \
518 && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \
519 && use xtradb
520 return $?
521}
522
523pbxt_applicable() {
524 mysql_version_is_at_least "5.1.12" \
525 && [[ -n "${PBXT_VERSION}" ]] \
526 && use pbxt
527 return $?
528}
529
521pbxt_src_configure() { 530pbxt_src_configure() {
522 mysql_init_vars 531 mysql_init_vars
523 532
524 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null 533 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
525 534
526 einfo "Reconfiguring dir '${PWD}'" 535 einfo "Reconfiguring dir '${PWD}'"
527 AT_GNUCONF_UPDATE="yes" eautoreconf 536 AT_GNUCONF_UPDATE="yes" eautoreconf
528 537
529 local myconf="" 538 local myconf=""
530 myconf="${myconf} --with-mysql=${S} --libdir=${D}/${MY_LIBDIR}" 539 myconf="${myconf} --with-mysql=${S} --libdir=${MY_LIBDIR}"
531 use debug && myconf="${myconf} --with-debug=full" 540 use debug && myconf="${myconf} --with-debug=full"
532 # TODO: is it safe/needed to use econf here ? 541 # TODO: is it safe/needed to use econf here ?
533 ./configure ${myconf} || die "Problem configuring PBXT storage engine" 542 ./configure ${myconf} || die "Problem configuring PBXT storage engine"
534} 543}
535 544
545 # TODO: modify test suite for PBXT 554 # TODO: modify test suite for PBXT
546} 555}
547 556
548pbxt_src_install() { 557pbxt_src_install() {
549 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null 558 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
550 make install || die "Failed to install PBXT" 559 emake install DESTDIR="${D}" || die "Failed to install PBXT"
551 popd 560 popd
552} 561}
553 562
554# 563#
555# EBUILD FUNCTIONS 564# EBUILD FUNCTIONS
604 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 613 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
605 614
606 mysql_check_version_range "4.0 to 5.0.99.99" \ 615 mysql_check_version_range "4.0 to 5.0.99.99" \
607 && use berkdb \ 616 && use berkdb \
608 && elog "Berkeley DB support is deprecated and will be removed in future versions!" 617 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
618
619 if [ "${PN}" != "mysql-cluster" ] && use cluster; then
620 ewarn "Upstream has noted that the NDB cluster support in the 5.0 and"
621 ewarn "5.1 series should NOT be put into production. In the near"
622 ewarn "future, it will be disabled from building."
623 ewarn ""
624 ewarn "If you need NDB support, you should instead move to the new"
625 ewarn "mysql-cluster package that represents that upstream NDB"
626 ewarn "development."
627 fi
609} 628}
610 629
611# @FUNCTION: mysql_src_unpack 630# @FUNCTION: mysql_src_unpack
612# @DESCRIPTION: 631# @DESCRIPTION:
613# Unpack the source code and call mysql_src_prepare for EAPI < 2. 632# Unpack the source code and call mysql_src_prepare for EAPI < 2.
642 # Now link in right patches 661 # Now link in right patches
643 mysql_mv_patches 662 mysql_mv_patches
644 # And apply 663 # And apply
645 epatch 664 epatch
646 665
666 # last -fPIC fixup, per bug #305873
667 i="${S}"/storage/innodb_plugin/plug.in
668 [ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
669
647 # Additional checks, remove bundled zlib 670 # Additional checks, remove bundled zlib
648 rm -f "${S}/zlib/"*.[ch] 671 rm -f "${S}/zlib/"*.[ch]
649 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 672 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
650 rm -f "scripts/mysqlbug" 673 rm -f "scripts/mysqlbug"
651 674
664 rm -f "scripts/mysqlbug" 687 rm -f "scripts/mysqlbug"
665 fi 688 fi
666 689
667 local rebuilddirlist d 690 local rebuilddirlist d
668 691
669 if mysql_version_is_at_least "5.1.26" && use xtradb ; then 692 if xtradb_applicable ; then
670 einfo "Replacing InnoDB with Percona XtraDB" 693 einfo "Replacing InnoDB with Percona XtraDB"
671 pushd "${S}"/storage 694 pushd "${S}"/storage
672 i="innobase" 695 i="innobase"
673 o="${WORKDIR}/storage-${i}.mysql-upstream" 696 o="${WORKDIR}/storage-${i}.mysql-upstream"
674 # Have we been here already? 697 # Have we been here already?
675 [ -h "${i}" ] && rm -f "${i}" 698 [ -d "${o}" ] && rm -f "${i}"
676 # Or maybe we haven't 699 # Or maybe we haven't
677 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" 700 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
678 ln -s "${WORKDIR}/${XTRADB_P}" "${i}" 701 cp -ra "${WORKDIR}/${XTRADB_P}" "${i}"
679 popd 702 popd
680 fi 703 fi
681 704
682 if mysql_version_is_at_least "5.1.12" ; then 705 if mysql_version_is_at_least "5.1.12" ; then
683 einfo "Updating innobase cmake"
684 rebuilddirlist="." 706 rebuilddirlist="."
707 # This does not seem to be needed presently. robbat2 2010/02/23
708 #einfo "Updating innobase cmake"
685 # TODO: check this with a cmake expert 709 ## TODO: check this with a cmake expert
686 cmake \ 710 #cmake \
687 -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ 711 # -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \
688 -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ 712 # -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \
689 "storage/innobase" 713 # "storage/innobase"
690 else 714 else
691 rebuilddirlist=". innobase" 715 rebuilddirlist=". innobase"
692 fi 716 fi
693 717
694 for d in ${rebuilddirlist} ; do 718 for d in ${rebuilddirlist} ; do
778 find . -type f -name Makefile -print0 \ 802 find . -type f -name Makefile -print0 \
779 | xargs -0 -n100 sed -i \ 803 | xargs -0 -n100 sed -i \
780 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' 804 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
781 805
782 if [[ $EAPI == 2 ]]; then 806 if [[ $EAPI == 2 ]]; then
783 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_configure 807 pbxt_applicable && pbxt_src_configure
784 fi 808 fi
785} 809}
786 810
787# @FUNCTION: mysql_src_compile 811# @FUNCTION: mysql_src_compile
788# @DESCRIPTION: 812# @DESCRIPTION:
794 0 | 1) mysql_src_configure ;; 818 0 | 1) mysql_src_configure ;;
795 esac 819 esac
796 820
797 emake || die "emake failed" 821 emake || die "emake failed"
798 822
799 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_compile 823 pbxt_applicable && pbxt_src_compile
800} 824}
801 825
802# @FUNCTION: mysql_src_install 826# @FUNCTION: mysql_src_install
803# @DESCRIPTION: 827# @DESCRIPTION:
804# Install mysql. 828# Install mysql.
805mysql_src_install() { 829mysql_src_install() {
806 # Make sure the vars are correctly initialized 830 # Make sure the vars are correctly initialized
807 mysql_init_vars 831 mysql_init_vars
808 832
809 emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die "emake install failed" 833 emake install \
834 DESTDIR="${D}" \
835 benchdir_root="${MY_SHAREDSTATEDIR}" \
836 testroot="${MY_SHAREDSTATEDIR}" \
837 || die "emake install failed"
810 838
811 mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_install 839 pbxt_applicable && pbxt_src_install
812 840
813 # Convenience links 841 # Convenience links
814 einfo "Making Convenience links for mysqlcheck multi-call binary" 842 einfo "Making Convenience links for mysqlcheck multi-call binary"
815 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" 843 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
816 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 844 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
820 einfo "Removing duplicate /usr/share/mysql files" 848 einfo "Removing duplicate /usr/share/mysql files"
821 rm -Rf "${D}/usr/share/info" 849 rm -Rf "${D}/usr/share/info"
822 for removeme in "mysql-log-rotate" mysql.server* \ 850 for removeme in "mysql-log-rotate" mysql.server* \
823 binary-configure* my-*.cnf mi_test_all* 851 binary-configure* my-*.cnf mi_test_all*
824 do 852 do
825 rm -f "${D}"/usr/share/mysql/${removeme} 853 rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme}
826 done 854 done
827 855
828 # Clean up stuff for a minimal build 856 # Clean up stuff for a minimal build
829 if use minimal ; then 857 if use minimal ; then
830 einfo "Remove all extra content for minimal build" 858 einfo "Remove all extra content for minimal build"
831 rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} 859 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} 860 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" 861 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 862 rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
863 fi
864
865 # Unless they explicitly specific USE=test, then do not install the
866 # testsuite. It DOES have a use to be installed, esp. when you want to do a
867 # validation of your database configuration after tuning it.
868 if use !test ; then
869 rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
835 fi 870 fi
836 871
837 # Configuration stuff 872 # Configuration stuff
838 if mysql_version_is_at_least "4.1" ; then 873 if mysql_version_is_at_least "4.1" ; then
839 mysql_mycnf_version="4.1" 874 mysql_mycnf_version="4.1"
870 done 905 done
871 fi 906 fi
872 907
873 # Docs 908 # Docs
874 einfo "Installing docs" 909 einfo "Installing docs"
875 dodoc README COPYING ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE 910 dodoc README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE
876 doinfo "${S}"/Docs/mysql.info 911 doinfo "${S}"/Docs/mysql.info
877 912
878 # Minimal builds don't have the MySQL server 913 # Minimal builds don't have the MySQL server
879 if ! use minimal ; then 914 if ! use minimal ; then
880 einfo "Including support files and sample configurations" 915 einfo "Including support files and sample configurations"
882 for script in \ 917 for script in \
883 "${S}"/support-files/my-*.cnf \ 918 "${S}"/support-files/my-*.cnf \
884 "${S}"/support-files/magic \ 919 "${S}"/support-files/magic \
885 "${S}"/support-files/ndb-config-2-node.ini 920 "${S}"/support-files/ndb-config-2-node.ini
886 do 921 do
887 dodoc "${script}" 922 [[ -f "$script" ]] && dodoc "${script}"
888 done 923 done
889 924
890 docinto "scripts" 925 docinto "scripts"
891 for script in "${S}"/scripts/mysql* ; do 926 for script in "${S}"/scripts/mysql* ; do
892 [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" 927 [[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}"
893 done 928 done
894 929
895 fi 930 fi
896 931
897 mysql_lib_symlinks "${D}" 932 mysql_lib_symlinks "${D}"
946 elog "\"emerge --config =${CATEGORY}/${PF}\"" 981 elog "\"emerge --config =${CATEGORY}/${PF}\""
947 elog "if this is a new install." 982 elog "if this is a new install."
948 einfo 983 einfo
949 fi 984 fi
950 985
951 if mysql_version_is_at_least "5.1.12" && use pbxt ; then 986 if pbxt_applicable ; then
952 # TODO: explain it better 987 # TODO: explain it better
953 elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';" 988 elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
954 elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;" 989 elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"
955 elog "if, after that, you cannot start the MySQL server," 990 elog "if, after that, you cannot start the MySQL server,"
956 elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then" 991 elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then"

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

  ViewVC Help
Powered by ViewVC 1.1.20