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

Diff of /eclass/mysql.eclass

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

Revision 1.49 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.49 2006/12/13 11:11:26 vivo 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>
172 myconf="${myconf} --with-client-ldflags=-all-static" 238 myconf="${myconf} --with-client-ldflags=-all-static"
173 myconf="${myconf} --disable-shared" 239 myconf="${myconf} --disable-shared"
174 else 240 else
175 myconf="${myconf} --enable-shared --enable-static" 241 myconf="${myconf} --enable-shared --enable-static"
176 fi 242 fi
243
244 if mysql_version_is_at_least "4.01.00.00" && ! useq "latin1" ; then
245 myconf="${myconf} --with-charset=utf8"
246 myconf="${myconf} --with-collation=utf8_general_ci"
247 else
248 myconf="${myconf} --with-charset=latin1"
249 myconf="${myconf} --with-collation=latin1_swedish_ci"
250 fi
177} 251}
178 252
179configure_common() { 253configure_common() {
180 myconf="${myconf} $(use_with big-tables)" 254 myconf="${myconf} $(use_with big-tables)"
181 myconf="${myconf} --enable-local-infile" 255 myconf="${myconf} --enable-local-infile"
195 269
196 if useq "debug" ; then 270 if useq "debug" ; then
197 myconf="${myconf} --with-debug=full" 271 myconf="${myconf} --with-debug=full"
198 else 272 else
199 myconf="${myconf} --without-debug" 273 myconf="${myconf} --without-debug"
200 mysql_version_is_at_least "4.01.03.00" \ 274 mysql_version_is_at_least "4.1.3" \
201 && useq "cluster" \ 275 && useq "cluster" \
202 && myconf="${myconf} --without-ndb-debug" 276 && myconf="${myconf} --without-ndb-debug"
203 fi 277 fi
204 278
205 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
206 myconf="${myconf} --with-charset=utf8" 280 myconf="${myconf} --with-charset=utf8"
207 myconf="${myconf} --with-collation=utf8_general_ci" 281 myconf="${myconf} --with-collation=utf8_general_ci"
208 else 282 else
209 myconf="${myconf} --with-charset=latin1" 283 myconf="${myconf} --with-charset=latin1"
210 myconf="${myconf} --with-collation=latin1_swedish_ci" 284 myconf="${myconf} --with-collation=latin1_swedish_ci"
224 myconf="${myconf} $(use_with perl bench)" 298 myconf="${myconf} $(use_with perl bench)"
225 myconf="${myconf} --enable-assembler" 299 myconf="${myconf} --enable-assembler"
226 myconf="${myconf} --with-extra-tools" 300 myconf="${myconf} --with-extra-tools"
227 myconf="${myconf} --with-innodb" 301 myconf="${myconf} --with-innodb"
228 myconf="${myconf} --without-readline" 302 myconf="${myconf} --without-readline"
229 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)"
230 304
231 if useq "ssl" ; then 305 if useq "ssl" ; then
232 # --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
233 # has been removed from configure 307 # has been removed from configure
234 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"
235 if mysql_version_is_at_least "5.00.06.00" ; then 309 if mysql_version_is_at_least "5.0.6" ; then
236 # myconf="${myconf} --with-yassl" 310 # myconf="${myconf} --with-yassl"
237 myconf="${myconf} --with-openssl" 311 myconf="${myconf} --with-openssl"
238 else 312 else
239 myconf="${myconf} --with-openssl" 313 myconf="${myconf} --with-openssl"
240 fi 314 fi
254 else 328 else
255 myconf="${myconf} --without-berkeley-db" 329 myconf="${myconf} --without-berkeley-db"
256 fi 330 fi
257 fi 331 fi
258 332
259 if mysql_version_is_at_least "4.01.03.00" ; then 333 if mysql_version_is_at_least "4.1.3" ; then
260 myconf="${myconf} --with-geometry" 334 myconf="${myconf} --with-geometry"
261 myconf="${myconf} $(use_with cluster ndbcluster)" 335 myconf="${myconf} $(use_with cluster ndbcluster)"
262 fi 336 fi
263 337
264 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
265 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html 339 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html
266 myconf="${myconf} --with-archive-storage-engine" 340 myconf="${myconf} --with-archive-storage-engine"
267 341
268 # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html 342 # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html
269 myconf="${myconf} --with-csv-storage-engine" 343 myconf="${myconf} --with-csv-storage-engine"
272 myconf="${myconf} --with-blackhole-storage-engine" 346 myconf="${myconf} --with-blackhole-storage-engine"
273 347
274 # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html 348 # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html
275 # http://dev.mysql.com/doc/mysql/en/federated-description.html 349 # http://dev.mysql.com/doc/mysql/en/federated-description.html
276 # http://dev.mysql.com/doc/mysql/en/federated-limitations.html 350 # http://dev.mysql.com/doc/mysql/en/federated-limitations.html
277 if mysql_version_is_at_least "5.00.03.00" ; then 351 if mysql_version_is_at_least "5.0.3" ; then
278 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"
279 elog "http://dev.mysql.com/doc/mysql/en/federated-limitations.html" 353 elog "http://dev.mysql.com/doc/mysql/en/federated-limitations.html"
280 myconf="${myconf} --with-federated-storage-engine" 354 myconf="${myconf} --with-federated-storage-engine"
281 fi 355 fi
282 fi 356 fi
283 357
284 mysql_version_is_at_least "5.00.18.00" \ 358 mysql_version_is_at_least "5.0.18" \
285 && useq "max-idx-128" \ 359 && useq "max-idx-128" \
286 && myconf="${myconf} --with-max-indexes=128" 360 && myconf="${myconf} --with-max-indexes=128"
287} 361}
288 362
289configure_51() { 363configure_51() {
321 fi 395 fi
322 396
323 myconf="${myconf} --with-plugins=${plugins}" 397 myconf="${myconf} --with-plugins=${plugins}"
324} 398}
325 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
326# 428#
327# EBUILD FUNCTIONS 429# EBUILD FUNCTIONS
328# 430#
329 431
330mysql_pkg_setup() { 432mysql_pkg_setup() {
331 enewgroup mysql 60 || die "problem adding 'mysql' group" 433 enewgroup mysql 60 || die "problem adding 'mysql' group"
332 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"
333 435
334 if mysql_version_is_at_least "5.01.12.00" && useq "innodb" ; then
335 eerror "InnoDB now uses cmake to build, this is a TODO item, will be fixed shortly!"
336 die "InnoDB now uses cmake to build, this is a TODO item, will be fixed shortly!"
337 fi
338
339 # Check for USE flag problems in pkg_setup 436 # Check for USE flag problems in pkg_setup
340 if useq "static" && useq "ssl" ; then 437 if useq "static" && useq "ssl" ; then
341 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!"
342 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!"
343 fi 440 fi
344 441
345 if ! mysql_version_is_at_least "5.00.00.00" \ 442 if ! mysql_version_is_at_least "5.0" \
346 && useq "raid" \ 443 && useq "raid" \
347 && useq "static" ; then 444 && useq "static" ; then
348 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"
349 eerror "with RAID support enabled." 446 eerror "with RAID support enabled."
350 die "USE flags 'raid' and 'static' conflict!" 447 die "USE flags 'raid' and 'static' conflict!"
351 fi 448 fi
352 449
353 if mysql_version_is_at_least "4.01.03.00" \ 450 if mysql_version_is_at_least "4.1.3" \
354 && ( useq "cluster" || useq "extraengine" ) \ 451 && ( useq "cluster" || useq "extraengine" ) \
355 && useq "minimal" ; then 452 && useq "minimal" ; then
356 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 453 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
357 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 454 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
358 fi 455 fi
359 456
360 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" \
361 && useq "berkdb" \ 458 && useq "berkdb" \
362 && 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!"
363} 460}
364 461
365mysql_src_unpack() { 462mysql_src_unpack() {
399 -exec rm -f {} \; 496 -exec rm -f {} \;
400 rm -f "ltmain.sh" 497 rm -f "ltmain.sh"
401 rm -f "scripts/mysqlbug" 498 rm -f "scripts/mysqlbug"
402 fi 499 fi
403 500
404 local rebuilddirlist bdbdir d 501 local rebuilddirlist d
405 502
406 if mysql_version_is_at_least "5.01.12.00" ; then 503 if mysql_version_is_at_least "5.1.12" ; then
407 # TODO: innodb is using cmake now?
408 rebuilddirlist="." 504 rebuilddirlist="."
409 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"
410 else 511 else
411 rebuilddirlist=". innobase" 512 rebuilddirlist=". innobase"
412 bdbdir='bdb/dist'
413 fi 513 fi
414 514
415 for d in ${rebuilddirlist} ; do 515 for d in ${rebuilddirlist} ; do
416 einfo "Reconfiguring dir '${d}'" 516 einfo "Reconfiguring dir '${d}'"
417 pushd "${d}" &>/dev/null 517 pushd "${d}" &>/dev/null
418 AT_GNUCONF_UPDATE="yes" eautoreconf 518 AT_GNUCONF_UPDATE="yes" eautoreconf
419 popd &>/dev/null 519 popd &>/dev/null
420 done 520 done
421 521
422 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" \
423 && useq "berkdb" ; then 523 && useq "berkdb" ; then
424 [[ -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"
425 pushd "${bdbdir}" \ 525 pushd "bdb/dist" \
426 && sh s_all \ 526 && sh s_all \
427 || die "Failed bdb reconfigure" \ 527 || die "Failed bdb reconfigure" \
428 &>/dev/null 528 &>/dev/null
429 popd &>/dev/null 529 popd &>/dev/null
430 fi 530 fi
439 539
440 if useq "minimal" ; then 540 if useq "minimal" ; then
441 configure_minimal 541 configure_minimal
442 else 542 else
443 configure_common 543 configure_common
444 if mysql_version_is_at_least "5.01.10.00" ; then 544 if mysql_version_is_at_least "5.1.10" ; then
445 configure_51 545 configure_51
446 else 546 else
447 configure_40_41_50 547 configure_40_41_50
448 fi 548 fi
449 fi 549 fi
454 # glib-2.3.2_pre fix, bug #16496 554 # glib-2.3.2_pre fix, bug #16496
455 append-flags "-DHAVE_ERRNO_AS_DEFINE=1" 555 append-flags "-DHAVE_ERRNO_AS_DEFINE=1"
456 556
457 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" 557 CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing"
458 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" 558 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti"
459 mysql_version_is_at_least "5.00.00.00" \ 559 mysql_version_is_at_least "5.0" \
460 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" 560 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
461 export CXXFLAGS 561 export CXXFLAGS
462 562
463 econf \ 563 econf \
464 --libexecdir="/usr/sbin" \ 564 --libexecdir="/usr/sbin" \
511 rm -f "${D}/usr/sbin/mysqld" 611 rm -f "${D}/usr/sbin/mysqld"
512 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
513 fi 613 fi
514 614
515 # Configuration stuff 615 # Configuration stuff
516 if mysql_version_is_at_least "4.01.00.00" ; then 616 if mysql_version_is_at_least "4.1" ; then
517 mysql_mycnf_version="4.1" 617 mysql_mycnf_version="4.1"
518 else 618 else
519 mysql_mycnf_version="4.0" 619 mysql_mycnf_version="4.0"
520 fi 620 fi
521 insinto "${MY_SYSCONFDIR}" 621 insinto "${MY_SYSCONFDIR}"
522 doins "scripts/mysqlaccess.conf" 622 doins "scripts/mysqlaccess.conf"
523 sed -e "s!@DATADIR@!${DATADIR}!g" \ 623 sed -e "s!@DATADIR@!${DATADIR}!g" \
524 "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \ 624 "${FILESDIR}/my.cnf-${mysql_mycnf_version}" \
525 > "${TMPDIR}/my.cnf.ok" 625 > "${TMPDIR}/my.cnf.ok"
526 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
527 sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok" 627 sed -e "s|utf8|latin1|g" -i "${TMPDIR}/my.cnf.ok"
528 fi 628 fi
529 newins "${TMPDIR}/my.cnf.ok" my.cnf 629 newins "${TMPDIR}/my.cnf.ok" my.cnf
530 630
531 insinto "/etc/conf.d" 631 insinto "/etc/conf.d"
608 elog "if this is a new install." 708 elog "if this is a new install."
609 einfo 709 einfo
610 mysql_version_is_at_least "5.01.00.00" \ 710 mysql_version_is_at_least "5.01.00.00" \
611 || 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."
612 fi 712 fi
613 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" \
614 && useq "berkdb" \ 714 && useq "berkdb" \
615 && 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!"
616} 716}
617 717
618mysql_pkg_config() { 718mysql_pkg_config() {
665 [[ -f "${ROOT}/${DATADIR}/mysql/user.frm" ]] \ 765 [[ -f "${ROOT}/${DATADIR}/mysql/user.frm" ]] \
666 || die "MySQL databases not installed" 766 || die "MySQL databases not installed"
667 chown -R mysql:mysql "${ROOT}/${DATADIR}" 2> /dev/null 767 chown -R mysql:mysql "${ROOT}/${DATADIR}" 2> /dev/null
668 chmod 0750 "${ROOT}/${DATADIR}" 2> /dev/null 768 chmod 0750 "${ROOT}/${DATADIR}" 2> /dev/null
669 769
670 if mysql_version_is_at_least "4.01.03.00" ; then 770 if mysql_version_is_at_least "4.1.3" ; then
671 options="--skip-ndbcluster" 771 options="--skip-ndbcluster"
672 772
673 # Filling timezones, see 773 # Filling timezones, see
674 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html 774 # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
675 "${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.49  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20