--- /usr/portage/eclass/mysql.eclass 2010-02-01 02:08:45.000000000 +0100 +++ mysql.eclass 2010-02-01 07:14:49.174800340 +0100 @@ -63,6 +63,7 @@ # We also strip off upstream's trailing letter that they use to respin tarballs MYSQL_VERSION_ID="" +MY_PV="${PV/pre/m}" tpv="${PV%[a-z]}" tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" for vatom in 0 1 2 3 ; do @@ -87,6 +88,8 @@ MYSQL_COMMUNITY_FEATURES=1 elif [ "${PV#5.4}" != "${PV}" ]; then MYSQL_COMMUNITY_FEATURES=1 +elif [ "${PV#5.5}" != "${PV}" ]; then + MYSQL_COMMUNITY_FEATURES=1 else MYSQL_COMMUNITY_FEATURES=0 fi @@ -138,10 +141,10 @@ if [ -z "${SERVER_URI}" ]; then # The community build is on the mirrors if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then - SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${PV//_/-}.tar.gz" + SERVER_URI="mirror://mysql/Downloads/MySQL-${MY_PV%.*}/mysql-${MY_PV//_/-}.tar.gz" # The (old) enterprise source is on the primary site only elif [ "${PN}" == "mysql" ]; then - SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${PV//_/-}.tar.gz" + SERVER_URI="ftp://ftp.mysql.com/pub/mysql/src/mysql-${MY_PV//_/-}.tar.gz" fi fi @@ -155,19 +158,11 @@ http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" -# PBXT engine -mysql_version_is_at_least "5.1.12" \ -&& [[ -n "${PBXT_VERSION}" ]] \ -&& PBXT_P="pbxt-${PBXT_VERSION}" \ -&& PBXT_SRC_URI="mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ -&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" - -# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set -mysql_version_is_at_least "5.1.26" \ -&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ -&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ -&& XTRADB_SRC_URI="http://www.percona.com/${PN}/xtradb/${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ -&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI} )" +for str in ${MYSQL_STORAGE} ; do + STORAGE_USE="${str/-*/}" + SRC_URI="${SRC_URI} ${STORAGE_USE}? ( http://ftp.mars.arge.at/mysql/mysql-storage-${str}.tar.gz )" + STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}" +done DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." HOMEPAGE="http://www.mysql.com/" @@ -190,17 +185,14 @@ mysql_version_is_at_least "5.1" \ || IUSE="${IUSE} berkdb" -mysql_version_is_at_least "5.1.12" \ -&& [[ -n "${PBXT_VERSION}" ]] \ -&& IUSE="${IUSE} pbxt" - mysql_version_is_at_least "5.1.26" \ -&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] \ -&& IUSE="${IUSE} xtradb" +&& IUSE="${IUSE} innodb xtradb dynamicplugins" [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ] \ && IUSE="${IUSE} ${IUSE_DEFAULT_ON}community profiling" +IUSE="${IUSE} ${STORAGE_IUSE}" + # # HELPER FUNCTIONS: # @@ -479,15 +471,14 @@ myconf="${myconf} --enable-assembler" myconf="${myconf} --with-geometry" myconf="${myconf} --with-readline" - myconf="${myconf} --with-row-based-replication" - myconf="${myconf} --with-zlib=/usr/$(get_libdir)" + myconf="${myconf} --with-zlib-dir=/usr" myconf="${myconf} --without-pstack" use max-idx-128 && myconf="${myconf} --with-max-indexes=128" - # 5.1 introduces a new way to manage storage engines (plugins) + # 5.1 introduces a new way to manage storage engines (plugins) # like configuration=none local plugins="csv,myisam,myisammrg,heap" - if use extraengine ; then + if use extraengine && ! use dynamicplugins ; then # like configuration=max-no-ndb, archive and example removed in 5.1.11 plugins="${plugins},archive,blackhole,example,federated,partition" @@ -504,44 +495,29 @@ myconf="${myconf} --with-ndb-binlog" fi - if mysql_version_is_at_least "5.2" ; then + if mysql_version_is_at_least "6.0" ; then plugins="${plugins},falcon" fi - myconf="${myconf} --with-plugins=${plugins}" -} - -pbxt_src_configure() { - mysql_init_vars - - pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null - - einfo "Reconfiguring dir '${PWD}'" - AT_GNUCONF_UPDATE="yes" eautoreconf - - local myconf="" - myconf="${myconf} --with-mysql=${S} --libdir=${D}/${MY_LIBDIR}" - use debug && myconf="${myconf} --with-debug=full" - # TODO: is it safe/needed to use econf here ? - ./configure ${myconf} || die "Problem configuring PBXT storage engine" -} - -pbxt_src_compile() { - # Be backwards compatible for now - if [[ $EAPI != 2 ]]; then - pbxt_src_configure - fi - # TODO: is it safe/needed to use emake here ? - make || die "Problem making PBXT storage engine (${myconf})" - - popd - # TODO: modify test suite for PBXT -} + for str in ${STORAGE_IUSE} ; do + if use ${str} ; then + # don't confuse autoconf by specifying the plugins to or more times + if ! use dynamicplugins ; then + [[ -d storage/${str} ]] && plugins="${plugins},${str}" + fi + # suppress error message + [[ ${str} = "innodb" ]] && str="innobase" + [[ ${str} = "xtradb" ]] && str="innobase" + [[ ! -d storage/${str} ]] && eerror "use ${str} but no ${str} plugin" + if [ -e storage/${str}/setup.sh ]; then + pushd storage/${str} + sh setup.sh + popd + fi + fi + done -pbxt_src_install() { - pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null - make install || die "Failed to install PBXT" - popd + myconf="${myconf} --with-plugins=${plugins}" } # @@ -609,6 +585,22 @@ mysql_init_vars unpack ${A} + + for str in ${MYSQL_STORAGE} ; do + storage_name="${str/-*/}" + if use ${storage_name} ; then + einfo "Moving ${str/-/ Storage Engine Version } in place" + pushd "${WORKDIR}/${MY_SOURCEDIR}"/storage + i="${WORKDIR}/mysql-storage-${str}" + o="${storage_name}" + # Have we been here already ? or are we updating the included engine ! + [ -h "${o}" ] && rm -f "${o}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && cp -R "${i}"/* "${WORKDIR}/${MY_SOURCEDIR}" + popd + fi + done + # Grab the patches [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack @@ -659,16 +651,47 @@ local rebuilddirlist d - if mysql_version_is_at_least "5.1.26" && use xtradb ; then + + + if mysql_version_is_at_least "5.1.26" && use xtradb && use innodb ; then + eerror "Percona XtraDB and Innobase innoDB can not be insalled at the same time." + elif mysql_version_is_at_least "5.1.26" && use xtradb && ! use innodb ; then einfo "Replacing InnoDB with Percona XtraDB" + einfo "Removing InnoDB Plugin Storage Engine" + pushd "${S}"/storage + # the innodb_plugin is a reason for compile errors if we replace innobase + i="innodb_plugin" + o="${WORKDIR}/storage-${i}.mysql-upstream" + # Have we been here already? + [ -h "${i}" ] && rm -f "${i}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" + i="innobase" + o="${WORKDIR}/storage-${i}.mysql-upstream" + # Have we been here already? + [ -h "${i}" ] && rm -f "${i}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" + mv -f "xtradb" "${i}" + popd + elif mysql_version_is_at_least "5.1.26" && use innodb && ! use xtradb ; then + einfo "Replacing InnoDB with Innobase innoDB" + einfo "Removing InnoDB Plugin Storage Engine" pushd "${S}"/storage + # the innodb_plugin is a reason for compile errors if we replace innobase + i="innodb_plugin" + o="${WORKDIR}/storage-${i}.mysql-upstream" + # Have we been here already? + [ -h "${i}" ] && rm -f "${i}" + # Or maybe we haven't + [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" i="innobase" o="${WORKDIR}/storage-${i}.mysql-upstream" # Have we been here already? [ -h "${i}" ] && rm -f "${i}" # Or maybe we haven't [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" - ln -s "${WORKDIR}/${XTRADB_P}" "${i}" + mv -f "innodb" "${i}" popd fi @@ -771,10 +794,6 @@ find . -type f -name Makefile -print0 \ | xargs -0 -n100 sed -i \ -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' - - if [[ $EAPI == 2 ]]; then - mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_configure - fi } # @FUNCTION: mysql_src_compile @@ -788,8 +807,6 @@ esac emake || die "emake failed" - - mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_compile } # @FUNCTION: mysql_src_install @@ -801,8 +818,6 @@ emake install DESTDIR="${D}" benchdir_root="${MY_SHAREDSTATEDIR}" || die "emake install failed" - mysql_version_is_at_least "5.1.12" && use pbxt && pbxt_src_install - # Convenience links einfo "Making Convenience links for mysqlcheck multi-call binary" dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" @@ -941,21 +956,6 @@ einfo fi - if mysql_version_is_at_least "5.1.12" && use pbxt ; then - # TODO: explain it better - elog " mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';" - elog " mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;" - elog "if, after that, you cannot start the MySQL server," - elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then" - elog "use the MySQL upgrade script to restore the table" - elog "or execute the following SQL command:" - elog " CREATE TABLE IF NOT EXISTS plugin (" - elog " name char(64) binary DEFAULT '' NOT NULL," - elog " dl char(128) DEFAULT '' NOT NULL," - elog " PRIMARY KEY (name)" - elog " ) CHARACTER SET utf8 COLLATE utf8_bin;" - fi - mysql_check_version_range "4.0 to 5.0.99.99" \ && use berkdb \ && elog "Berkeley DB support is deprecated and will be removed in future versions!"