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

Diff of /eclass/mysql.eclass

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

Revision 1.34 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.34 2006/10/13 12:36:08 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/_/-}${MYSQL_RERELEASE}.tar.gz" 54SRC_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/${P/_/-}${MYSQL_RERELEASE}.tar.gz"
55if [[ -n "${MYSQL_PATCHSET_REV}" ]] ; then 55if [[ -n "${MYSQL_PATCHSET_REV}" ]] ; then
56 MYSQL_PATCHSET_FILENAME="${PN}-patchset-${MY_FIXED_PV}-r${MYSQL_PATCHSET_REV}.tar.bz2" 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 57 # We add the Gentoo mirror here, as we only use primaryuri for the MySQL tarball
58 SRC_URI="${SRC_URI} mirror://gentoo/${MYSQL_PATCHSET_FILENAME} http://gentoo.longitekk.com/${MYSQL_PATCHSET_FILENAME}" 58 SRC_URI="${SRC_URI} http://gentoo.longitekk.com/${MYSQL_PATCHSET_FILENAME}"
59fi 59fi
60 60
61DESCRIPTION="A fast, multi-threaded, multi-user SQL database server." 61DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
62HOMEPAGE="http://www.mysql.com/" 62HOMEPAGE="http://www.mysql.com/"
63SLOT="0" 63SLOT="0"
64LICENSE="GPL-2" 64LICENSE="GPL-2"
65IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static" 65IUSE="big-tables berkdb debug embedded minimal perl selinux srvdir ssl static"
66RESTRICT="primaryuri confcache" 66RESTRICT="confcache"
67 67
68mysql_version_is_at_least "4.01.00.00" \ 68mysql_version_is_at_least "4.01.00.00" \
69&& IUSE="${IUSE} latin1" 69&& IUSE="${IUSE} latin1"
70 70
71mysql_version_is_at_least "4.01.03.00" \ 71mysql_version_is_at_least "4.01.03.00" \
79 79
80mysql_version_is_at_least "5.01.00.00" \ 80mysql_version_is_at_least "5.01.00.00" \
81&& IUSE="${IUSE} innodb" 81&& IUSE="${IUSE} innodb"
82 82
83EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst \ 83EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst \
84 pkg_postinst pkg_config pkg_postrm 84 pkg_postinst pkg_config pkg_postrm
85
86#
87# HELPER FUNCTIONS:
88#
85 89
86# void mysql_init_vars() 90# void mysql_init_vars()
87# 91#
88# Initialize global variables 92# Initialize global variables
89# 2005-11-19 <vivo@gentoo.org> 93# 2005-11-19 <vivo@gentoo.org>
137 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR 141 export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
138 export MY_INCLUDEDIR 142 export MY_INCLUDEDIR
139 export DATADIR 143 export DATADIR
140} 144}
141 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
142mysql_pkg_setup() { 307mysql_pkg_setup() {
143 enewgroup mysql 60 || die "problem adding 'mysql' group" 308 enewgroup mysql 60 || die "problem adding 'mysql' group"
144 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
145 314
146 # Check for USE flag problems in pkg_setup 315 # Check for USE flag problems in pkg_setup
147 if useq "static" && useq "ssl" ; then 316 if useq "static" && useq "ssl" ; then
148 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!"
149 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!"
161 && ( useq "cluster" || useq "extraengine" ) \ 330 && ( useq "cluster" || useq "extraengine" ) \
162 && useq "minimal" ; then 331 && useq "minimal" ; then
163 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 332 eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
164 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!" 333 die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
165 fi 334 fi
335
336 useq "berkdb" && ewarn "Berkley DB support is deprecated and will be removed in future versions"
166} 337}
167 338
168mysql_src_unpack() { 339mysql_src_unpack() {
169 # Initialize the proper variables first 340 # Initialize the proper variables first
170 mysql_init_vars 341 mysql_init_vars
183 rm -f "${S}/zlib/"*.[ch] 354 rm -f "${S}/zlib/"*.[ch]
184 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"
185 rm -f "scripts/mysqlbug" 356 rm -f "scripts/mysqlbug"
186 357
187 # Make charsets install in the right place 358 # Make charsets install in the right place
359 find . -name 'Makefile.am' \
188 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' {} \;
189 361
190 # Manage mysqlmanager 362 # Manage mysqlmanager
191 mysql_version_is_at_least "5.00.15.00" \ 363 mysql_version_is_at_least "5.00.15.00" \
192 && 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"
193 367
194 if mysql_version_is_at_least "4.01.00.00" ; then 368 if mysql_version_is_at_least "4.01.00.00" ; then
195 # 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
196 find . -name Makefile \ 370 find . -name Makefile \
197 -o -name Makefile.in \ 371 -o -name Makefile.in \
198 -o -name configure \ 372 -o -name configure \
199 -exec rm -f {} \; 373 -exec rm -f {} \;
200 rm -f "ltmain.sh" 374 rm -f "ltmain.sh"
375 rm -f "scripts/mysqlbug"
201 fi 376 fi
202 377
203 local rebuilddirlist bdbdir d 378 local rebuilddirlist bdbdir d
204 379
205 if mysql_version_is_at_least "5.01.00.00" ; then 380 if mysql_version_is_at_least "5.01.00.00" ; then
407 filter-flags "-O" "-O[01]" 582 filter-flags "-O" "-O[01]"
408 583
409 # glib-2.3.2_pre fix, bug #16496 584 # glib-2.3.2_pre fix, bug #16496
410 append-flags "-DHAVE_ERRNO_AS_DEFINE=1" 585 append-flags "-DHAVE_ERRNO_AS_DEFINE=1"
411 586
412 # The compiler flags are as their "official" spec says ;)
413 append-flags "-fno-exceptions -fno-strict-aliasing" 587 append-flags "-fno-exceptions -fno-strict-aliasing"
414 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" 588 CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti"
415 mysql_version_is_at_least "5.00.00.00" \ 589 mysql_version_is_at_least "5.00.00.00" \
416 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" 590 && CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
417 export CXXFLAGS="${CXXFLAGS}" 591 export CXXFLAGS="${CXXFLAGS}"
456 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" 630 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
457 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" 631 dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
458 632
459 # Various junk (my-*.cnf moved elsewhere) 633 # Various junk (my-*.cnf moved elsewhere)
460 rm -Rf "${D}/usr/share/info" 634 rm -Rf "${D}/usr/share/info"
461 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
462 rm -f "${D}"/usr/share/mysql/${removeme} 638 rm -f "${D}"/usr/share/mysql/${removeme}
463 done 639 done
464 640
465 # Clean up stuff for a minimal build 641 # Clean up stuff for a minimal build
466 if useq "minimal" ; then 642 if useq "minimal" ; then
548mysql_pkg_postinst() { 724mysql_pkg_postinst() {
549 # Make sure the vars are correctly initialized 725 # Make sure the vars are correctly initialized
550 mysql_init_vars 726 mysql_init_vars
551 727
552 # Check FEATURES="collision-protect" before removing this 728 # Check FEATURES="collision-protect" before removing this
729 [[ -d "${ROOT}/var/log/mysql" ]] \
553 [[ -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}"
554 731
555 # Secure the logfiles 732 # Secure the logfiles
556 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err} 733 touch "${ROOT}${MY_LOGDIR}"/mysql.{log,err}
557 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql* 734 chown mysql:mysql "${ROOT}${MY_LOGDIR}"/mysql*
558 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql* 735 chmod 0660 "${ROOT}${MY_LOGDIR}"/mysql*
565 einfo "if this is a new install." 742 einfo "if this is a new install."
566 einfo 743 einfo
567 mysql_version_is_at_least "5.01.00.00" \ 744 mysql_version_is_at_least "5.01.00.00" \
568 || 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."
569 fi 746 fi
747 useq "berkdb" && ewarn "Berkley DB support is deprecated and will be removed in future versions"
570} 748}
571 749
572mysql_pkg_config() { 750mysql_pkg_config() {
573 # Make sure the vars are correctly initialized 751 # Make sure the vars are correctly initialized
574 mysql_init_vars 752 mysql_init_vars

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

  ViewVC Help
Powered by ViewVC 1.1.20