--- /var/lib/layman/mysql-overlay/eclass/mysql.eclass 2010-04-29 20:11:37.345620519 +0200 +++ mysql.eclass 2010-05-30 08:45:24.424441764 +0200 @@ -40,6 +40,7 @@ pkg_preinst pkg_postinst \ pkg_config pkg_postrm IUSE_DEFAULT_ON='+' + IUSE_DEFAULT_OFF='-' ;; 0 | 1) EXPORT_FUNCTIONS pkg_setup \ @@ -103,16 +104,6 @@ MYSQL_COMMUNITY_FEATURES=0 fi -# @ECLASS-VARIABLE: XTRADB_VER -# @DESCRIPTION: -# Version of the XTRADB storage engine -XTRADB_VER="${XTRADB_VER}" - -# @ECLASS-VARIABLE: PERCONA_VER -# @DESCRIPTION: -# Designation by PERCONA for a MySQL version to apply an XTRADB release -PERCONA_VER="${PERCONA_VER}" - # Be warned, *DEPEND are version-dependant # These are used for both runtime and compiletime DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) @@ -170,7 +161,7 @@ fi # Define correct SRC_URIs -SRC_URI="${SERVER_URI}" +SRC_URI="${SERVER_URI} ${GO_MYSQL_PATCHES}" # Gentoo patches to MySQL [[ ${MY_EXTRAS_VER} != live ]] \ @@ -179,6 +170,13 @@ http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" +for str in ${MYSQL_STORAGE} ; do + STORAGE_USE="${str/-*/}" + SRC_URI="${SRC_URI} http://ftp.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz" + STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}" +# IUSE="{IUSE} ${IUSE_DEFAULT_OFF}${STORAGE_USE}" +done + DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." HOMEPAGE="http://www.mysql.com/" if [[ "${PN}" == "mariadb" ]]; then @@ -213,55 +211,10 @@ [[ "${PN}" == "mariadb" ]] \ && IUSE="${IUSE} libevent" -# MariaDB has integrated PBXT -# PBXT_VERSION means that we have a PBXT patch for this PV -# PBXT was only introduced after 5.1.12 -pbxt_patch_available() { - [[ "${PN}" != "mariadb" ]] \ - && mysql_version_is_at_least "5.1.12" \ - && [[ -n "${PBXT_VERSION}" ]] - return $? -} - -pbxt_available() { - pbxt_patch_available || [[ "${PN}" == "mariadb" ]] - return $? -} - -# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set -# MariaDB has integrated XtraDB -# XTRADB_VERS means that we have a XTRADB patch for this PV -# XTRADB was only introduced after 5.1.26 -xtradb_patch_available() { - [[ "${PN}" != "mariadb" ]] \ - && mysql_version_is_at_least "5.1.26" \ - && [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]] - return $? -} - +[[ "${PN}" == "mariadb" ]] \ +&& STORAGE_IUSE="${STORAGE_IUSE} pbxt xtradb" -pbxt_patch_available \ -&& PBXT_P="pbxt-${PBXT_VERSION}" \ -&& PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \ -&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \ - -# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins -# vs. built outside the dir -pbxt_available \ -&& IUSE="${IUSE} pbxt" \ -&& mysql_version_is_at_least "5.1.40" \ -&& PBXT_NEWSTYLE=1 - -xtradb_patch_available \ -&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \ -&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \ -&& XTRADB_SRC_B1="http://www.percona.com/" \ -&& XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" \ -&& XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" \ -&& XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" \ -&& XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \ -&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" \ -&& IUSE="${IUSE} xtradb" +IUSE="${IUSE} ${STORAGE_IUSE}" # # HELPER FUNCTIONS: @@ -589,7 +542,7 @@ # not added yet: ibmdb2i # Not supporting as examples: example,daemon_example,ftexample plugins_sta="${plugins_sta} partition" - plugins_dyn="${plugins_sta} federated" + plugins_dyn="${plugins_dyn} federated" if [[ "${PN}" != "mariadb" ]] ; then elog "Before using the Federated storage engine, please be sure to read" @@ -623,18 +576,34 @@ if [[ "${PN}" == "mariadb" ]] ; then # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not # caught above. - plugins_sta="${plugins_sta},maria,innobase" + plugins_sta="${plugins_sta} maria innobase" myconf="${myconf} $(use_with libevent)" # This is not optional, without it several upstream testcases fail. # Also strongly recommended by upstream. myconf="${myconf} --with-maria-tmp-tables" fi - if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then - use pbxt \ - && plugins_dyn="${plugins_dyn} pbxt" \ - || plugins_dis="${plugins_dis} pbxt" - fi + for str in ${STORAGE_IUSE} ; do + if use ${str} ; then + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_dyn="${plugins_dyn} ${str}" + elif ! use ${str} ; then + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_dis="${plugins_dis} ${str}" + else + # don't confuse autoconf by specifying the plugins two or more times + [[ -e "${S}"/storage/${str} ]] && plugins_sta="${plugins_sta} ${str}" + fi + # suppress error message + [[ ${str} = "innodb" ]] && str="innobase" + [[ ${str} = "xtradb" ]] && str="innobase" + [[ ! -e "${S}"/storage/${str} ]] && eerror "use ${str} but no ${str} plugin" + if [ -e "${S}"/storage/${str}/setup.sh ]; then + pushd storage/${str} + sh setup.sh + popd + fi + done use static && \ plugins_sta="${plugins_sta} ${plugins_dyn}" && \ @@ -653,39 +622,6 @@ done } -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=/usr/$(get_libdir)" - use debug && myconf="${myconf} --with-debug=full" - econf ${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 -} - -pbxt_src_install() { - pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null - emake install DESTDIR="${D}" || die "Failed to install PBXT" - popd -} - # # EBUILD FUNCTIONS # @@ -727,15 +663,6 @@ eerror "${M}" die "${M}" fi - - if mysql_version_is_at_least "5.1" \ - && xtradb_patch_available \ - && use xtradb \ - && use embedded ; then - M="USE flags 'xtradb' and 'embedded' conflict and cause build failures" - eerror "${M}" - die "${M}" - fi # Bug #290570, 284946, 307251 # Upstream changes made us need a fairly new GCC4. @@ -778,6 +705,20 @@ mysql_init_vars unpack ${A} + + for str in ${MYSQL_STORAGE} ; do + storage_name="${str/-*/}" + 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 + done + # Grab the patches [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack @@ -800,7 +741,7 @@ EPATCH_SUFFIX="patch" mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" # Clean out old items - rm -f "${EPATCH_SOURCE}"/* + #rm -f "${EPATCH_SOURCE}"/* # Now link in right patches mysql_mv_patches # And apply @@ -832,26 +773,48 @@ local rebuilddirlist d - if xtradb_patch_available && use xtradb ; then - einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)" - pushd "${S}"/storage >/dev/null + 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? - [ -d "${o}" ] && rm -f "${i}" + [ -h "${i}" ] && rm -f "${i}" # Or maybe we haven't [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" - cp -ral "${WORKDIR}/${XTRADB_P}" "${i}" - popd >/dev/null - fi - - if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then - einfo "Adding storage engine: PBXT" - pushd "${S}"/storage >/dev/null - i='pbxt' - [ -d "${i}" ] && rm -rf "${i}" - cp -ral "${WORKDIR}/${PBXT_P}" "${i}" - popd >/dev/null + mv -f "xtradb" "${i}" + rm -rf "innodb" + 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}" + mv -f "innodb" "${i}" + rm -rf "xtradb" + popd fi if mysql_version_is_at_least "5.1.12" ; then @@ -954,10 +917,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 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then - pbxt_patch_available && use pbxt && pbxt_src_configure - fi } # @FUNCTION: mysql_src_compile @@ -971,10 +930,6 @@ esac emake || die "emake failed" - - if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then - pbxt_patch_available && use pbxt && pbxt_src_compile - fi } # @FUNCTION: mysql_src_install @@ -990,10 +945,6 @@ testroot="${MY_SHAREDSTATEDIR}" \ || die "emake install failed" - if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then - pbxt_patch_available && use pbxt && pbxt_src_install - fi - # Convenience links einfo "Making Convenience links for mysqlcheck multi-call binary" dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" @@ -1146,7 +1097,7 @@ einfo fi - if pbxt_available && use pbxt ; then + if 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;"