maatkit-7540-r1.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit perl-app perl-module toolchain-funcs
  5. DESCRIPTION="essential command-line utilities for MySQL"
  6. HOMEPAGE="http://www.maatkit.org/"
  7. SRC_URI="https://maatkit.googlecode.com/files/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux ~ppc-macos"
  11. IUSE="udf"
  12. COMMON_DEPEND="dev-perl/DBI
  13. dev-perl/DBD-mysql
  14. virtual/perl-Time-HiRes"
  15. RDEPEND="${COMMON_DEPEND}
  16. virtual/perl-Getopt-Long
  17. virtual/perl-Time-Local
  18. virtual/perl-Digest-MD5
  19. virtual/perl-IO-Compress
  20. virtual/perl-File-Temp
  21. virtual/perl-File-Spec
  22. virtual/perl-Time-HiRes
  23. virtual/perl-Scalar-List-Utils
  24. dev-perl/TermReadKey"
  25. DEPEND="${COMMON_DEPEND}
  26. udf? ( dev-db/mysql )
  27. virtual/perl-ExtUtils-MakeMaker"
  28. mysql-udf_src_compile() {
  29. local udfdir="${T}/udf/"
  30. mkdir -p "${udfdir}"
  31. local udfname udffile udfext udfoutpath
  32. udfname="${1}"
  33. udfext=".so"
  34. udffile="${udfname}${udfext}"
  35. udfoutpath="${udfdir}/${udffile}"
  36. shift
  37. CXX="$(tc-getCXX)"
  38. local src="$@"
  39. if [ -z "$@" ]; then
  40. src="${udfname}.cc"
  41. fi
  42. for f in ${src} ; do
  43. [ -f "${f}" ] || \
  44. die "UDF ${udfname}: Cannot find source file ${f} to compile"
  45. done
  46. einfo "UDF ${udfname}: compiling from ${src}"
  47. ${CXX} \
  48. ${CXXFLAGS} -I/usr/include/mysql \
  49. ${LDFLAGS} -fPIC -shared -o "${udfoutpath}" $src \
  50. || die "UDF ${udfname}: Failed to compile"
  51. }
  52. mysql-udf_src_install() {
  53. local udfdir="${T}/udf/"
  54. local udfname udfext udffile udfoutpath
  55. udfname="${1}"
  56. udfext=".so"
  57. udffile="${udfname}${udfext}"
  58. udfoutpath="${udfdir}/${udffile}"
  59. insinto /usr/$(get_libdir)/mysql/plugins
  60. doins "${udfoutpath}"
  61. }
  62. udf_done_intro=0
  63. mysql-udf_pkg_postinst() {
  64. local udfname udffile udfext udffunc udfreturn
  65. udfname="${1}"
  66. udfext=".so"
  67. udffile="${udfname}${udfext}"
  68. udffunc="${2}"
  69. udfreturn="${3}"
  70. if [ ${udf_done_intro} -eq 0 ]; then
  71. elog "To use the UDFs that were built:"
  72. elog "Update your configuration to include 'plugin_dir=/usr/$(get_libdir)/mysql/plugins'"
  73. elog "Issue the following commands as a user with FUNCTION privileges:"
  74. udf_done_intro=1
  75. fi
  76. elog "CREATE FUNCTION ${udffunc} RETURNS ${udfreturn} SONAME '${udffile}'"
  77. }
  78. src_compile() {
  79. perl-app_src_compile
  80. if use udf; then
  81. cd "${S}"/udf
  82. mysql-udf_src_compile murmur_udf
  83. mysql-udf_src_compile fnv_udf
  84. fi
  85. }
  86. src_install() {
  87. perl-module_src_install
  88. if use udf; then
  89. mysql-udf_src_install murmur_udf
  90. mysql-udf_src_install fnv_udf
  91. fi
  92. }
  93. pkg_postinst() {
  94. if use udf; then
  95. mysql-udf_pkg_postinst murmur_udf murmur_hash INTEGER
  96. mysql-udf_pkg_postinst fnv_udf fnv_64 INTEGER
  97. fi
  98. }