Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: mysql.eclass
Date: Tue, 27 Apr 2010 05:45:58
Message-Id: 20100427054555.458302C04C@corvid.gentoo.org
1 robbat2 10/04/27 05:45:55
2
3 Modified: mysql.eclass
4 Log:
5 Fix up MariaDB SRC_URI. Building for PBXT and XtraDB. Radically improve plugin handling.
6
7 Revision Changes Path
8 1.145 eclass/mysql.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/mysql.eclass?rev=1.145&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/mysql.eclass?rev=1.145&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/mysql.eclass?r1=1.144&r2=1.145
13
14 Index: mysql.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v
17 retrieving revision 1.144
18 retrieving revision 1.145
19 diff -p -w -b -B -u -u -r1.144 -r1.145
20 --- mysql.eclass 1 Apr 2010 20:36:39 -0000 1.144
21 +++ mysql.eclass 27 Apr 2010 05:45:55 -0000 1.145
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2009 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.144 2010/04/01 20:36:39 robbat2 Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.145 2010/04/27 05:45:55 robbat2 Exp $
27
28 # @ECLASS: mysql.eclass
29 # @MAINTAINER:
30 @@ -154,7 +154,12 @@ if [ -z "${SERVER_URI}" ]; then
31 [ -z "${MY_PV}" ] && MY_PV="${PV//_/-}"
32 if [ "${PN}" == "mariadb" ]; then
33 MARIA_FULL_PV="$(replace_version_separator 3 '-' ${PV})"
34 - SERVER_URI="http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/mariadb-${MARIA_FULL_PV}.tar.gz"
35 + MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
36 + SERVER_URI="
37 + http://ftp.rediris.es/mirror/MariaDB/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
38 + http://maria.llarian.net/download/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
39 + http://launchpad.net/maria/${MYSQL_PV_MAJOR}/ongoing/+download/${MARIA_FULL_P}.tar.gz
40 + "
41 # The community build is on the mirrors
42 elif [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then
43 SERVER_URI="mirror://mysql/Downloads/MySQL-${PV%.*}/mysql-${MY_PV}.tar.gz"
44 @@ -239,15 +245,22 @@ pbxt_patch_available \
45 && PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
46 && SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \
47
48 +# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
49 +# vs. built outside the dir
50 pbxt_available \
51 -&& IUSE="${IUSE} pbxt"
52 +&& IUSE="${IUSE} pbxt" \
53 +&& mysql_version_is_at_least "5.1.40" \
54 +&& PBXT_NEWSTYLE=1
55
56 xtradb_patch_available \
57 && XTRADB_P="percona-xtradb-${XTRADB_VER}" \
58 && XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
59 -&& XTRADB_SRC_URI1="http://www.percona.com/percona-builds/xtradb/${XTRADB_SRC_URI_COMMON}" \
60 -&& XTRADB_SRC_URI2="http://www.percona.com/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \
61 -&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} )" \
62 +&& XTRADB_SRC_B1="http://www.percona.com/" \
63 +&& XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" \
64 +&& XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" \
65 +&& XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" \
66 +&& XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \
67 +&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" \
68 && IUSE="${IUSE} xtradb"
69
70 #
71 @@ -526,6 +539,8 @@ configure_51() {
72 myconf="${myconf} --with-readline"
73 myconf="${myconf} --with-zlib-dir=/usr/"
74 myconf="${myconf} --without-pstack"
75 + myconf="${myconf} --with-plugindir=/usr/$(get_libdir)/mysql/plugin"
76 +
77 use max-idx-128 && myconf="${myconf} --with-max-indexes=128"
78 if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then
79 myconf="${myconf} $(use_enable community community-features)"
80 @@ -536,15 +551,45 @@ configure_51() {
81 fi
82 fi
83
84 + # Scan for all available plugins
85 + local plugins_avail="$(
86 + LANG=C \
87 + find "${S}" \
88 + \( \
89 + -name 'plug.in' \
90 + -o -iname 'configure.in' \
91 + -o -iname 'configure.ac' \
92 + \) \
93 + -print0 \
94 + | xargs -0 sed -r -n \
95 + -e '/^MYSQL_STORAGE_ENGINE/{
96 + s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ;
97 + s~^([^ ]+).*~\1~gp;
98 + }' \
99 + | tr -s '\n' ' '
100 + )"
101 +
102 # 5.1 introduces a new way to manage storage engines (plugins)
103 # like configuration=none
104 # This base set are required, and will always be statically built.
105 - local plugins="csv,myisam,myisammrg,heap"
106 + local plugins_sta="csv myisam myisammrg heap"
107 + local plugins_dyn=""
108 + local plugins_dis="example ibmdb2i"
109 +
110 + # These aren't actually required by the base set, but are really useful:
111 + plugins_sta="${plugins_sta} archive blackhole"
112 +
113 + # default in 5.5.4
114 + if mysql_version_is_at_least "5.5.4" ; then
115 + plugins_sta="${plugins_sta} partition"
116 + fi
117 + # Now the extras
118 if use extraengine ; then
119 # like configuration=max-no-ndb, archive and example removed in 5.1.11
120 # not added yet: ibmdb2i
121 # Not supporting as examples: example,daemon_example,ftexample
122 - plugins="${plugins},archive,blackhole,federated,partition"
123 + plugins_sta="${plugins_sta} partition"
124 + plugins_dyn="${plugins_sta} federated"
125
126 if [[ "${PN}" != "mariadb" ]] ; then
127 elog "Before using the Federated storage engine, please be sure to read"
128 @@ -553,37 +598,59 @@ configure_51() {
129 elog "MariaDB includes the FederatedX engine. Be sure to read"
130 elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine"
131 fi
132 + else
133 + plugins_dis="${plugins_dis} partition federated"
134 fi
135
136 # Upstream specifically requests that InnoDB always be built:
137 # - innobase, innodb_plugin
138 # Build falcon if available for 6.x series.
139 - for i in innobase innodb_plugin falcon ; do
140 - [ -e "${S}"/storage/${i} ] && plugins="${plugins},${i}"
141 + for i in innobase falcon ; do
142 + [ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}"
143 + done
144 + for i in innodb_plugin ; do
145 + [ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}"
146 done
147
148 # like configuration=max-no-ndb
149 if use cluster ; then
150 - plugins="${plugins},ndbcluster"
151 + plugins_sta="${plugins_sta} ndbcluster"
152 myconf="${myconf} --with-ndb-binlog"
153 + else
154 + plugins_dis="${plugins_dis} ndbcluster"
155 fi
156
157 if [[ "${PN}" == "mariadb" ]] ; then
158 # In MariaDB, InnoDB is packaged in the xtradb directory, so it's not
159 # caught above.
160 - plugins="${plugins},maria,innobase"
161 - if use pbxt ; then
162 - plugins="${plugins},pbxt"
163 - else
164 - myconf="${myconf} --without-plugin-pbxt"
165 - fi
166 + plugins_sta="${plugins_sta},maria,innobase"
167 myconf="${myconf} $(use_with libevent)"
168 # This is not optional, without it several upstream testcases fail.
169 # Also strongly recommended by upstream.
170 myconf="${myconf} --with-maria-tmp-tables"
171 fi
172
173 - myconf="${myconf} --with-plugins=${plugins}"
174 + if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then
175 + use pbxt \
176 + && plugins_dyn="${plugins_dyn} pbxt" \
177 + || plugins_dis="${plugins_dis} pbxt"
178 + fi
179 +
180 + use static && \
181 + plugins_sta="${plugins_sta} ${plugins_dyn}" && \
182 + plugins_dyn=""
183 +
184 + einfo "Available plugins: ${plugins_avail}"
185 + einfo "Dynamic plugins: ${plugins_dyn}"
186 + einfo "Static plugins: ${plugins_sta}"
187 + einfo "Disabled plugins: ${plugins_dis}"
188 +
189 + # These are the static plugins
190 + myconf="${myconf} --with-plugins=${plugins_sta// /,}"
191 + # And the disabled ones
192 + for i in ${plugins_dis} ; do
193 + myconf="${myconf} --without-plugin-${i}"
194 + done
195 }
196
197 pbxt_src_configure() {
198 @@ -639,8 +707,9 @@ mysql_pkg_setup() {
199
200 # Check for USE flag problems in pkg_setup
201 if use static && use ssl ; then
202 - eerror "MySQL does not support being built statically with SSL support enabled!"
203 - die "MySQL does not support being built statically with SSL support enabled!"
204 + M="MySQL does not support being built statically with SSL support enabled!"
205 + eerror "${M}"
206 + die "${M}"
207 fi
208
209 if ! mysql_version_is_at_least "5.0" \
210 @@ -652,10 +721,20 @@ mysql_pkg_setup() {
211 fi
212
213 if mysql_version_is_at_least "4.1.3" \
214 - && ( use cluster || use extraengine ) \
215 + && ( use cluster || use extraengine || use embedded ) \
216 && use minimal ; then
217 - eerror "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
218 - die "USE flags 'cluster' and 'extraengine' conflict with 'minimal' USE flag!"
219 + M="USE flags 'cluster', 'extraengine', 'embedded' conflict with 'minimal' USE flag!"
220 + eerror "${M}"
221 + die "${M}"
222 + fi
223 +
224 + if mysql_version_is_at_least "5.1" \
225 + && xtradb_patch_available \
226 + && use xtradb \
227 + && use embedded ; then
228 + M="USE flags 'xtradb' and 'embedded' conflict and cause build failures"
229 + eerror "${M}"
230 + die "${M}"
231 fi
232
233 # Bug #290570, 284946, 307251
234 @@ -754,16 +833,25 @@ mysql_src_prepare() {
235 local rebuilddirlist d
236
237 if xtradb_patch_available && use xtradb ; then
238 - einfo "Replacing InnoDB with Percona XtraDB"
239 - pushd "${S}"/storage
240 + einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)"
241 + pushd "${S}"/storage >/dev/null
242 i="innobase"
243 o="${WORKDIR}/storage-${i}.mysql-upstream"
244 # Have we been here already?
245 [ -d "${o}" ] && rm -f "${i}"
246 # Or maybe we haven't
247 [ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
248 - cp -ra "${WORKDIR}/${XTRADB_P}" "${i}"
249 - popd
250 + cp -ral "${WORKDIR}/${XTRADB_P}" "${i}"
251 + popd >/dev/null
252 + fi
253 +
254 + if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then
255 + einfo "Adding storage engine: PBXT"
256 + pushd "${S}"/storage >/dev/null
257 + i='pbxt'
258 + [ -d "${i}" ] && rm -rf "${i}"
259 + cp -ral "${WORKDIR}/${PBXT_P}" "${i}"
260 + popd >/dev/null
261 fi
262
263 if mysql_version_is_at_least "5.1.12" ; then
264 @@ -867,7 +955,7 @@ mysql_src_configure() {
265 | xargs -0 -n100 sed -i \
266 -e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
267
268 - if [[ $EAPI == 2 ]]; then
269 + if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
270 pbxt_patch_available && use pbxt && pbxt_src_configure
271 fi
272 }
273 @@ -884,7 +972,9 @@ mysql_src_compile() {
274
275 emake || die "emake failed"
276
277 + if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
278 pbxt_patch_available && use pbxt && pbxt_src_compile
279 + fi
280 }
281
282 # @FUNCTION: mysql_src_install
283 @@ -900,7 +990,9 @@ mysql_src_install() {
284 testroot="${MY_SHAREDSTATEDIR}" \
285 || die "emake install failed"
286
287 + if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
288 pbxt_patch_available && use pbxt && pbxt_src_install
289 + fi
290
291 # Convenience links
292 einfo "Making Convenience links for mysqlcheck multi-call binary"