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

Diff of /eclass/mysql.eclass

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

Revision 1.20 Revision 1.21
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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.20 2006/02/28 12:52:27 vivo Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.21 2006/03/03 01:33:07 vivo Exp $
4 4
5# Author: Francesco Riosa <vivo at gentoo.org> 5# Author: Francesco Riosa <vivo at gentoo.org>
6# Maintainer: Francesco Riosa <vivo at gentoo.org> 6# Maintainer: Francesco Riosa <vivo at gentoo.org>
7 7
8inherit eutils flag-o-matic gnuconfig mysql_fx 8inherit eutils flag-o-matic gnuconfig mysql_fx
16 16
17DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" 17DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
18HOMEPAGE="http://www.mysql.com/" 18HOMEPAGE="http://www.mysql.com/"
19NEWP="${P/_/-}" 19NEWP="${P/_/-}"
20SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz 20SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${NEWP}.tar.gz
21 mirror://gentoo/mysql-extras-20060115.tar.bz2" 21 mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
22LICENSE="GPL-2" 22LICENSE="GPL-2"
23IUSE="big-tables berkdb debug minimal perl selinux srvdir ssl static" 23IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static"
24RESTRICT="primaryuri confcache" 24RESTRICT="primaryuri confcache"
25DEPEND="app-admin/eselect-mysql" 25DEPEND="app-admin/eselect-mysql"
26 26
27mysql_version_is_at_least "4.01.03.00" \ 27mysql_version_is_at_least "4.01.03.00" \
28&& IUSE="${IUSE} cluster extraengine" 28&& IUSE="${IUSE} cluster extraengine"
29
30mysql_version_is_at_least "5.00.00.00" \
31|| IUSE="${IUSE} raid"
29 32
30mysql_version_is_at_least "5.00.18.00" \ 33mysql_version_is_at_least "5.00.18.00" \
31&& IUSE="${IUSE} max-idx-128" 34&& IUSE="${IUSE} max-idx-128"
32 35
33mysql_version_is_at_least "5.01.00.00" \ 36mysql_version_is_at_least "5.01.00.00" \
131 # additional check, remove bundled zlib 134 # additional check, remove bundled zlib
132 rm -f "${S}/zlib/"*.[ch] 135 rm -f "${S}/zlib/"*.[ch]
133 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 136 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
134 rm -f scripts/mysqlbug 137 rm -f scripts/mysqlbug
135 138
136 # Multilib issue with zlib detection
137 mysql_version_is_at_least "5.00.15.00" \
138 && sed -i -e "s:zlib_dir/lib:zlib_dir/$(get_libdir):g" \
139 "${S}/config/ac-macros/zlib.m4"
140
141 # Make charsets install in the right place 139 # Make charsets install in the right place
142 find . -name 'Makefile.am' \ 140 find . -name 'Makefile.am' \
143 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; 141 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \;
144 142
145 # Manage mysqlmanager 143 # Manage mysqlmanager
163 fi 161 fi
164 162
165 for d in ${rebuilddirlist}; do 163 for d in ${rebuilddirlist}; do
166 einfo "reconfiguring dir \"${d}\"" 164 einfo "reconfiguring dir \"${d}\""
167 pushd "${d}" &>/dev/null 165 pushd "${d}" &>/dev/null
168 for buildstep in \ 166 AT_GNUCONF_UPDATE="yes" eautoreconf
169 'libtoolize --copy --force' \
170 'aclocal --force' \
171 'autoheader --force -Wnone' \
172 'autoconf --force -Wnone' \
173 'automake --force --force-missing -Wnone' \
174 'gnuconfig_update'
175 do
176 einfo "performing ${buildstep}"
177 ${buildstep} || die "failed ${buildstep/ */} dir \"${d}\""
178 done
179 popd &>/dev/null 167 popd &>/dev/null
180 done 168 done
181 169
170 #TODO berkdb in 5.1 need to be worked on
182 if useq berkdb && ! mysql_check_version_range "5.01.00.00 to 5.01.06.99" 171 if useq berkdb && ! mysql_check_version_range "5.01.00.00 to 5.01.08.99"
183 then 172 then
184 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh" 173 [[ -w "${bdbdir}/ltmain.sh" ]] && cp -f ltmain.sh "${bdbdir}/ltmain.sh"
185 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null 174 pushd "${bdbdir}" && sh s_all || die "failed bdb reconfigure" &>/dev/null
186 popd &>/dev/null 175 popd &>/dev/null
187 fi 176 fi
245 234
246 if useq static ; then 235 if useq static ; then
247 myconf="${myconf} --without-raid" 236 myconf="${myconf} --without-raid"
248 ewarn "disabling raid support, has problem with static" 237 ewarn "disabling raid support, has problem with static"
249 else 238 else
239 if mysql_version_is_at_least "5.00.00.00" ; then
250 myconf="${myconf} --with-raid" 240 myconf="${myconf} --without-raid"
241 else
242 myconf="${myconf} `use_with raid`"
243 fi
251 fi 244 fi
252 245
253 if ! mysql_version_is_at_least "5.00.00.00" ; then 246 if ! mysql_version_is_at_least "5.00.00.00" ; then
254 if mysql_version_is_at_least "4.01.00.00" ; then 247 if mysql_version_is_at_least "4.01.00.00" ; then
255 myconf="${myconf} --with-charset=utf8" 248 myconf="${myconf} --with-charset=utf8"
277 || mysql_check_version_range "5.01.00.00 to 5.01.06.99" 270 || mysql_check_version_range "5.01.00.00 to 5.01.06.99"
278 then 271 then
279 ewarn "bdb berkeley-db disabled due to arch or version" 272 ewarn "bdb berkeley-db disabled due to arch or version"
280 myconf="${myconf} --without-berkeley-db" 273 myconf="${myconf} --without-berkeley-db"
281 else 274 else
275 #TODO berkdb in 5.1 need to be worked on
282 useq berkdb \ 276 useq berkdb && \
277 ! mysql_check_version_range "5.01.00.00 to 5.01.08.99" \
283 && myconf="${myconf} --with-berkeley-db=./bdb" \ 278 && myconf="${myconf} --with-berkeley-db=./bdb" \
284 || myconf="${myconf} --without-berkeley-db" 279 || myconf="${myconf} --without-berkeley-db"
285 fi 280 fi
286 281
287 if mysql_version_is_at_least "4.01.03.00" ; then 282 if mysql_version_is_at_least "4.01.03.00" ; then
291 fi 286 fi
292 287
293 mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`" 288 mysql_version_is_at_least "4.01.11.00" && myconf="${myconf} `use_with big-tables`"
294 289
295 mysql_version_is_at_least "5.01.06.00" && myconf="${myconf} --with-ndb-binlog" 290 mysql_version_is_at_least "5.01.06.00" && myconf="${myconf} --with-ndb-binlog"
291
292 if useq embedded ; then
293 #REMIND, need the privilege control enabled ?
294 myconf="${myconf} --without-embedded-privilege-control"
295 myconf="${myconf} --with-embedded-server"
296 else
297 myconf="${myconf} --without-embedded-privilege-control"
298 myconf="${myconf} --without-embedded-server"
299 fi
296 else 300 else
297 for i in ${minimal_exclude_list}; do 301 for i in ${minimal_exclude_list}; do
298 myconf="${myconf} --without-${i}" 302 myconf="${myconf} --without-${i}"
299 done 303 done
300 myconf="${myconf} --without-berkeley-db" 304 myconf="${myconf} --without-berkeley-db"
360 --with-mysqld-user=mysql \ 364 --with-mysqld-user=mysql \
361 --with-client-ldflags=-lstdc++ \ 365 --with-client-ldflags=-lstdc++ \
362 --enable-thread-safe-client \ 366 --enable-thread-safe-client \
363 --with-comment="Gentoo Linux ${PF}" \ 367 --with-comment="Gentoo Linux ${PF}" \
364 --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \ 368 --with-unix-socket-path="/var/run/mysqld/mysqld.sock" \
365 --with-zlib-dir=/usr \
366 --with-lib-ccflags="-fPIC" \ 369 --with-lib-ccflags="-fPIC" \
367 --without-readline \ 370 --without-readline \
368 --without-docs \ 371 --without-docs \
369 ${myconf} || die "bad ./configure" 372 ${myconf} || die "bad ./configure"
370 373
371 # TODO Move this before autoreconf !!! 374 # TODO Move this before autoreconf !!!
372 find . -name 'Makefile' \ 375 find . -type f -name Makefile -print0 \
373 -exec sed --in-place \ 376 | xargs -0 -n100 sed -i \
374 -e 's|^pkglibdir\s*=\s*$(libdir)/mysql|pkglibdir = $(libdir)|' \ 377 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
375 -e 's|^pkgincludedir\s*=\s*$(includedir)/mysql|pkgincludedir = $(includedir)|' \
376 {} \;
377 378
378 emake || die "compile problem" 379 emake || die "compile problem"
379} 380}
380 381
381mysql_src_install() { 382mysql_src_install() {
491 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \ 492 mysql_check_version_range "5.00.16.00 to 5.00.18.99" \
492 && cp -f \ 493 && cp -f \
493 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \ 494 "${WORKDIR}/mysql-extras/fill_help_tables.sql-5.0" \
494 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql" 495 "${D}/usr/share/mysql${MY_SUFFIX}/fill_help_tables.sql"
495 496
497 if [[ ${SLOT} -gt 0 ]] ; then
496 # MOVED HERE DUE TO BUG #121445 498 # MOVED HERE DUE TO BUG #121445
497 # create a list of files, to be used 499 # create a list of files, to be used
498 # by external utilities 500 # by external utilities
499 mkdir -p "${D}/var/lib/eselect/mysql/" 501 mkdir -p "${D}/var/lib/eselect/mysql/"
500 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist" 502 local filelist="${D}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
501 pushd "${D}/" &>/dev/null 503 pushd "${D}/" &>/dev/null
502 env -i find usr/bin/ usr/sbin/ usr/share/man \ 504 find usr/bin/ usr/sbin/ \
503 -type f -name "*${MY_SUFFIX}*" \ 505 -type f -name "*${MY_SUFFIX}*" \
504 -and -not -name "mysql_config${MY_SUFFIX}" \ 506 -and -not -name "mysql_config${MY_SUFFIX}" \
505 > "${filelist}" 507 > "${filelist}"
508 find usr/share/man \
509 -type f -name "*${MY_SUFFIX}*" \
510 | sed -e 's/$/.gz/' \
511 >> "${filelist}"
506 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}" 512 echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
507 echo "${MY_LIBDIR#"/"}" >> "${filelist}" 513 echo "${MY_LIBDIR#"/"}" >> "${filelist}"
508 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}" 514 echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
509 popd &>/dev/null 515 popd &>/dev/null
510 516 fi
511} 517}
512 518
513mysql_pkg_preinst() { 519mysql_pkg_preinst() {
514
515 ## create a list of files, to be used
516 ## by external utilities
517 ## will be used in pkg_postinst
518 #local filelist="${TMPDIR}/FILELIST"
519 #pushd "${D}/" &>/dev/null
520 # mkdir -p "${ROOT}/var/lib/eselect/mysql/"
521 # env -i find usr/bin/ usr/sbin/ usr/share/man \
522 # -type f -name "*${MY_SUFFIX}*" \
523 # -and -not -name "mysql_config${MY_SUFFIX}" \
524 # > "${filelist}"
525 # echo "${MY_SYSCONFDIR#"/"}" >> "${filelist}"
526 # echo "${MY_LIBDIR#"/"}" >> "${filelist}"
527 # echo "${MY_SHAREDSTATEDIR#"/"}" >> "${filelist}"
528 #popd &>/dev/null
529 520
530 enewgroup mysql 60 || die "problem adding group mysql" 521 enewgroup mysql 60 || die "problem adding group mysql"
531 enewuser mysql 60 -1 /dev/null mysql \ 522 enewuser mysql 60 -1 /dev/null mysql \
532 || die "problem adding user mysql" 523 || die "problem adding user mysql"
533} 524}
544 #secure the logfiles... does this bother anybody? 535 #secure the logfiles... does this bother anybody?
545 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 536 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
546 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 537 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
547 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 538 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
548 539
549 ## list of files, to be used
550 ## by external utilities
551 #mkdir -p "${ROOT}/var/lib/eselect/mysql/"
552 #cp "${TMPDIR}/FILELIST" "${ROOT}/var/lib/eselect/mysql/mysql${MY_SUFFIX}.filelist"
553
554 if ! useq minimal; then 540 if ! useq minimal; then
555 if [[ ${SLOT} -gt 0 ]] ; then 541 if [[ ${SLOT} -gt 0 ]] ; then
556 #if [[ -f "${ROOT}/usr/sbin/mysqld" ]] ; then
557 einfo "you may want to read:" 542 einfo "you may want to read:"
558 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml" 543 einfo "http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml"
559 #else
560 # local tmpres="$( eselect mysql show )"
561 # # "like grep -q unset"
562 # if [[ "{$tmpres}" == "{$tmpres/unset/}" ]] ; then
563 # eselect mysql set 1
564 # else
565 # einfo "The version of mysql emerged now stils is _NOT_ the default"
566 einfo "you may want to run \"eselect mysql list\" followed by a " 544 einfo "you may want to run \"eselect mysql list\" followed by a "
567 einfo "\"eselect mysql set 1\" to choose the default mysql server" 545 einfo "\"eselect mysql set 1\" to choose the default mysql server"
568 # fi
569 #fi
570 fi 546 fi
571 547
572 # your friendly public service announcement... 548 # your friendly public service announcement...
573 einfo 549 einfo
574 einfo "You might want to run:" 550 einfo "You might want to run:"
575 einfo "\"emerge --config =${CATEGORY}/${PF}\"" 551 einfo "\"emerge --config =${CATEGORY}/${PF}\""
576 einfo "if this is a new install." 552 einfo "if this is a new install."
577 einfo 553 einfo
554 mysql_version_is_at_least "5.01.00.00" \
578 einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream." 555 || einfo "InnoDB is not optional as of MySQL-4.0.24, at the request of upstream."
579 fi 556 fi
580} 557}
581 558
582mysql_pkg_config() { 559mysql_pkg_config() {
583 mysql_init_vars 560 mysql_init_vars
686 wait %1 663 wait %1
687 einfo "done" 664 einfo "done"
688} 665}
689 666
690mysql_pkg_prerm() { 667mysql_pkg_prerm() {
668 if [[ ${SLOT} -gt 0 ]] ; then
691 # external program 669 # external program
692 eselect mysql slot_remove "${SLOT}" 670 eselect mysql slot_remove "${SLOT}"
671 fi
693} 672}
694 673
695mysql_pkg_postrm() { 674mysql_pkg_postrm() {
696 mysql_lib_symlinks 675 mysql_lib_symlinks
697 if [[ ${SLOT} -gt 0 ]] ; then 676 if [[ ${SLOT} -gt 0 ]] ; then

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20