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

Diff of /eclass/mysql.eclass

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

Revision 1.30 Revision 1.38
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.30 2006/05/05 19:49:43 chtekk Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.38 2006/10/20 13:14:21 chtekk 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
45# and we will run a mysql server during test phase 45# and we will run a mysql server during test phase
46S="${WORKDIR}/${PN}" 46S="${WORKDIR}/${PN}"
47 47
48# Define $MY_FIXED_PV for MySQL patchsets 48# Define $MY_FIXED_PV for MySQL patchsets
49MY_FIXED_PV="${PV/_alpha/}" 49MY_FIXED_PV="${PV/_alpha/}"
50MY_FIXED_PV="${MY_FIXED_PV/_beta/}" 50#MY_FIXED_PV="${MY_FIXED_PV/_beta/}"
51MY_FIXED_PV="${MY_FIXED_PV/_rc/}" 51#MY_FIXED_PV="${MY_FIXED_PV/_rc/}"
52 52
53# Define correct SRC_URIs 53# Define correct SRC_URIs
54SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${P/_/-}.tar.gz" 54SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${P/_/-}${MYSQL_RERELEASE}.tar.gz"
55[[ -n "${MYSQL_PATCHSET_REV}" ]] && SRC_URI="${SRC_URI} http://gentoo.longitekk.com/${PN}-patchset-${MY_FIXED_PV}-r${MYSQL_PATCHSET_REV}.tar.bz2" 55if [[ -n "${MYSQL_PATCHSET_REV}" ]] ; then
56 MYSQL_PATCHSET_FILENAME="${PN}-patchset-${MY_FIXED_PV}-r${MYSQL_PATCHSET_REV}.tar.bz2"
57 # We add the Gentoo mirror here, as we only use primaryuri for the MySQL tarball
58 SRC_URI="${SRC_URI} http://gentoo.longitekk.com/${MYSQL_PATCHSET_FILENAME}"
59fi
56 60
57DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." 61DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
58HOMEPAGE="http://www.mysql.com/" 62HOMEPAGE="http://www.mysql.com/"
59SLOT="0" 63SLOT="0"
60LICENSE="GPL-2" 64LICENSE="GPL-2"
61IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static" 65IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static"
62RESTRICT="primaryuri confcache" 66RESTRICT="confcache"
63 67
64mysql_version_is_at_least "4.01.00.00" \ 68mysql_version_is_at_least "4.01.00.00" \
65&& IUSE="${IUSE} latin1" 69&& IUSE="${IUSE} latin1"
66 70
67mysql_version_is_at_least "4.01.03.00" \ 71mysql_version_is_at_least "4.01.03.00" \
75 79
76mysql_version_is_at_least "5.01.00.00" \ 80mysql_version_is_at_least "5.01.00.00" \
77&& IUSE="${IUSE} innodb" 81&& IUSE="${IUSE} innodb"
78 82
79EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst \ 83EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst \
80 pkg_postinst pkg_config pkg_postrm 84 pkg_postinst pkg_config pkg_postrm
85
86#
87# HELPER FUNCTIONS:
88#
81 89
82# void mysql_init_vars() 90# void mysql_init_vars()
83# 91#
84# Initialize global variables 92# Initialize global variables
85# 2005-11-19 <vivo@gentoo.org> 93# 2005-11-19 <vivo@gentoo.org>
133 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR 141 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
134 export MY_INCLUDEDIR 142 export MY_INCLUDEDIR
135 export DATADIR 143 export DATADIR
136} 144}
137 145
146configure_minimal() {
147 # these are things we exclude from a minimal build
148 # note that the server actually does get built and installed
149 # but we then delete it before packaging.
150 local minimal_exclude_list="server embedded-server extra-tools innodb bench berkeley-db row-based-replication"
151
152 for i in ${minimal_exclude_list}; do
153 myconf="${myconf} --without-${i}"
154 done
155 myconf="${myconf} --with-extra-charsets=none"
156}
157
158configure_common() {
159 myconf="${myconf} --enable-local-infile"
160 myconf="${myconf} --with-extra-charsets=all"
161 myconf="${myconf} --with-mysqld-user=mysql"
162 myconf="${myconf} --with-unix-socket-path='/var/run/mysqld/mysqld.sock'"
163 myconf="${myconf} --without-libwrap"
164
165 if useq "static" ; then
166 myconf="${myconf} --with-mysqld-ldflags=-all-static"
167 myconf="${myconf} --with-client-ldflags=-all-static"
168 myconf="${myconf} --disable-shared"
169 else
170 myconf="${myconf} --enable-shared --enable-static"
171 fi
172
173 if useq "debug" ; then
174 myconf="${myconf} --with-debug=full"
175 else
176 myconf="${myconf} --without-debug"
177 mysql_version_is_at_least "4.01.03.00" \
178 && useq "cluster" \
179 && myconf="${myconf} --without-ndb-debug"
180 fi
181
182 if mysql_version_is_at_least "4.01.00.00" && ! useq "latin1" ; then
183 myconf="${myconf} --with-charset=utf8"
184 myconf="${myconf} --with-collation=utf8_general_ci"
185 else
186 myconf="${myconf} --with-charset=latin1"
187 myconf="${myconf} --with-collation=latin1_swedish_ci"
188 fi
189
190 if useq "embedded" ; then
191 myconf="${myconf} --with-embedded-privilege-control"
192 myconf="${myconf} --with-embedded-server"
193 else
194 myconf="${myconf} --without-embedded-privilege-control"
195 myconf="${myconf} --without-embedded-server"
196 fi
197
198}
199
200configure_40_41_50() {
201 myconf="${myconf} $(use_with perl bench)"
202 myconf="${myconf} --enable-assembler"
203 myconf="${myconf} --with-extra-tools"
204 myconf="${myconf} --with-innodb"
205 myconf="${myconf} --without-readline"
206 mysql_version_is_at_least "5.00.00.00" || myconf="${myconf} $(use_with raid)"
207
208 if useq "ssl" ; then
209 # --with-vio is not needed anymore, it's on by default and
210 # has been removed from configure
211 mysql_version_is_at_least "5.00.04.00" || myconf="${myconf} --with-vio"
212 if mysql_version_is_at_least "5.00.06.00" ; then
213 # myconf="${myconf} --with-yassl"
214 myconf="${myconf} --with-openssl"
215 else
216 myconf="${myconf} --with-openssl"
217 fi
218 else
219 myconf="${myconf} --without-openssl"
220 fi
221
222 # The following fix is due to a bug with bdb on SPARC's. See:
223 # http://www.geocrawler.com/mail/msg.php3?msg_id=4754814&list=8
224 # It comes down to non-64-bit safety problems.
225 if useq "sparc" || useq "alpha" || useq "hppa" || useq "mips" || useq "amd64" ; then
226 ewarn "bdb berkeley-db disabled due to incompatible arch"
227 myconf="${myconf} --without-berkeley-db"
228 else
229 useq "berkdb" && myconf="${myconf} --with-berkeley-db=./bdb"
230 fi
231
232 if mysql_version_is_at_least "4.01.03.00" ; then
233 myconf="${myconf} --with-geometry"
234 myconf="${myconf} $(use_with cluster ndbcluster)"
235 fi
236
237 mysql_version_is_at_least "4.01.11.00" \
238 && myconf="${myconf} $(use_with big-tables)"
239
240 if mysql_version_is_at_least "4.01.03.00" && useq "extraengine" ; then
241 # http://dev.mysql.com/doc/mysql/en/archive-storage-engine.html
242 myconf="${myconf} --with-archive-storage-engine"
243
244 # http://dev.mysql.com/doc/mysql/en/csv-storage-engine.html
245 myconf="${myconf} --with-csv-storage-engine"
246
247 # http://dev.mysql.com/doc/mysql/en/blackhole-storage-engine.html
248 myconf="${myconf} --with-blackhole-storage-engine"
249
250 # http://dev.mysql.com/doc/mysql/en/federated-storage-engine.html
251 # http://dev.mysql.com/doc/mysql/en/federated-description.html
252 # http://dev.mysql.com/doc/mysql/en/federated-limitations.html
253 if mysql_version_is_at_least "5.00.03.00" ; then
254 einfo "Before using the Federated storage engine, please be sure to read"
255 einfo "http://dev.mysql.com/doc/mysql/en/federated-limitations.html"
256 myconf="${myconf} --with-federated-storage-engine"
257 fi
258 fi
259
260 mysql_version_is_at_least "5.00.18.00" \
261 && useq "max-idx-128" \
262 && myconf="${myconf} --with-max-indexes=128"
263}
264
265configure_51() {
266 # TODO : !!!!! readd --withouth-readline
267 # the failure depend upon config/ac-macros/readline.m4 checking into
268 # readline.h instead of history.h
269 myconf="${myconf} $(use_with big-tables)"
270 myconf="${myconf} $(use_with ssl)"
271 myconf="${myconf} --enable-assembler"
272 myconf="${myconf} --with-geometry"
273 myconf="${myconf} --with-readline"
274 myconf="${myconf} --with-row-based-replication"
275 myconf="${myconf} --with-zlib=/usr/$(get_libdir)"
276 myconf="${myconf} --without-pstack"
277 useq "max-idx-128" && myconf="${myconf} --with-max-indexes=128"
278
279 # 5.1 introduces a new way to manage storage engines (plugins)
280 # like configuration=none
281 local plugins="csv,myisam,myisammrg,heap"
282 if useq "extraengine" ; then
283 # like configuration=max-no-ndb, archive and example removed in 5.1.11
284 plugins="${plugins},blackhole,federated,ftexample,partition"
285
286 einfo "before to use federated engine be sure to read"
287 einfo "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html"
288 fi
289
290 if useq "innodb" ; then
291 plugins="${plugins},innobase"
292 fi
293
294 # like configuration=max-no-ndb
295 if useq "cluster" ; then
296 plugins="${plugins},ndbcluster"
297 myconf="${myconf} --with-ndb-binlog"
298 fi
299
300 myconf="${myconf} --with-plugins=${plugins}"
301}
302
303#
304# EBUILD FUNCTIONS
305#
306
138mysql_pkg_setup() { 307mysql_pkg_setup() {
139 enewgroup mysql 60 || die "problem adding 'mysql' group" 308 enewgroup mysql 60 || die "problem adding 'mysql' group"
140 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" 309 enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
310
311 if mysql_version_is_at_least "5.01.12.00" && useq "innodb" ; then
312 die "innodb now use cmake to build this is a TODO item"
313 fi
141 314
142 # Check for USE flag problems in pkg_setup 315 # Check for USE flag problems in pkg_setup
143 if useq "static" && useq "ssl" ; then 316 if useq "static" && useq "ssl" ; then
144 eerror "MySQL does not support being built statically with SSL support enabled!" 317 eerror "MySQL does not support being built statically with SSL support enabled!"
145 die "MySQL does not support being built statically with SSL support enabled!" 318 die "MySQL does not support being built statically with SSL support enabled!"
157 && ( useq "cluster" || useq "extraengine" ) \ 330 && ( useq "cluster" || useq "extraengine" ) \
158 && useq "minimal" ; then 331 && useq "minimal" ; then
159 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 332 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
160 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 333 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
161 fi 334 fi
335
336 useq "berkdb" && ewarn "Berkley DB support is deprecated and will be removed in future versions"
162} 337}
163 338
164mysql_src_unpack() { 339mysql_src_unpack() {
165 # Initialize the proper variables first 340 # Initialize the proper variables first
166 mysql_init_vars 341 mysql_init_vars
167 342
168 unpack ${A} 343 unpack ${A}
169 344
170 mv -f "${WORKDIR}/${P/_/-}" "${S}" 345 mv -f "${WORKDIR}/${P/_/-}${MYSQL_RERELEASE}" "${S}"
171 cd "${S}" 346 cd "${S}"
172 347
173 # Apply the patches for this MySQL version 348 # Apply the patches for this MySQL version
174 if [[ -d "${WORKDIR}/${MY_FIXED_PV}" ]] ; then 349 if [[ -d "${WORKDIR}/${MY_FIXED_PV}" ]] ; then
175 EPATCH_SOURCE="${WORKDIR}/${MY_FIXED_PV}" EPATCH_SUFFIX="patch" epatch 350 EPATCH_SOURCE="${WORKDIR}/${MY_FIXED_PV}" EPATCH_SUFFIX="patch" epatch
179 rm -f "${S}/zlib/"*.[ch] 354 rm -f "${S}/zlib/"*.[ch]
180 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" 355 sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in"
181 rm -f "scripts/mysqlbug" 356 rm -f "scripts/mysqlbug"
182 357
183 # Make charsets install in the right place 358 # Make charsets install in the right place
359 find . -name 'Makefile.am' \
184 find . -name 'Makefile.am' -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; 360 -exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \;
185 361
186 # Manage mysqlmanager 362 # Manage mysqlmanager
187 mysql_version_is_at_least "5.00.15.00" \ 363 mysql_version_is_at_least "5.00.15.00" \
188 && sed -i -e "s!@GENTOO_EXT@!!g" -e "s!@GENTOO_SOCK_PATH@!var/run/mysqld!g" "${S}/server-tools/instance-manager/Makefile.am" 364 && sed -i -e "s!@GENTOO_EXT@!${MY_SUFFIX}!g" \
365 -e "s!@GENTOO_SOCK_PATH@!var/run/mysqld!g" \
366 "${S}/server-tools/instance-manager/Makefile.am"
189 367
190 if mysql_version_is_at_least "4.01.00.00" ; then 368 if mysql_version_is_at_least "4.01.00.00" ; then
191 # Remove what needs to be recreated, so we're sure it's actually done 369 # Remove what needs to be recreated, so we're sure it's actually done
192 find . -name Makefile \ 370 find . -name Makefile \
193 -o -name Makefile.in \ 371 -o -name Makefile.in \
194 -o -name configure \ 372 -o -name configure \
195 -exec rm -f {} \; 373 -exec rm -f {} \;
196 rm -f "ltmain.sh" 374 rm -f "ltmain.sh"
375 rm -f "scripts/mysqlbug"
197 fi 376 fi
198 377
199 local rebuilddirlist bdbdir d 378 local rebuilddirlist bdbdir d
200 379
201 if mysql_version_is_at_least "5.01.00.00" ; then 380 if mysql_version_is_at_least "5.01.00.00" ; then
403 filter-flags "-O" "-O[01]" 582 filter-flags "-O" "-O[01]"
404 583
405 # glib-2.3.2_pre fix, bug #16496 584 # glib-2.3.2_pre fix, bug #16496
406 append-flags "-DHAVE_ERRNO_AS_DEFINE=1" 585 append-flags "-DHAVE_ERRNO_AS_DEFINE=1"
407 586
408 # The compiler flags are as their "official" spec says ;) 587 append-flags "-fno-exceptions -fno-strict-aliasing"
409 # CFLAGS="${CFLAGS/-O?/} -O3"
410 export CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-exceptions -fno-rtti" 588 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti"
411 mysql_version_is_at_least "5.00.00.00" \ 589 mysql_version_is_at_least "5.00.00.00" \
412 && export CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" 590 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
591 export CXXFLAGS="${CXXFLAGS}"
413 592
414 econf \ 593 econf \
415 --libexecdir="/usr/sbin" \ 594 --libexecdir="/usr/sbin" \
416 --sysconfdir="${MY_SYSCONFDIR}" \ 595 --sysconfdir="${MY_SYSCONFDIR}" \
417 --localstatedir="${MY_LOCALSTATEDIR}" \ 596 --localstatedir="${MY_LOCALSTATEDIR}" \
451 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 630 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
452 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" 631 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
453 632
454 # Various junk (my-*.cnf moved elsewhere) 633 # Various junk (my-*.cnf moved elsewhere)
455 rm -Rf "${D}/usr/share/info" 634 rm -Rf "${D}/usr/share/info"
456 for removeme in "mysql-log-rotate" mysql.server* binary-configure* my-*.cnf mi_test_all* ; do 635 for removeme in "mysql-log-rotate" mysql.server* \
636 binary-configure* my-*.cnf mi_test_all*
637 do
457 rm -f "${D}"/usr/share/mysql/${removeme} 638 rm -f "${D}"/usr/share/mysql/${removeme}
458 done 639 done
459 640
460 # Clean up stuff for a minimal build 641 # Clean up stuff for a minimal build
461 if useq "minimal" ; then 642 if useq "minimal" ; then
543mysql_pkg_postinst() { 724mysql_pkg_postinst() {
544 # Make sure the vars are correctly initialized 725 # Make sure the vars are correctly initialized
545 mysql_init_vars 726 mysql_init_vars
546 727
547 # Check FEATURES="collision-protect" before removing this 728 # Check FEATURES="collision-protect" before removing this
729 [[ -d "${ROOT}/var/log/mysql" ]] \
548 [[ -d "${ROOT}/var/log/mysql" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" 730 || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
549 731
550 # Secure the logfiles 732 # Secure the logfiles
551 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 733 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
552 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 734 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
553 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 735 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
560 einfo "if this is a new install." 742 einfo "if this is a new install."
561 einfo 743 einfo
562 mysql_version_is_at_least "5.01.00.00" \ 744 mysql_version_is_at_least "5.01.00.00" \
563 || einfo "InnoDB is *not* optional as of MySQL-4.0.24, at the request of upstream." 745 || einfo "InnoDB is *not* optional as of MySQL-4.0.24, at the request of upstream."
564 fi 746 fi
747 useq "berkdb" && ewarn "Berkley DB support is deprecated and will be removed in future versions"
565} 748}
566 749
567mysql_pkg_config() { 750mysql_pkg_config() {
568 # Make sure the vars are correctly initialized 751 # Make sure the vars are correctly initialized
569 mysql_init_vars 752 mysql_init_vars

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20