From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4FC2D138247 for ; Thu, 7 Nov 2013 19:44:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E577DE0869; Thu, 7 Nov 2013 19:44:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4443BE0869 for ; Thu, 7 Nov 2013 19:44:11 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 17E1A33F16F for ; Thu, 7 Nov 2013 19:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 91225E54D5 for ; Thu, 7 Nov 2013 19:44:08 +0000 (UTC) From: "Brian Evans" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Evans" Message-ID: <1383847114.132b9a5b9b01abffd15d12e3d57430a343425a8a.grknight.pub@gentoo> Subject: [gentoo-commits] proj/mysql:master commit in: eclass/ X-VCS-Repository: proj/mysql X-VCS-Files: eclass/mysql-cmake-multilib.eclass X-VCS-Directories: eclass/ X-VCS-Committer: grknight.pub X-VCS-Committer-Name: Brian Evans X-VCS-Revision: 132b9a5b9b01abffd15d12e3d57430a343425a8a X-VCS-Branch: master Date: Thu, 7 Nov 2013 19:44:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a6b4ce76-f73a-433d-901d-bf193a5ba0b3 X-Archives-Hash: 960265eb974c8642b745d17df9b6bce2 commit: 132b9a5b9b01abffd15d12e3d57430a343425a8a Author: Brian Evans tuffmail com> AuthorDate: Thu Nov 7 17:58:34 2013 +0000 Commit: Brian Evans lavabit com> CommitDate: Thu Nov 7 17:58:34 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mysql.git;a=commit;h=132b9a5b [cmake-multilib] Refactor multilib eclass to remove duplication of code when possible --- eclass/mysql-cmake-multilib.eclass | 384 ++----------------------------------- 1 file changed, 17 insertions(+), 367 deletions(-) diff --git a/eclass/mysql-cmake-multilib.eclass b/eclass/mysql-cmake-multilib.eclass index 8834c37..fc4da63 100644 --- a/eclass/mysql-cmake-multilib.eclass +++ b/eclass/mysql-cmake-multilib.eclass @@ -12,10 +12,10 @@ # @DESCRIPTION: # The mysql-cmake-multilib.eclass provides the support to build the mysql # ebuilds using the cmake build system. This eclass provides -# the src_unpack, src_prepare, src_configure, src_compile, scr_install, -# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. +# the src_prepare, src_configure, src_compile and src_install +# phase hooks. -inherit cmake-multilib flag-o-matic multilib prefix +inherit cmake-utils multilib-build flag-o-matic mysql-cmake # # HELPER FUNCTIONS: @@ -25,224 +25,7 @@ inherit cmake-multilib flag-o-matic multilib prefix # @DESCRIPTION: # Helper function to disable specific tests. mysql-cmake-multilib_disable_test() { - - local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir - rawtestname="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}'" - - testsuite="${rawtestname/.*}" - testname="${rawtestname/*.}" - for mysql_disabled_file in \ - ${S}/mysql-test/disabled.def \ - ${S}/mysql-test/t/disabled.def ; do - [[ -f ${mysql_disabled_file} ]] && break - done - #mysql_disabled_file="${S}/mysql-test/t/disabled.def" - #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" - echo ${testname} : ${reason} >> "${mysql_disabled_file}" - - if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then - for mysql_disabled_file in \ - ${S}/mysql-test/suite/${testsuite}/disabled.def \ - ${S}/mysql-test/suite/${testsuite}/t/disabled.def \ - FAILED ; do - [[ -f ${mysql_disabled_file} ]] && break - done - if [[ ${mysql_disabled_file} != "FAILED" ]]; then - echo "${testname} : ${reason}" >> "${mysql_disabled_file}" - else - for mysql_disabled_dir in \ - ${S}/mysql-test/suite/${testsuite} \ - ${S}/mysql-test/suite/${testsuite}/t \ - FAILED ; do - [[ -d ${mysql_disabled_dir} ]] && break - done - if [[ ${mysql_disabled_dir} != "FAILED" ]]; then - echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def" - else - ewarn "Could not find testsuite disabled.def location for ${rawtestname}" - fi - fi - fi -} - -# @FUNCTION: mysql-cmake_use_plugin -# @DESCRIPTION: -# Helper function to enable/disable plugins by use flags -# cmake-utils_use_with is not enough as some references check WITH_ (0|1) -# and some check WITHOUT_. Also, this can easily extend to non-storage plugins. -mysql-cmake_use_plugin() { - [[ -z $2 ]] && die "mysql-cmake_use_plugin " - if use $1 ; then - echo "-DWITH_$2=1" - else - echo "-DWITHOUT_$2=1 -DWITH_$2=0" - fi -} - -# @FUNCTION: configure_cmake_locale -# @DESCRIPTION: -# Helper function to configure locale cmake options -configure_cmake_locale() { - - if ! use minimal && [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi -} - -# @FUNCTION: configure_cmake_minimal -# @DESCRIPTION: -# Helper function to configure minimal build -configure_cmake_minimal() { - - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITHOUT_EMBEDDED_SERVER=1 - -DENABLED_LOCAL_INFILE=1 - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SSL=system - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DWITH_READLINE=0 - -DWITH_LIBEDIT=0 - -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 - -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 - -DWITHOUT_CSV_STORAGE_ENGINE=1 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 - -DWITHOUT_HEAP_STORAGE_ENGINE=1 - -DWITHOUT_INNOBASE_STORAGE_ENGINE=1 - -DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1 - -DWITHOUT_MYISAM_STORAGE_ENGINE=1 - -DWITHOUT_PARTITION_STORAGE_ENGINE=1 - -DWITHOUT_INNOBASE_STORAGE_ENGINE=1 - ) -} - -# @FUNCTION: configure_cmake_standard -# @DESCRIPTION: -# Helper function to configure standard build -configure_cmake_standard() { - - mycmakeargs+=( - -DENABLED_LOCAL_INFILE=1 - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock - -DWITH_READLINE=0 - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - ) - - mycmakeargs+=( - $(cmake-utils_use_disable !static SHARED) - $(cmake-utils_use_with debug) - $(cmake-utils_use_with embedded EMBEDDED_SERVER) - $(cmake-utils_use_with profiling) - $(cmake-utils_use_enable systemtap DTRACE) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use ssl; then - mycmakeargs+=( -DWITH_SSL=system ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - if use jemalloc; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - if use tcmalloc; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE) - ) - - if pbxt_available ; then - mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) ) - fi - - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then - mycmakeargs+=( - $(mysql-cmake_use_plugin oqgraph OQGRAPH) - $(mysql-cmake_use_plugin sphinx SPHINX) - $(mysql-cmake_use_plugin extraengine FEDERATEDX) - $(mysql-cmake_use_plugin tokudb TOKUDB) - $(mysql-cmake_use_plugin pam AUTH_PAM) - ) - - if use jemalloc ; then - mycmakeargs+=( -DWITH_JEMALLOC="system" ) - else - mycmakeargs+=( -DWITH_JEMALLOC=no ) - fi - - if mysql_version_is_at_least 10.0.5 ; then - # CassandraSE needs Apache Thrift which is not in portage - # TODO: Add use and deps for Connect SE external deps - mycmakeargs+= ( - -DWITHOUT_CASSANDRA=1 -DWITH_CASSANDRA=0 - $(mysql-cmake_use_plugin extraengine SEQUENCE) - $(mysql-cmake_use_plugin extraengine SPIDER) - $(mysql-cmake_use_plugin extraengine CONNECT) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML=0 - -DCONNECT_WITH_ODBC=0 - ) - fi - fi - - if [[ ${PN} == "percona-server" ]]; then - mycmakeargs+=( - $(cmake-utils_use_with pam) - ) - fi - - if [[ ${PN} == "mysql-cluster" ]]; then - # TODO: This really should include the following options, - # but the memcached package doesn't install the files it seeks. - # -DWITH_BUNDLED_MEMCACHED=OFF - # -DMEMCACHED_HOME=${EPREFIX}/usr - mycmakeargs+=( - -DWITH_BUNDLED_LIBEVENT=OFF - $(cmake-utils_use_with java NDB_JAVA) - ) - fi + mysql-cmake_disable_test "$@" } # @@ -256,44 +39,10 @@ mysql-cmake-multilib_src_prepare() { debug-print-function ${FUNCNAME} "$@" - cd "${S}" - - if [[ ${MY_EXTRAS_VER} != none ]]; then - - # Apply the patches for this MySQL version - EPATCH_SUFFIX="patch" - mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" - # Clean out old items - rm -f "${EPATCH_SOURCE}"/* - # Now link in right patches - mysql_mv_patches - # And apply - epatch - fi - - # last -fPIC fixup, per bug #305873 - i="${S}"/storage/innodb_plugin/plug.in - [[ -f ${i} ]] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" - - rm -f "scripts/mysqlbug" - if use jemalloc && ! ( [[ ${PN} == "mariadb" ]] && mysql_version_is_at_least "5.5.33" ); then - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - if use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - if has tokudb ${IUSE} ; then - # Don't build bundled xz-utils - rm -f "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" - touch "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" - fi - - epatch_user + mysql-cmake_src_prepare "$@" } -_cmake-multilib_src_configure() { +_mysql-multilib_src_configure() { debug-print-function ${FUNCNAME} "$@" @@ -330,7 +79,7 @@ _cmake-multilib_src_configure() { fi configure_cmake_locale - + if multilib_is_native_abi; then if use minimal ; then configure_cmake_minimal @@ -362,14 +111,16 @@ _cmake-multilib_src_configure() { cmake-utils_src_configure } + # @FUNCTION: mysql-cmake-multilib_src_configure # @DESCRIPTION: # Configure mysql to build the code for Gentoo respecting the use flags. mysql-cmake-multilib_src_configure() { - multilib_parallel_foreach_abi _cmake-multilib_src_configure "${@}" + multilib_parallel_foreach_abi _mysql-multilib_src_configure "${@}" } -_cmake-multilib_src_compile() { +_mysql-multilib_src_compile() { + if ! multilib_is_native_abi; then BUILD_DIR="${BUILD_DIR}/libmysql" cmake-utils_src_compile else @@ -384,123 +135,22 @@ mysql-cmake-multilib_src_compile() { debug-print-function ${FUNCNAME} "$@" - multilib_foreach_abi _cmake-multilib_src_compile "${@}" + multilib_foreach_abi _mysql-multilib_src_compile "${@}" } -_mysql-cmake-multilib_src_install() { - +_mysql-multilib_src_install() { debug-print-function ${FUNCNAME} "$@" - # Make sure the vars are correctly initialized - mysql_init_vars - - if ! multilib_is_native_abi; then + if multilib_is_native_abi; then + mysql-cmake_src_install + else BUILD_DIR="${BUILD_DIR}/libmysql" cmake-utils_src_install - return - fi - cmake-utils_src_install - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" - - # Create a mariadb_config symlink - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && dosym "/usr/bin/mysql_config" "/usr/bin/mariadb_config" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - rm -Rf "${ED}/usr/data" - - # Various junk (my-*.cnf moved elsewhere) - einfo "Removing duplicate /usr/share/mysql files" - - # Clean up stuff for a minimal build -# if use minimal ; then -# einfo "Remove all extra content for minimal build" -# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} -# rm -f "${ED}"/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} -# rm -f "${ED}/usr/sbin/mysqld" -# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a -# fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test fi - - # Configuration stuff - case ${MYSQL_PV_MAJOR} in - 5.[1-4]*) mysql_mycnf_version="5.1" ;; - 5.[5-9]|6*|7*|8*|9*|10*) mysql_mycnf_version="5.5" ;; - esac - einfo "Building default my.cnf (${mysql_mycnf_version})" - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - doins scripts/mysqlaccess.conf - mycnf_src="my.cnf-${mysql_mycnf_version}" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" my.cnf - - # Minimal builds don't have the MySQL server - if ! use minimal ; then - einfo "Creating initial directories" - # Empty directories ... - diropts "-m0750" - if [[ ${PREVIOUS_DATADIR} != "yes" ]] ; then - dodir "${MY_DATADIR#${EPREFIX}}" - keepdir "${MY_DATADIR#${EPREFIX}}" - chown -R mysql:mysql "${D}/${MY_DATADIR}" - fi - - diropts "-m0755" - for folder in "${MY_LOGDIR#${EPREFIX}}" ; do - dodir "${folder}" - keepdir "${folder}" - chown -R mysql:mysql "${ED}/${folder}" - done - fi - - # Minimal builds don't have the MySQL server - if ! use minimal ; then - einfo "Including support files and sample configurations" - docinto "support-files" - for script in \ - "${S}"/support-files/my-*.cnf.sh \ - "${S}"/support-files/magic \ - "${S}"/support-files/ndb-config-2-node.ini.sh - do - [[ -f $script ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}" - done - fi - - cat <<-EOF > "${T}"/80mysql-libdir - LDPATH="${EPREFIX}/usr/$(get_libdir)/mysql" - EOF - doenvd "${T}"/80mysql-libdir - - #Remove mytop if perl is not selected - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && ! use perl \ - && rm -f "${ED}/usr/bin/mytop" } # @FUNCTION: mysql-cmake-multilib_src_install # @DESCRIPTION: # Install mysql. mysql-cmake-multilib_src_install() { - multilib_foreach_abi _mysql-cmake-multilib_src_install "${@}" + multilib_foreach_abi _mysql-multilib_src_install "${@}" }