| 1 |
# Copyright 1999-2013 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-autotools.eclass,v 1.15 2013/02/13 00:40:57 robbat2 Exp $ |
| 4 |
|
| 5 |
# @ECLASS: mysql-autotools.eclass |
| 6 |
# @MAINTAINER: |
| 7 |
# MySQL Team <mysql-bugs@gentoo.org> |
| 8 |
# Robin H. Johnson <robbat2@gentoo.org> |
| 9 |
# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> |
| 10 |
# Luca Longinotti <chtekk@gentoo.org> |
| 11 |
# @AUTHOR: |
| 12 |
# Francesco Riosa <vivo@gentoo.org> (retired) |
| 13 |
# @BLURB: This eclass provides support for autotools based mysql releases |
| 14 |
# @DESCRIPTION: |
| 15 |
# The mysql-autotools.eclass provides the support to build the mysql |
| 16 |
# ebuilds using the autotools build system. This eclass provides |
| 17 |
# the src_unpack, src_prepare, src_configure, src_compile, scr_install, |
| 18 |
# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. |
| 19 |
|
| 20 |
inherit autotools flag-o-matic multilib prefix |
| 21 |
|
| 22 |
# |
| 23 |
# HELPER FUNCTIONS: |
| 24 |
# |
| 25 |
|
| 26 |
# @FUNCTION: mysql-autotools_disable_test |
| 27 |
# @DESCRIPTION: |
| 28 |
# Helper function to disable specific tests. |
| 29 |
mysql-autotools_disable_test() { |
| 30 |
|
| 31 |
local rawtestname testname testsuite reason mysql_disable_file |
| 32 |
rawtestname="${1}" ; shift |
| 33 |
reason="${@}" |
| 34 |
ewarn "test '${rawtestname}' disabled: '${reason}'" |
| 35 |
|
| 36 |
testsuite="${rawtestname/.*}" |
| 37 |
testname="${rawtestname/*.}" |
| 38 |
mysql_disable_file="${S}/mysql-test/t/disabled.def" |
| 39 |
#einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" |
| 40 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
| 41 |
|
| 42 |
# ${S}/mysql-tests/t/disabled.def |
| 43 |
# |
| 44 |
# ${S}/mysql-tests/suite/federated/disabled.def |
| 45 |
# |
| 46 |
# ${S}/mysql-tests/suite/jp/t/disabled.def |
| 47 |
# ${S}/mysql-tests/suite/ndb/t/disabled.def |
| 48 |
# ${S}/mysql-tests/suite/rpl/t/disabled.def |
| 49 |
# ${S}/mysql-tests/suite/parts/t/disabled.def |
| 50 |
# ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def |
| 51 |
# ${S}/mysql-tests/suite/ndb_team/t/disabled.def |
| 52 |
# ${S}/mysql-tests/suite/binlog/t/disabled.def |
| 53 |
# ${S}/mysql-tests/suite/innodb/t/disabled.def |
| 54 |
if [ -n "${testsuite}" ]; then |
| 55 |
for mysql_disable_file in \ |
| 56 |
${S}/mysql-test/suite/${testsuite}/disabled.def \ |
| 57 |
${S}/mysql-test/suite/${testsuite}/t/disabled.def \ |
| 58 |
FAILED ; do |
| 59 |
[ -f "${mysql_disable_file}" ] && break |
| 60 |
done |
| 61 |
if [ "${mysql_disabled_file}" != "FAILED" ]; then |
| 62 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
| 63 |
else |
| 64 |
ewarn "Could not find testsuite disabled.def location for ${rawtestname}" |
| 65 |
fi |
| 66 |
fi |
| 67 |
} |
| 68 |
|
| 69 |
# @FUNCTION: mysql-autotools_configure_minimal |
| 70 |
# @DESCRIPTION: |
| 71 |
# Helper function to configure a minimal build |
| 72 |
mysql-autotools_configure_minimal() { |
| 73 |
|
| 74 |
# These are things we exclude from a minimal build, please |
| 75 |
# note that the server actually does get built and installed, |
| 76 |
# but we then delete it before packaging. |
| 77 |
local minimal_exclude_list="server embedded-server extra-tools innodb bench berkeley-db row-based-replication readline" |
| 78 |
|
| 79 |
for i in ${minimal_exclude_list} ; do |
| 80 |
myconf="${myconf} --without-${i}" |
| 81 |
done |
| 82 |
myconf="${myconf} --with-extra-charsets=none" |
| 83 |
myconf="${myconf} --enable-local-infile" |
| 84 |
|
| 85 |
if use static ; then |
| 86 |
myconf="${myconf} --with-client-ldflags=-all-static" |
| 87 |
myconf="${myconf} --disable-shared --with-pic" |
| 88 |
else |
| 89 |
myconf="${myconf} --enable-shared --enable-static" |
| 90 |
fi |
| 91 |
|
| 92 |
if ! use latin1 ; then |
| 93 |
myconf="${myconf} --with-charset=utf8" |
| 94 |
myconf="${myconf} --with-collation=utf8_general_ci" |
| 95 |
else |
| 96 |
myconf="${myconf} --with-charset=latin1" |
| 97 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
| 98 |
fi |
| 99 |
|
| 100 |
# MariaDB requires this flag in order to link to GPLv3 readline v6 or greater |
| 101 |
# A note is added to the configure output |
| 102 |
if [[ "${PN}" == "mariadb" ]] && mysql_version_is_at_least "5.1.61" ; then |
| 103 |
myconf="${myconf} --disable-distribution" |
| 104 |
fi |
| 105 |
} |
| 106 |
|
| 107 |
# @FUNCTION: mysql-autotools_configure_common |
| 108 |
# @DESCRIPTION: |
| 109 |
# Helper function to configure the common builds |
| 110 |
mysql-autotools_configure_common() { |
| 111 |
|
| 112 |
myconf="${myconf} $(use_with big-tables)" |
| 113 |
myconf="${myconf} --enable-local-infile" |
| 114 |
myconf="${myconf} --with-extra-charsets=all" |
| 115 |
myconf="${myconf} --with-mysqld-user=mysql" |
| 116 |
myconf="${myconf} --with-server" |
| 117 |
myconf="${myconf} --with-unix-socket-path=${EPREFIX}/var/run/mysqld/mysqld.sock" |
| 118 |
myconf="${myconf} --without-libwrap" |
| 119 |
|
| 120 |
if use static ; then |
| 121 |
myconf="${myconf} --with-mysqld-ldflags=-all-static" |
| 122 |
myconf="${myconf} --with-client-ldflags=-all-static" |
| 123 |
myconf="${myconf} --disable-shared --with-pic" |
| 124 |
else |
| 125 |
myconf="${myconf} --enable-shared --enable-static" |
| 126 |
fi |
| 127 |
|
| 128 |
if use debug ; then |
| 129 |
myconf="${myconf} --with-debug=full" |
| 130 |
else |
| 131 |
myconf="${myconf} --without-debug" |
| 132 |
if ( use cluster ); then |
| 133 |
myconf="${myconf} --without-ndb-debug" |
| 134 |
fi |
| 135 |
fi |
| 136 |
|
| 137 |
if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then |
| 138 |
ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
| 139 |
ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
| 140 |
ewarn "You MUST file bugs without these variables set." |
| 141 |
myconf="${myconf} --with-charset=${MYSQL_DEFAULT_CHARSET}" |
| 142 |
myconf="${myconf} --with-collation=${MYSQL_DEFAULT_COLLATION}" |
| 143 |
elif ! use latin1 ; then |
| 144 |
myconf="${myconf} --with-charset=utf8" |
| 145 |
myconf="${myconf} --with-collation=utf8_general_ci" |
| 146 |
else |
| 147 |
myconf="${myconf} --with-charset=latin1" |
| 148 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
| 149 |
fi |
| 150 |
|
| 151 |
if use embedded ; then |
| 152 |
myconf="${myconf} --with-embedded-privilege-control" |
| 153 |
myconf="${myconf} --with-embedded-server" |
| 154 |
else |
| 155 |
myconf="${myconf} --without-embedded-privilege-control" |
| 156 |
myconf="${myconf} --without-embedded-server" |
| 157 |
fi |
| 158 |
|
| 159 |
} |
| 160 |
|
| 161 |
# @FUNCTION: mysql-autotools_configure_51 |
| 162 |
# @DESCRIPTION: |
| 163 |
# Helper function to configure 5.1 and later builds |
| 164 |
mysql-autotools_configure_51() { |
| 165 |
|
| 166 |
# TODO: !!!! readd --without-readline |
| 167 |
# the failure depend upon config/ac-macros/readline.m4 checking into |
| 168 |
# readline.h instead of history.h |
| 169 |
myconf="${myconf} $(use_with ssl ssl "${EPREFIX}"/usr)" |
| 170 |
myconf="${myconf} --enable-assembler" |
| 171 |
myconf="${myconf} --with-geometry" |
| 172 |
myconf="${myconf} --with-readline" |
| 173 |
myconf="${myconf} --with-zlib-dir=${EPREFIX}/usr/" |
| 174 |
myconf="${myconf} --without-pstack" |
| 175 |
myconf="${myconf} --with-plugindir=${EPREFIX}/usr/$(get_libdir)/mysql/plugin" |
| 176 |
|
| 177 |
# This is an explict die here, because if we just forcibly disable it, then the |
| 178 |
# user's data is not accessible. |
| 179 |
use max-idx-128 && die "Bug #336027: upstream has a corruption issue with max-idx-128 presently" |
| 180 |
#use max-idx-128 && myconf="${myconf} --with-max-indexes=128" |
| 181 |
myconf="${myconf} $(use_enable community community-features)" |
| 182 |
if use community; then |
| 183 |
myconf="${myconf} $(use_enable profiling)" |
| 184 |
else |
| 185 |
myconf="${myconf} --disable-profiling" |
| 186 |
fi |
| 187 |
|
| 188 |
# Scan for all available plugins |
| 189 |
local plugins_avail="$( |
| 190 |
LANG=C \ |
| 191 |
find "${S}" \ |
| 192 |
\( \ |
| 193 |
-name 'plug.in' \ |
| 194 |
-o -iname 'configure.in' \ |
| 195 |
-o -iname 'configure.ac' \ |
| 196 |
\) \ |
| 197 |
-print0 \ |
| 198 |
| xargs -0 sed -r -n \ |
| 199 |
-e '/^MYSQL_STORAGE_ENGINE/{ |
| 200 |
s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ; |
| 201 |
s~^([^ ]+).*~\1~gp; |
| 202 |
}' \ |
| 203 |
| tr -s '\n' ' ' |
| 204 |
)" |
| 205 |
|
| 206 |
# 5.1 introduces a new way to manage storage engines (plugins) |
| 207 |
# like configuration=none |
| 208 |
# This base set are required, and will always be statically built. |
| 209 |
local plugins_sta="csv myisam myisammrg heap" |
| 210 |
local plugins_dyn="" |
| 211 |
local plugins_dis="example ibmdb2i" |
| 212 |
|
| 213 |
# These aren't actually required by the base set, but are really useful: |
| 214 |
plugins_sta="${plugins_sta} archive blackhole" |
| 215 |
|
| 216 |
# Now the extras |
| 217 |
if use extraengine ; then |
| 218 |
# like configuration=max-no-ndb, archive and example removed in 5.1.11 |
| 219 |
# not added yet: ibmdb2i |
| 220 |
# Not supporting as examples: example,daemon_example,ftexample |
| 221 |
plugins_sta="${plugins_sta} partition" |
| 222 |
|
| 223 |
if [[ "${PN}" != "mariadb" ]] ; then |
| 224 |
elog "Before using the Federated storage engine, please be sure to read" |
| 225 |
elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" |
| 226 |
plugins_dyn="${plugins_dyn} federated" |
| 227 |
else |
| 228 |
elog "MariaDB includes the FederatedX engine. Be sure to read" |
| 229 |
elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine" |
| 230 |
plugins_dyn="${plugins_dyn} federatedx" |
| 231 |
fi |
| 232 |
else |
| 233 |
plugins_dis="${plugins_dis} partition federated" |
| 234 |
fi |
| 235 |
|
| 236 |
# Upstream specifically requests that InnoDB always be built: |
| 237 |
# - innobase, innodb_plugin |
| 238 |
# Build falcon if available for 6.x series. |
| 239 |
for i in innobase falcon ; do |
| 240 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
| 241 |
done |
| 242 |
for i in innodb_plugin ; do |
| 243 |
[ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}" |
| 244 |
done |
| 245 |
|
| 246 |
# like configuration=max-no-ndb |
| 247 |
if ( use cluster ) ; then |
| 248 |
plugins_sta="${plugins_sta} ndbcluster partition" |
| 249 |
plugins_dis="${plugins_dis//partition}" |
| 250 |
myconf="${myconf} --with-ndb-binlog" |
| 251 |
else |
| 252 |
plugins_dis="${plugins_dis} ndbcluster" |
| 253 |
fi |
| 254 |
|
| 255 |
if [[ "${PN}" == "mariadb" ]] ; then |
| 256 |
# In MariaDB, InnoDB is packaged in the xtradb directory, so it's not |
| 257 |
# caught above. |
| 258 |
# This is not optional, without it several upstream testcases fail. |
| 259 |
# Also strongly recommended by upstream. |
| 260 |
if [[ "${PV}" < "5.2.0" ]] ; then |
| 261 |
myconf="${myconf} --with-maria-tmp-tables" |
| 262 |
plugins_sta="${plugins_sta} maria" |
| 263 |
else |
| 264 |
myconf="${myconf} --with-aria-tmp-tables" |
| 265 |
plugins_sta="${plugins_sta} aria" |
| 266 |
fi |
| 267 |
|
| 268 |
[ -e "${S}"/storage/innobase ] || [ -e "${S}"/storage/xtradb ] || |
| 269 |
die "The ${P} package doesn't provide innobase nor xtradb" |
| 270 |
|
| 271 |
for i in innobase xtradb ; do |
| 272 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
| 273 |
done |
| 274 |
|
| 275 |
myconf="${myconf} $(use_with libevent)" |
| 276 |
|
| 277 |
if mysql_version_is_at_least "5.2" ; then |
| 278 |
for i in oqgraph ; do |
| 279 |
use ${i} \ |
| 280 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
| 281 |
|| plugins_dis="${plugins_dis} ${i}" |
| 282 |
done |
| 283 |
fi |
| 284 |
|
| 285 |
if mysql_version_is_at_least "5.2.5" ; then |
| 286 |
for i in sphinx ; do |
| 287 |
use ${i} \ |
| 288 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
| 289 |
|| plugins_dis="${plugins_dis} ${i}" |
| 290 |
done |
| 291 |
fi |
| 292 |
|
| 293 |
#Authentication plugins |
| 294 |
if mysql_version_is_at_least "5.2.11" ; then |
| 295 |
for i in pam ; do |
| 296 |
use ${i} \ |
| 297 |
&& plugins_dyn="${plugins_dyn} auth_${i}" \ |
| 298 |
|| plugins_dis="${plugins_dis} auth_${i}" |
| 299 |
done |
| 300 |
fi |
| 301 |
fi |
| 302 |
|
| 303 |
if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then |
| 304 |
use pbxt \ |
| 305 |
&& plugins_sta="${plugins_sta} pbxt" \ |
| 306 |
|| plugins_dis="${plugins_dis} pbxt" |
| 307 |
fi |
| 308 |
|
| 309 |
use static && \ |
| 310 |
plugins_sta="${plugins_sta} ${plugins_dyn}" && \ |
| 311 |
plugins_dyn="" |
| 312 |
|
| 313 |
# Google MySQL, bundle what upstream supports |
| 314 |
if [[ "${PN}" == "google-mysql" ]]; then |
| 315 |
for x in innobase innodb_plugin innodb ; do |
| 316 |
plugins_sta="${plugins_sta//$x}" |
| 317 |
plugins_dyn="${plugins_dyn//$x}" |
| 318 |
done |
| 319 |
plugins_sta="${plugins_sta} innodb_plugin googlestats" |
| 320 |
myconf="${myconf} --with-perftools-dir=/usr --enable-perftools-tcmalloc" |
| 321 |
# use system lzo for google-mysql |
| 322 |
myconf="${myconf} --with-lzo2-dir=/usr" |
| 323 |
fi |
| 324 |
|
| 325 |
einfo "Available plugins: ${plugins_avail}" |
| 326 |
einfo "Dynamic plugins: ${plugins_dyn}" |
| 327 |
einfo "Static plugins: ${plugins_sta}" |
| 328 |
einfo "Disabled plugins: ${plugins_dis}" |
| 329 |
|
| 330 |
# These are the static plugins |
| 331 |
myconf="${myconf} --with-plugins=${plugins_sta// /,}" |
| 332 |
# And the disabled ones |
| 333 |
for i in ${plugins_dis} ; do |
| 334 |
myconf="${myconf} --without-plugin-${i}" |
| 335 |
done |
| 336 |
} |
| 337 |
|
| 338 |
pbxt_src_configure() { |
| 339 |
|
| 340 |
mysql_init_vars |
| 341 |
|
| 342 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
| 343 |
|
| 344 |
einfo "Reconfiguring dir '${PWD}'" |
| 345 |
eautoreconf |
| 346 |
|
| 347 |
local myconf="" |
| 348 |
myconf="${myconf} --with-mysql=${S} --libdir=${EPREFIX}/usr/$(get_libdir)" |
| 349 |
use debug && myconf="${myconf} --with-debug=full" |
| 350 |
econf ${myconf} || die "Problem configuring PBXT storage engine" |
| 351 |
} |
| 352 |
|
| 353 |
pbxt_src_compile() { |
| 354 |
|
| 355 |
# TODO: is it safe/needed to use emake here ? |
| 356 |
make || die "Problem making PBXT storage engine (${myconf})" |
| 357 |
|
| 358 |
popd |
| 359 |
# TODO: modify test suite for PBXT |
| 360 |
} |
| 361 |
|
| 362 |
pbxt_src_install() { |
| 363 |
|
| 364 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
| 365 |
emake install DESTDIR="${D}" || die "Failed to install PBXT" |
| 366 |
popd |
| 367 |
} |
| 368 |
|
| 369 |
# |
| 370 |
# EBUILD FUNCTIONS |
| 371 |
# |
| 372 |
|
| 373 |
# @FUNCTION: mysql-autotools_src_prepare |
| 374 |
# @DESCRIPTION: |
| 375 |
# Apply patches to the source code and remove unneeded bundled libs. |
| 376 |
mysql-autotools_src_prepare() { |
| 377 |
|
| 378 |
cd "${S}" |
| 379 |
|
| 380 |
# Apply the patches for this MySQL version |
| 381 |
EPATCH_SUFFIX="patch" |
| 382 |
mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
| 383 |
# Clean out old items |
| 384 |
rm -f "${EPATCH_SOURCE}"/* |
| 385 |
# Now link in right patches |
| 386 |
mysql_mv_patches |
| 387 |
# And apply |
| 388 |
epatch |
| 389 |
|
| 390 |
# last -fPIC fixup, per bug #305873 |
| 391 |
i="${S}"/storage/innodb_plugin/plug.in |
| 392 |
[ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" |
| 393 |
|
| 394 |
# Additional checks, remove bundled zlib |
| 395 |
rm -f "${S}/zlib/"*.[ch] |
| 396 |
sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" |
| 397 |
rm -f "scripts/mysqlbug" |
| 398 |
|
| 399 |
# Make charsets install in the right place |
| 400 |
find . -name 'Makefile.am' \ |
| 401 |
-exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
| 402 |
|
| 403 |
# Remove what needs to be recreated, so we're sure it's actually done |
| 404 |
einfo "Cleaning up old buildscript files" |
| 405 |
find . -name Makefile \ |
| 406 |
-o -name Makefile.in \ |
| 407 |
-o -name configure \ |
| 408 |
-exec rm -f {} \; |
| 409 |
rm -f "ltmain.sh" |
| 410 |
rm -f "scripts/mysqlbug" |
| 411 |
|
| 412 |
local rebuilddirlist d |
| 413 |
|
| 414 |
if xtradb_patch_available && use xtradb ; then |
| 415 |
einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)" |
| 416 |
pushd "${S}"/storage >/dev/null |
| 417 |
i="innobase" |
| 418 |
o="${WORKDIR}/storage-${i}.mysql-upstream" |
| 419 |
# Have we been here already? |
| 420 |
[ -d "${o}" ] && rm -f "${i}" |
| 421 |
# Or maybe we haven't |
| 422 |
[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" |
| 423 |
cp -ral "${WORKDIR}/${XTRADB_P}" "${i}" |
| 424 |
popd >/dev/null |
| 425 |
fi |
| 426 |
|
| 427 |
if pbxt_patch_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then |
| 428 |
einfo "Adding storage engine: PBXT" |
| 429 |
pushd "${S}"/storage >/dev/null |
| 430 |
i='pbxt' |
| 431 |
[ -d "${i}" ] && rm -rf "${i}" |
| 432 |
cp -ral "${WORKDIR}/${PBXT_P}" "${i}" |
| 433 |
f="${WORKDIR}/mysql-extras/pbxt/fix-low-priority.patch" |
| 434 |
[[ -f $f ]] && epatch "$f" |
| 435 |
popd >/dev/null |
| 436 |
fi |
| 437 |
|
| 438 |
rebuilddirlist="." |
| 439 |
# This does not seem to be needed presently. robbat2 2010/02/23 |
| 440 |
#einfo "Updating innobase cmake" |
| 441 |
## TODO: check this with a cmake expert |
| 442 |
#cmake \ |
| 443 |
# -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ |
| 444 |
# -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ |
| 445 |
# "storage/innobase" |
| 446 |
|
| 447 |
for d in ${rebuilddirlist} ; do |
| 448 |
einfo "Reconfiguring dir '${d}'" |
| 449 |
pushd "${d}" &>/dev/null |
| 450 |
eautoreconf |
| 451 |
popd &>/dev/null |
| 452 |
done |
| 453 |
} |
| 454 |
|
| 455 |
# @FUNCTION: mysql-autotools_src_configure |
| 456 |
# @DESCRIPTION: |
| 457 |
# Configure mysql to build the code for Gentoo respecting the use flags. |
| 458 |
mysql-autotools_src_configure() { |
| 459 |
# bug 401733 |
| 460 |
export QA_CONFIGURE_OPTIONS=".*" |
| 461 |
|
| 462 |
# Make sure the vars are correctly initialized |
| 463 |
mysql_init_vars |
| 464 |
|
| 465 |
# $myconf is modified by the configure_* functions |
| 466 |
local myconf="" |
| 467 |
|
| 468 |
if use minimal ; then |
| 469 |
mysql-autotools_configure_minimal |
| 470 |
else |
| 471 |
mysql-autotools_configure_common |
| 472 |
mysql-autotools_configure_51 |
| 473 |
fi |
| 474 |
|
| 475 |
# Bug #114895, bug #110149 |
| 476 |
filter-flags "-O" "-O[01]" |
| 477 |
|
| 478 |
# glib-2.3.2_pre fix, bug #16496 |
| 479 |
append-cppflags "-DHAVE_ERRNO_AS_DEFINE=1" |
| 480 |
|
| 481 |
# As discovered by bug #246652, doing a double-level of SSP causes NDB to |
| 482 |
# fail badly during cluster startup. |
| 483 |
if [[ $(gcc-major-version) -lt 4 ]]; then |
| 484 |
filter-flags "-fstack-protector-all" |
| 485 |
fi |
| 486 |
|
| 487 |
CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" |
| 488 |
CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" |
| 489 |
# storage/googlestats, sql/ in google-mysql are using C++ templates |
| 490 |
# implicitly. Upstream might be interested in this, exclude |
| 491 |
# -fno-implicit-templates for google-mysql for now. |
| 492 |
mysql_version_is_at_least "5.0" \ |
| 493 |
&& [[ "${PN}" != "google-mysql" ]] \ |
| 494 |
&& CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" |
| 495 |
export CXXFLAGS |
| 496 |
|
| 497 |
# bug #283926, with GCC4.4, this is required to get correct behavior. |
| 498 |
append-flags -fno-strict-aliasing |
| 499 |
|
| 500 |
# bug #335185, #335995, with >= GCC4.3.3 on x86 only, omit-frame-pointer |
| 501 |
# causes a mis-compile. |
| 502 |
# Upstream bugs: |
| 503 |
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38562 |
| 504 |
# http://bugs.mysql.com/bug.php?id=45205 |
| 505 |
use x86 && version_is_at_least "4.3.3" "$(gcc-fullversion)" && \ |
| 506 |
append-flags -fno-omit-frame-pointer && \ |
| 507 |
filter-flags -fomit-frame-pointer |
| 508 |
|
| 509 |
econf \ |
| 510 |
--libexecdir="${EPREFIX}/usr/sbin" \ |
| 511 |
--sysconfdir="${MY_SYSCONFDIR}" \ |
| 512 |
--localstatedir="${MY_LOCALSTATEDIR}" \ |
| 513 |
--sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
| 514 |
--libdir="${MY_LIBDIR}" \ |
| 515 |
--includedir="${MY_INCLUDEDIR}" \ |
| 516 |
--with-low-memory \ |
| 517 |
--with-client-ldflags=-lstdc++ \ |
| 518 |
--enable-thread-safe-client \ |
| 519 |
--with-comment="Gentoo Linux ${PF}" \ |
| 520 |
--without-docs \ |
| 521 |
--with-LIBDIR="$(get_libdir)" \ |
| 522 |
${myconf} || die "econf failed" |
| 523 |
|
| 524 |
# TODO: Move this before autoreconf !!! |
| 525 |
find . -type f -name Makefile -print0 \ |
| 526 |
| xargs -0 -n100 sed -i \ |
| 527 |
-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' |
| 528 |
|
| 529 |
if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
| 530 |
pbxt_patch_available && use pbxt && pbxt_src_configure |
| 531 |
fi |
| 532 |
} |
| 533 |
|
| 534 |
# @FUNCTION: mysql-autotools_src_compile |
| 535 |
# @DESCRIPTION: |
| 536 |
# Compile the mysql code. |
| 537 |
mysql-autotools_src_compile() { |
| 538 |
|
| 539 |
emake || die "emake failed" |
| 540 |
|
| 541 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
| 542 |
pbxt_patch_available && use pbxt && pbxt_src_compile |
| 543 |
fi |
| 544 |
} |
| 545 |
|
| 546 |
# @FUNCTION: mysql-autotools_src_install |
| 547 |
# @DESCRIPTION: |
| 548 |
# Install mysql. |
| 549 |
mysql-autotools_src_install() { |
| 550 |
|
| 551 |
# Make sure the vars are correctly initialized |
| 552 |
mysql_init_vars |
| 553 |
|
| 554 |
emake install \ |
| 555 |
DESTDIR="${D}" \ |
| 556 |
benchdir_root="${MY_SHAREDSTATEDIR}" \ |
| 557 |
testroot="${MY_SHAREDSTATEDIR}" \ |
| 558 |
|| die "emake install failed" |
| 559 |
|
| 560 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
| 561 |
pbxt_patch_available && use pbxt && pbxt_src_install |
| 562 |
fi |
| 563 |
|
| 564 |
# Convenience links |
| 565 |
einfo "Making Convenience links for mysqlcheck multi-call binary" |
| 566 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" |
| 567 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" |
| 568 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" |
| 569 |
|
| 570 |
# Various junk (my-*.cnf moved elsewhere) |
| 571 |
einfo "Removing duplicate /usr/share/mysql files" |
| 572 |
rm -Rf "${ED}/usr/share/info" |
| 573 |
for removeme in "mysql-log-rotate" mysql.server* \ |
| 574 |
binary-configure* my-*.cnf mi_test_all* |
| 575 |
do |
| 576 |
rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme} |
| 577 |
done |
| 578 |
|
| 579 |
# Clean up stuff for a minimal build |
| 580 |
if use minimal ; then |
| 581 |
einfo "Remove all extra content for minimal build" |
| 582 |
rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} |
| 583 |
rm -f "${ED}"/usr/bin/{mysql{_install_db,manager*,_secure_installation,_fix_privilege_tables,hotcopy,_convert_table_format,d_multi,_fix_extensions,_zap,_explain_log,_tableinfo,d_safe,_install,_waitpid,binlog,test},myisam*,isam*,pack_isam} |
| 584 |
rm -f "${ED}/usr/sbin/mysqld" |
| 585 |
rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a |
| 586 |
fi |
| 587 |
|
| 588 |
# Unless they explicitly specific USE=test, then do not install the |
| 589 |
# testsuite. It DOES have a use to be installed, esp. when you want to do a |
| 590 |
# validation of your database configuration after tuning it. |
| 591 |
if use !test ; then |
| 592 |
rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test |
| 593 |
fi |
| 594 |
|
| 595 |
# Configuration stuff |
| 596 |
case ${MYSQL_PV_MAJOR} in |
| 597 |
5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;; |
| 598 |
esac |
| 599 |
einfo "Building default my.cnf (${mysql_mycnf_version})" |
| 600 |
insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
| 601 |
doins scripts/mysqlaccess.conf |
| 602 |
mycnf_src="my.cnf-${mysql_mycnf_version}" |
| 603 |
sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
| 604 |
-e "s!/tmp!${EPREFIX}/tmp!" \ |
| 605 |
-e "s!/usr!${EPREFIX}/usr!" \ |
| 606 |
-e "s!= /var!= ${EPREFIX}/var!" \ |
| 607 |
"${FILESDIR}/${mycnf_src}" \ |
| 608 |
> "${TMPDIR}/my.cnf.ok" |
| 609 |
if use latin1 ; then |
| 610 |
sed -i \ |
| 611 |
-e "/character-set/s|utf8|latin1|g" \ |
| 612 |
"${TMPDIR}/my.cnf.ok" |
| 613 |
fi |
| 614 |
eprefixify "${TMPDIR}/my.cnf.ok" |
| 615 |
newins "${TMPDIR}/my.cnf.ok" my.cnf |
| 616 |
|
| 617 |
# Minimal builds don't have the MySQL server |
| 618 |
if ! use minimal ; then |
| 619 |
einfo "Creating initial directories" |
| 620 |
# Empty directories ... |
| 621 |
diropts "-m0750" |
| 622 |
keepdir "${MY_DATADIR#${EPREFIX}}" |
| 623 |
if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
| 624 |
chown -R mysql:mysql "${D}/${MY_DATADIR}" |
| 625 |
fi |
| 626 |
|
| 627 |
diropts "-m0755" |
| 628 |
for folder in "${MY_LOGDIR#${EPREFIX}}" "/var/run/mysqld" ; do |
| 629 |
dodir "${folder}" |
| 630 |
keepdir "${folder}" |
| 631 |
chown -R mysql:mysql "${ED}/${folder}" |
| 632 |
done |
| 633 |
fi |
| 634 |
|
| 635 |
# Docs |
| 636 |
einfo "Installing docs" |
| 637 |
for i in README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE ; do |
| 638 |
[[ -f "$i" ]] && dodoc "$i" |
| 639 |
done |
| 640 |
doinfo "${S}"/Docs/mysql.info |
| 641 |
|
| 642 |
# Minimal builds don't have the MySQL server |
| 643 |
if ! use minimal ; then |
| 644 |
einfo "Including support files and sample configurations" |
| 645 |
docinto "support-files" |
| 646 |
for script in \ |
| 647 |
"${S}"/support-files/my-*.cnf \ |
| 648 |
"${S}"/support-files/magic \ |
| 649 |
"${S}"/support-files/ndb-config-2-node.ini |
| 650 |
do |
| 651 |
[[ -f "$script" ]] && dodoc "${script}" |
| 652 |
done |
| 653 |
|
| 654 |
docinto "scripts" |
| 655 |
for script in "${S}"/scripts/mysql* ; do |
| 656 |
[[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" |
| 657 |
done |
| 658 |
|
| 659 |
fi |
| 660 |
|
| 661 |
mysql_lib_symlinks "${ED}" |
| 662 |
|
| 663 |
#Remove mytop if perl is not selected |
| 664 |
[[ "${PN}" == "mariadb" ]] && ! use perl \ |
| 665 |
&& mysql_version_is_at_least "5.3" \ |
| 666 |
&& rm -f "${ED}/usr/bin/mytop" |
| 667 |
|
| 668 |
#Bug 455462 remove unnecessary libtool files |
| 669 |
prune_libtool_files --modules |
| 670 |
} |