/[gentoo-x86]/eclass/mysql.eclass
Gentoo

Diff of /eclass/mysql.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.50 Revision 1.51
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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.50 2006/12/16 12:34:29 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.51 2006/12/29 20:34:02 vivo Exp $
4 4
5# Author: Francesco Riosa <vivo@gentoo.org> 5# Author: Francesco Riosa <vivo@gentoo.org>
6# Maintainer: Luca Longinotti <chtekk@gentoo.org> 6# Maintainer: Luca Longinotti <chtekk@gentoo.org>
7 7
8# Both MYSQL_VERSION_ID and MYSQL_PATCHSET_REV must be set in the ebuild too 8# Both MYSQL_VERSION_ID and MYSQL_PATCHSET_REV must be set in the ebuild too
97 pkg_postinst pkg_config pkg_postrm 97 pkg_postinst pkg_config pkg_postrm
98 98
99# 99#
100# HELPER FUNCTIONS: 100# HELPER FUNCTIONS:
101# 101#
102
103bitkeeper_fetch() {
104
105 local tpv=( ${PV//[-._]/ } )
106 local reposuf="${tpv[0]}.${tpv[1]}"
107 useq "cluster" && reposuf="${reposuf}-ndb"
108 local repo_uri="bk://mysql.bkbits.net/mysql-${reposuf}"
109 ## -- ebk_store_dir: bitkeeper sources store directory
110 local ebk_store_dir="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bk-src"
111 ## -- ebk_fetch_cmd: bitkeeper fetch command
112 # always fetch the latest revision, use -r<revision> if a specified revision is wanted
113 # hint: does not work
114 local ebk_fetch_cmd="sfioball"
115 ## -- ebk_update_cmd: bitkeeper update command
116 local ebk_update_cmd="update"
117
118 #addread "/etc/bitkeeper"
119 addwrite "${ebk_store_dir}"
120
121 if [[ ! -d "${ebk_store_dir}" ]]; then
122 debug-print "${FUNCNAME}: initial checkout. creating bitkeeper directory"
123 mkdir -p "${ebk_store_dir}" || die "${EBK}: can't mkdir ${ebk_store_dir}."
124 fi
125
126 pushd "${ebk_store_dir}" || die "${EBK}: can't chdir to ${ebk_store_dir}"
127
128 local wc_path=mysql-${reposuf}
129
130 if [[ ! -d "${wc_path}" ]]; then
131 local options="-r+"
132 # first check out
133 einfo "bitkeeper check out start -->"
134 einfo " repository: ${repo_uri}"
135 ${ebk_fetch_cmd} ${options} "${repo_uri}" ${wc_path} \
136 || die "${EBK}: can't fetch from ${repo_uri}."
137 else
138 if [[ ! -d "${wc_path}/BK" ]]; then
139 popd
140 die "Look like ${wc_path} is not a bitkeeper path."
141 fi
142
143 # update working copy
144 einfo "bitkeeper update start -->"
145 einfo " repository: ${repo_uri}"
146
147 ${ebk_update_cmd} "${repo_uri}" "${wc_path}" \
148 || die "BK: can't update from ${repo_uri} to ${wc_path}."
149
150 fi
151
152 einfo " working copy: ${wc_path}"
153 cd "${wc_path}"
154 rsync -rlpgo --exclude="BK/" . "${S}" || die "BK: can't export to ${S}."
155
156 echo
157 popd
158
159}
160
161mysql_disable_test() {
162 local testname="${1}" ; shift
163 local reason="${@}"
164 local mysql_disable_file="${S}/mysql-test/t/disabled.def"
165 echo ${testname} : ${reason} >> "${mysql_disable_file}"
166 ewarn "test \"${testname}\" disabled because: \"${reason}\""
167}
102 168
103# void mysql_init_vars() 169# void mysql_init_vars()
104# 170#
105# Initialize global variables 171# Initialize global variables
106# 2005-11-19 <vivo@gentoo.org> 172# 2005-11-19 <vivo@gentoo.org>
203 269
204 if useq "debug" ; then 270 if useq "debug" ; then
205 myconf="${myconf} --with-debug=full" 271 myconf="${myconf} --with-debug=full"
206 else 272 else
207 myconf="${myconf} --without-debug" 273 myconf="${myconf} --without-debug"
208 mysql_version_is_at_least "4.01.03.00" \ 274 mysql_version_is_at_least "4.1.3" \
209 && useq "cluster" \ 275 && useq "cluster" \
210 && myconf="${myconf} --without-ndb-debug" 276 && myconf="${myconf} --without-ndb-debug"
211 fi 277 fi
212 278
213 if mysql_version_is_at_least "4.01.00.00" && ! useq "latin1" ; then 279 if mysql_version_is_at_least "4.1" && ! useq "latin1" ; then
214 myconf="${myconf} --with-charset=utf8" 280 myconf="${myconf} --with-charset=utf8"
215 myconf="${myconf} --with-collation=utf8_general_ci" 281 myconf="${myconf} --with-collation=utf8_general_ci"
216 else 282 else
217 myconf="${myconf} --with-charset=latin1" 283 myconf="${myconf} --with-charset=latin1"
218 myconf="${myconf} --with-collation=latin1_swedish_ci" 284 myconf="${myconf} --with-collation=latin1_swedish_ci"
232 myconf="${myconf} $(use_with perl bench)" 298 myconf="${myconf} $(use_with perl bench)"
233 myconf="${myconf} --enable-assembler" 299 myconf="${myconf} --enable-assembler"
234 myconf="${myconf} --with-extra-tools" 300 myconf="${myconf} --with-extra-tools"
235 myconf="${myconf} --with-innodb" 301 myconf="${myconf} --with-innodb"
236 myconf="${myconf} --without-readline" 302 myconf="${myconf} --without-readline"
237 mysql_version_is_at_least "5.00.00.00" || myconf="${myconf} $(use_with raid)" 303 mysql_version_is_at_least "5.0" || myconf="${myconf} $(use_with raid)"
238 304
239 if useq "ssl" ; then 305 if useq "ssl" ; then
240 # --with-vio is not needed anymore, it's on by default and 306 # --with-vio is not needed anymore, it's on by default and
241 # has been removed from configure 307 # has been removed from configure
242 mysql_version_is_at_least "5.00.04.00" || myconf="${myconf} --with-vio" 308 mysql_version_is_at_least "5.0.4" || myconf="${myconf} --with-vio"
243 if mysql_version_is_at_least "5.00.06.00" ; then 309 if mysql_version_is_at_least "5.0.6" ; then
244 # myconf="${myconf} --with-yassl" 310 # myconf="${myconf} --with-yassl"
245 myconf="${myconf} --with-openssl" 311 myconf="${myconf} --with-openssl"
246 else 312 else
247 myconf="${myconf} --with-openssl" 313 myconf="${myconf} --with-openssl"
248 fi 314 fi
262 else 328 else
263 myconf="${myconf} --without-berkeley-db" 329 myconf="${myconf} --without-berkeley-db"
264 fi 330 fi
265 fi 331 fi
266 332
267 if mysql_version_is_at_least "4.01.03.00" ; then 333 if mysql_version_is_at_least "4.1.3" ; then
268 myconf="${myconf} --with-geometry" 334 myconf="${myconf} --with-geometry"
269 myconf="${myconf} $(use_with cluster ndbcluster)" 335 myconf="${myconf} $(use_with cluster ndbcluster)"
270 fi 336 fi
271 337
272 if mysql_version_is_at_least "4.01.03.00" && useq "extraengine" ; then 338 if mysql_version_is_at_least "4.1.3" && useq "extraengine" ; then
273 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html 339 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html
274 myconf="${myconf} --with-archive-storage-engine" 340 myconf="${myconf} --with-archive-storage-engine"
275 341
276 # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html 342 # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html
277 myconf="${myconf} --with-csv-storage-engine" 343 myconf="${myconf} --with-csv-storage-engine"
280 myconf="${myconf} --with-blackhole-storage-engine" 346 myconf="${myconf} --with-blackhole-storage-engine"
281 347
282 # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html 348 # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html
283 # http://dev.mysql.com/doc/mysql/en/federated-description.html 349 # http://dev.mysql.com/doc/mysql/en/federated-description.html
284 # http://dev.mysql.com/doc/mysql/en/federated-limitations.html 350 # http://dev.mysql.com/doc/mysql/en/federated-limitations.html
285 if mysql_version_is_at_least "5.00.03.00" ; then 351 if mysql_version_is_at_least "5.0.3" ; then
286 elog "Before using the Federated storage engine, please be sure to read" 352 elog "Before using the Federated storage engine, please be sure to read"
287 elog "http://dev.mysql.com/doc/mysql/en/federated-limitations.html" 353 elog "http://dev.mysql.com/doc/mysql/en/federated-limitations.html"
288 myconf="${myconf} --with-federated-storage-engine" 354 myconf="${myconf} --with-federated-storage-engine"
289 fi 355 fi
290 fi 356 fi
291 357
292 mysql_version_is_at_least "5.00.18.00" \ 358 mysql_version_is_at_least "5.0.18" \
293 && useq "max-idx-128" \ 359 && useq "max-idx-128" \
294 && myconf="${myconf} --with-max-indexes=128" 360 && myconf="${myconf} --with-max-indexes=128"
295} 361}
296 362
297configure_51() { 363configure_51() {
329 fi 395 fi
330 396
331 myconf="${myconf} --with-plugins=${plugins}" 397 myconf="${myconf} --with-plugins=${plugins}"
332} 398}
333 399
400pbxt_src_compile() {
401 mysql_init_vars
402
403 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
404
405 einfo "Reconfiguring dir '${PWD}'"
406 AT_GNUCONF_UPDATE="yes" eautoreconf
407
408 local myconf
409 myconf="${myconf} --with-mysql=${S}"
410 mkdir -p ${T}/lib
411 myconf="${myconf} --libdir=${D}/${MY_LIBDIR}"
412 useq "debug" && myconf="${myconf} --with-debug=full"
413 # TODO is safe/needed to use econf here ?
414 ./configure ${myconf} || die "problem configuring pbxt storage engine"
415 # TODO is safe/needed to use emake here ?
416 make || die "problem making pbxt storage engine (${myconf})"
417
418 popd
419 # TODO: modify test suite
420}
421
422pbxt_src_install() {
423 pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
424 make install || die "failed pbxt install"
425 popd
426}
427
334# 428#
335# EBUILD FUNCTIONS 429# EBUILD FUNCTIONS
336# 430#
337 431
338mysql_pkg_setup() { 432mysql_pkg_setup() {
339 enewgroup mysql 60 || die "problem adding 'mysql' group" 433 enewgroup mysql 60 || die "problem adding 'mysql' group"
340 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 434 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
341 435
342 if mysql_version_is_at_least "5.01.12.00" && useq "innodb" ; then
343 eerror "InnoDB now uses cmake to build, this is a TODO item, will be fixed shortly!"
344 die "InnoDB now uses cmake to build, this is a TODO item, will be fixed shortly!"
345 fi
346
347 # Check for USE flag problems in pkg_setup 436 # Check for USE flag problems in pkg_setup
348 if useq "static" && useq "ssl" ; then 437 if useq "static" && useq "ssl" ; then
349 eerror "MySQL does not support being built statically with SSL support enabled!" 438 eerror "MySQL does not support being built statically with SSL support enabled!"
350 die "MySQL does not support being built statically with SSL support enabled!" 439 die "MySQL does not support being built statically with SSL support enabled!"
351 fi 440 fi
352 441
353 if ! mysql_version_is_at_least "5.00.00.00" \ 442 if ! mysql_version_is_at_least "5.0" \
354 && useq "raid" \ 443 && useq "raid" \
355 && useq "static" ; then 444 && useq "static" ; then
356 eerror "USE flags 'raid' and 'static' conflict, you cannot build MySQL statically" 445 eerror "USE flags 'raid' and 'static' conflict, you cannot build MySQL statically"
357 eerror "with RAID support enabled." 446 eerror "with RAID support enabled."
358 die "USE flags 'raid' and 'static' conflict!" 447 die "USE flags 'raid' and 'static' conflict!"
359 fi 448 fi
360 449
361 if mysql_version_is_at_least "4.01.03.00" \ 450 if mysql_version_is_at_least "4.1.3" \
362 && ( useq "cluster" || useq "extraengine" ) \ 451 && ( useq "cluster" || useq "extraengine" ) \
363 && useq "minimal" ; then 452 && useq "minimal" ; then
364 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 453 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
365 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 454 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
366 fi 455 fi
367 456
368 mysql_check_version_range "4.00.00.00 to 5.00.99.99" \ 457 mysql_check_version_range "4.0 to 5.0.99.99" \
369 && useq "berkdb" \ 458 && useq "berkdb" \
370 && elog "Berkeley DB support is deprecated and will be removed in future versions!" 459 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
371} 460}
372 461
373mysql_src_unpack() { 462mysql_src_unpack() {
407 -exec rm -f {} \; 496 -exec rm -f {} \;
408 rm -f "ltmain.sh" 497 rm -f "ltmain.sh"
409 rm -f "scripts/mysqlbug" 498 rm -f "scripts/mysqlbug"
410 fi 499 fi
411 500
412 local rebuilddirlist bdbdir d 501 local rebuilddirlist d
413 502
414 if mysql_version_is_at_least "5.01.12.00" ; then 503 if mysql_version_is_at_least "5.1.12" ; then
415 # TODO: innodb is using cmake now?
416 rebuilddirlist="." 504 rebuilddirlist="."
417 bdbdir='' 505 # TODO IMPO! Check this with a cmake expert
506 useq "innodb" \
507 && cmake \
508 -DCMAKE_C_COMPILER=$(which $(tc-getCC)) \
509 -DCMAKE_CXX_COMPILER=$(which $(tc-getCC)) \
510 "storage/innobase"
418 else 511 else
419 rebuilddirlist=". innobase" 512 rebuilddirlist=". innobase"
420 bdbdir='bdb/dist'
421 fi 513 fi
422 514
423 for d in ${rebuilddirlist} ; do 515 for d in ${rebuilddirlist} ; do
424 einfo "Reconfiguring dir '${d}'" 516 einfo "Reconfiguring dir '${d}'"
425 pushd "${d}" &>/dev/null 517 pushd "${d}" &>/dev/null
426 AT_GNUCONF_UPDATE="yes" eautoreconf 518 AT_GNUCONF_UPDATE="yes" eautoreconf
427 popd &>/dev/null 519 popd &>/dev/null
428 done 520 done
429 521
430 if mysql_check_version_range "4.01.00.00 to 5.00.99.99" \ 522 if mysql_check_version_range "4.1 to 5.0.99.99" \
431 && useq "berkdb" ; then 523 && useq "berkdb" ; then
432 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f "ltmain.sh" "${bdbdir}/ltmain.sh" 524 [[ -w "bdb/dist/ltmain.sh" ]] && cp -f "ltmain.sh" "bdb/dist/ltmain.sh"
433 pushd "${bdbdir}" \ 525 pushd "bdb/dist" \
434 && sh s_all \ 526 && sh s_all \
435 || die "Failed bdb reconfigure" \ 527 || die "Failed bdb reconfigure" \
436 &>/dev/null 528 &>/dev/null
437 popd &>/dev/null 529 popd &>/dev/null
438 fi 530 fi
447 539
448 if useq "minimal" ; then 540 if useq "minimal" ; then
449 configure_minimal 541 configure_minimal
450 else 542 else
451 configure_common 543 configure_common
452 if mysql_version_is_at_least "5.01.10.00" ; then 544 if mysql_version_is_at_least "5.1.10" ; then
453 configure_51 545 configure_51
454 else 546 else
455 configure_40_41_50 547 configure_40_41_50
456 fi 548 fi
457 fi 549 fi
462 # glib-2.3.2_pre fix, bug #16496 554 # glib-2.3.2_pre fix, bug #16496
463 append-flags "-DHAVE_ERRNO_AS_DEFINE=1" 555 append-flags "-DHAVE_ERRNO_AS_DEFINE=1"
464 556
465 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" 557 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing"
466 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" 558 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti"
467 mysql_version_is_at_least "5.00.00.00" \ 559 mysql_version_is_at_least "5.0" \
468 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" 560 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
469 export CXXFLAGS 561 export CXXFLAGS
470 562
471 econf \ 563 econf \
472 --libexecdir="/usr/sbin" \ 564 --libexecdir="/usr/sbin" \
519 rm -f "${D}/usr/sbin/mysqld" 611 rm -f "${D}/usr/sbin/mysqld"
520 rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a 612 rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
521 fi 613 fi
522 614
523 # Configuration stuff 615 # Configuration stuff
524 if mysql_version_is_at_least "4.01.00.00" ; then 616 if mysql_version_is_at_least "4.1" ; then
525 mysql_mycnf_version="4.1" 617 mysql_mycnf_version="4.1"
526 else 618 else
527 mysql_mycnf_version="4.0" 619 mysql_mycnf_version="4.0"
528 fi 620 fi
529 insinto "${MY_SYSCONFDIR}" 621 insinto "${MY_SYSCONFDIR}"
530 doins "scripts/mysqlaccess.conf" 622 doins "scripts/mysqlaccess.conf"
531 sed -e "s!@DATADIR@!${DATADIR}!g" \ 623 sed -e "s!@DATADIR@!${DATADIR}!g" \
532 "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \ 624 "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \
533 > "${TMPDIR}/my.cnf.ok" 625 > "${TMPDIR}/my.cnf.ok"
534 if mysql_version_is_at_least "4.01.00.00" && useq "latin1" ; then 626 if mysql_version_is_at_least "4.1" && useq "latin1" ; then
535 sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok" 627 sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok"
536 fi 628 fi
537 newins "${TMPDIR}/my.cnf.ok" my.cnf 629 newins "${TMPDIR}/my.cnf.ok" my.cnf
538 630
539 insinto "/etc/conf.d" 631 insinto "/etc/conf.d"
616 elog "if this is a new install." 708 elog "if this is a new install."
617 einfo 709 einfo
618 mysql_version_is_at_least "5.01.00.00" \ 710 mysql_version_is_at_least "5.01.00.00" \
619 || elog "InnoDB is *not* optional as of MySQL-4.0.24, at the request of upstream." 711 || elog "InnoDB is *not* optional as of MySQL-4.0.24, at the request of upstream."
620 fi 712 fi
621 mysql_check_version_range "4.00.00.00 to 5.00.99.99" \ 713 mysql_check_version_range "4.0 to 5.0.99.99" \
622 && useq "berkdb" \ 714 && useq "berkdb" \
623 && elog "Berkeley DB support is deprecated and will be removed in future versions!" 715 && elog "Berkeley DB support is deprecated and will be removed in future versions!"
624} 716}
625 717
626mysql_pkg_config() { 718mysql_pkg_config() {
673 [[ -f "${ROOT}/${DATADIR}/mysql/user.frm" ]] \ 765 [[ -f "${ROOT}/${DATADIR}/mysql/user.frm" ]] \
674 || die "MySQL databases not installed" 766 || die "MySQL databases not installed"
675 chown -R mysql:mysql "${ROOT}/${DATADIR}" 2> /dev/null 767 chown -R mysql:mysql "${ROOT}/${DATADIR}" 2> /dev/null
676 chmod 0750 "${ROOT}/${DATADIR}" 2> /dev/null 768 chmod 0750 "${ROOT}/${DATADIR}" 2> /dev/null
677 769
678 if mysql_version_is_at_least "4.01.03.00" ; then 770 if mysql_version_is_at_least "4.1.3" ; then
679 options="--skip-ndbcluster" 771 options="--skip-ndbcluster"
680 772
681 # Filling timezones, see 773 # Filling timezones, see
682 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html 774 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
683 "${ROOT}/usr/bin/mysql_tzinfo_to_sql" "${ROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null 775 "${ROOT}/usr/bin/mysql_tzinfo_to_sql" "${ROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20