1 |
commit: 3fe1ce4d714e762e7212df1c2ffbaa49cc408c6c |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 27 13:38:19 2018 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 27 13:38:19 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3fe1ce4d |
7 |
|
8 |
mysql-multilib.eclass: Drop unused eclass |
9 |
|
10 |
Fixes: https://bugs.gentoo.org/642706 |
11 |
|
12 |
eclass/mysql-multilib.eclass | 1156 ------------------------------------------ |
13 |
1 file changed, 1156 deletions(-) |
14 |
|
15 |
diff --git a/eclass/mysql-multilib.eclass b/eclass/mysql-multilib.eclass |
16 |
deleted file mode 100644 |
17 |
index 5b200bc4ca7..00000000000 |
18 |
--- a/eclass/mysql-multilib.eclass |
19 |
+++ /dev/null |
20 |
@@ -1,1156 +0,0 @@ |
21 |
-# Copyright 1999-2015 Gentoo Foundation |
22 |
-# Distributed under the terms of the GNU General Public License v2 |
23 |
- |
24 |
-# @DEAD |
25 |
-# @ECLASS: mysql-multilib.eclass |
26 |
-# @MAINTAINER: |
27 |
-# Maintainers: |
28 |
-# - MySQL Team <mysql-bugs@g.o> |
29 |
-# - Robin H. Johnson <robbat2@g.o> |
30 |
-# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o> |
31 |
-# - Brian Evans <grknight@g.o> |
32 |
-# @BLURB: This eclass provides most of the functions for mysql ebuilds |
33 |
-# @DESCRIPTION: |
34 |
-# The mysql-multilib.eclass is the base eclass to build the mysql and |
35 |
-# alternative projects (mariadb and percona) ebuilds. |
36 |
-# This eclass uses the mysql-cmake eclass for the |
37 |
-# specific bits related to the build system. |
38 |
-# It provides the src_unpack, src_prepare, src_configure, src_compile, |
39 |
-# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm |
40 |
-# phase hooks. |
41 |
- |
42 |
-die "Please upgrade to mysql-multilib-r1. This eclass is due to be removed." |
43 |
- |
44 |
-MYSQL_EXTRAS="" |
45 |
- |
46 |
-# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER |
47 |
-# @DESCRIPTION: |
48 |
-# The version of the MYSQL_EXTRAS repo to use to build mysql |
49 |
-# Use "none" to disable it's use |
50 |
-[[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-r3" |
51 |
- |
52 |
-inherit eutils systemd flag-o-matic ${MYSQL_EXTRAS} mysql-cmake mysql_fx versionator \ |
53 |
- toolchain-funcs user cmake-utils multilib-minimal |
54 |
- |
55 |
-# |
56 |
-# Supported EAPI versions and export functions |
57 |
-# |
58 |
- |
59 |
-case "${EAPI:-0}" in |
60 |
- 5) ;; |
61 |
- *) die "Unsupported EAPI: ${EAPI}" ;; |
62 |
-esac |
63 |
- |
64 |
-EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config |
65 |
- |
66 |
-# |
67 |
-# VARIABLES: |
68 |
-# |
69 |
- |
70 |
-# @ECLASS-VARIABLE: MYSQL_CMAKE_NATIVE_DEFINES |
71 |
-# @DESCRIPTION: |
72 |
-# Add extra CMake arguments for native multilib builds |
73 |
- |
74 |
-# @ECLASS-VARIABLE: MYSQL_CMAKE_NONNATIVE_DEFINES |
75 |
-# @DESCRIPTION: |
76 |
-# Add extra CMake arguments for non-native multilib builds |
77 |
- |
78 |
-# @ECLASS-VARIABLE: MYSQL_CMAKE_EXTRA_DEFINES |
79 |
-# @DESCRIPTION: |
80 |
-# Add extra CMake arguments |
81 |
- |
82 |
-# Shorten the path because the socket path length must be shorter than 107 chars |
83 |
-# and we will run a mysql server during test phase |
84 |
-S="${WORKDIR}/mysql" |
85 |
- |
86 |
-[[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z" |
87 |
-if [[ ${MY_EXTRAS_VER} == "live" ]]; then |
88 |
- EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" |
89 |
- EGIT_CHECKOUT_DIR=${WORKDIR}/mysql-extras |
90 |
- EGIT_CLONE_TYPE=shallow |
91 |
-fi |
92 |
- |
93 |
-# @ECLASS-VARIABLE: MYSQL_PV_MAJOR |
94 |
-# @DESCRIPTION: |
95 |
-# Upstream MySQL considers the first two parts of the version number to be the |
96 |
-# major version. Upgrades that change major version should always run |
97 |
-# mysql_upgrade. |
98 |
-MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" |
99 |
- |
100 |
-# Cluster is a special case... |
101 |
-if [[ "${PN}" == "mysql-cluster" ]]; then |
102 |
- case $PV in |
103 |
- 7.2*) MYSQL_PV_MAJOR=5.5 ;; |
104 |
- 7.3*) MYSQL_PV_MAJOR=5.6 ;; |
105 |
- esac |
106 |
-fi |
107 |
- |
108 |
-# MariaDB has left the numbering schema but keeping compatibility |
109 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then |
110 |
- case ${PV} in |
111 |
- 10.0*) MYSQL_PV_MAJOR="5.6" ;; |
112 |
- 10.1*) MYSQL_PV_MAJOR="5.6" ;; |
113 |
- esac |
114 |
-fi |
115 |
- |
116 |
-# @ECLASS-VARIABLE: MYSQL_VERSION_ID |
117 |
-# @DESCRIPTION: |
118 |
-# MYSQL_VERSION_ID will be: |
119 |
-# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99] |
120 |
-# This is an important part, because many of the choices the MySQL ebuild will do |
121 |
-# depend on this variable. |
122 |
-# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803" |
123 |
-# We also strip off upstream's trailing letter that they use to respin tarballs |
124 |
-MYSQL_VERSION_ID="" |
125 |
-tpv="${PV%[a-z]}" |
126 |
-tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" |
127 |
-for vatom in 0 1 2 3 ; do |
128 |
- # pad to length 2 |
129 |
- tpv[${vatom}]="00${tpv[${vatom}]}" |
130 |
- MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}" |
131 |
-done |
132 |
-# strip leading "0" (otherwise it's considered an octal number by BASH) |
133 |
-MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} |
134 |
- |
135 |
-# This eclass should only be used with at least mysql-5.5.35 |
136 |
-mysql_version_is_at_least "5.5.35" || die "This eclass should only be used with >=mysql-5.5.35" |
137 |
- |
138 |
-# Work out the default SERVER_URI correctly |
139 |
-if [[ -z ${SERVER_URI} ]]; then |
140 |
- [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}" |
141 |
- if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then |
142 |
- # Beginning with 5.5, MariaDB stopped putting beta, alpha or rc on their tarball names |
143 |
- mysql_version_is_at_least "5.5" && MARIA_FULL_PV=$(get_version_component_range 1-3) || \ |
144 |
- MARIA_FULL_PV=$(replace_version_separator 3 '-' ${MY_PV}) |
145 |
- MARIA_FULL_P="${PN}-${MARIA_FULL_PV}" |
146 |
- SERVER_URI=" |
147 |
- http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
148 |
- http://mirror.jmu.edu/pub/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
149 |
- http://mirrors.coreix.net/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
150 |
- http://mirrors.syringanetworks.net/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
151 |
- http://mirrors.fe.up.pt/pub/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
152 |
- http://mirror2.hs-esslingen.de/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz |
153 |
- http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
154 |
- http://mirror.jmu.edu/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
155 |
- http://mirrors.coreix.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
156 |
- http://mirrors.syringanetworks.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
157 |
- http://mirrors.fe.up.pt/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
158 |
- http://mirror2.hs-esslingen.de/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz |
159 |
- " |
160 |
- if [[ ${PN} == "mariadb-galera" ]]; then |
161 |
- MY_SOURCEDIR="${PN%%-galera}-${MARIA_FULL_PV}" |
162 |
- fi |
163 |
- elif [[ ${PN} == "percona-server" ]]; then |
164 |
- PERCONA_PN="Percona-Server" |
165 |
- MIRROR_PV=$(get_version_component_range 1-2 ${PV}) |
166 |
- MY_PV=$(get_version_component_range 1-3 ${PV}) |
167 |
- PERCONA_RELEASE=$(get_version_component_range 4-5 ${PV}) |
168 |
- PERCONA_RC=$(get_version_component_range 6 ${PV}) |
169 |
- SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/${PERCONA_PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}/source/tarball/${PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}.tar.gz" |
170 |
-# http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/Percona-Server-5.5.30-rel30.2.tar.gz |
171 |
-# http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.13-rc60.5/source/tarball/Percona-Server-5.6.13-rc60.5.tar.gz |
172 |
- else |
173 |
- if [[ "${PN}" == "mysql-cluster" ]] ; then |
174 |
- URI_DIR="MySQL-Cluster" |
175 |
- URI_FILE="mysql-cluster-gpl" |
176 |
- else |
177 |
- URI_DIR="MySQL" |
178 |
- URI_FILE="mysql" |
179 |
- fi |
180 |
- URI_A="${URI_FILE}-${MY_PV}.tar.gz" |
181 |
- MIRROR_PV=$(get_version_component_range 1-2 ${PV}) |
182 |
- # Recently upstream switched to an archive site, and not on mirrors |
183 |
- SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A} |
184 |
- mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}" |
185 |
- fi |
186 |
-fi |
187 |
- |
188 |
-# Define correct SRC_URIs |
189 |
-SRC_URI="${SERVER_URI}" |
190 |
- |
191 |
-# Gentoo patches to MySQL |
192 |
-if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then |
193 |
- SRC_URI="${SRC_URI} |
194 |
- mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
195 |
- https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
196 |
- https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
197 |
- https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
198 |
-fi |
199 |
- |
200 |
-DESCRIPTION="A fast, multi-threaded, multi-user SQL database server" |
201 |
-HOMEPAGE="http://www.mysql.com/" |
202 |
-if [[ ${PN} == "mariadb" ]]; then |
203 |
- HOMEPAGE="http://mariadb.org/" |
204 |
- DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
205 |
-fi |
206 |
-if [[ ${PN} == "mariadb-galera" ]]; then |
207 |
- HOMEPAGE="http://mariadb.org/" |
208 |
- DESCRIPTION="An enhanced, drop-in replacement for MySQL with Galera Replication" |
209 |
-fi |
210 |
-if [[ ${PN} == "percona-server" ]]; then |
211 |
- HOMEPAGE="http://www.percona.com/software/percona-server" |
212 |
- DESCRIPTION="An enhanced, drop-in replacement for MySQL from the Percona team" |
213 |
-fi |
214 |
-LICENSE="GPL-2" |
215 |
-SLOT="0/${SUBSLOT:-0}" |
216 |
- |
217 |
-IUSE="debug embedded extraengine jemalloc latin1 libressl +openssl |
218 |
- +perl profiling selinux systemtap static static-libs tcmalloc test yassl" |
219 |
- |
220 |
-REQUIRED_USE="^^ ( yassl openssl libressl )" |
221 |
- |
222 |
-### Begin readline/libedit |
223 |
-### If the world was perfect, we would use external libedit on both to have a similar experience |
224 |
-### However libedit does not seem to support UTF-8 keyboard input |
225 |
- |
226 |
-# This probably could be simplified, but the syntax would have to be just right |
227 |
-#if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && \ |
228 |
-# mysql_check_version_range "5.5.37 to 10.0.13.99" ; then |
229 |
-# IUSE="bindist ${IUSE}" |
230 |
-#elif [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \ |
231 |
-# mysql_check_version_range "5.5.37 to 5.6.11.99" ; then |
232 |
-# IUSE="bindist ${IUSE}" |
233 |
-#elif [[ ${PN} == "mysql-cluster" ]] && \ |
234 |
-# mysql_check_version_range "7.2 to 7.2.99.99" ; then |
235 |
-# IUSE="bindist ${IUSE}" |
236 |
-#fi |
237 |
- |
238 |
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
239 |
-RESTRICT="libressl? ( test )" |
240 |
- |
241 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
242 |
- IUSE="bindist ${IUSE}" |
243 |
- RESTRICT="${RESTRICT} !bindist? ( bindist )" |
244 |
-fi |
245 |
- |
246 |
-### End readline/libedit |
247 |
- |
248 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then |
249 |
- IUSE="${IUSE} oqgraph pam sphinx tokudb" |
250 |
- # 5.5.33 and 10.0.5 add TokuDB. Authors strongly recommend jemalloc or perfomance suffers |
251 |
- mysql_version_is_at_least "10.0.5" && IUSE="${IUSE} odbc xml" |
252 |
- if [[ ${HAS_TOOLS_PATCH} ]] ; then |
253 |
- REQUIRED_USE="${REQUIRED_USE} !server? ( !oqgraph !sphinx ) tokudb? ( jemalloc !tcmalloc )" |
254 |
- else |
255 |
- REQUIRED_USE="${REQUIRED_USE} minimal? ( !oqgraph !sphinx ) tokudb? ( jemalloc !tcmalloc )" |
256 |
- fi |
257 |
- # MariaDB 10.1 introduces InnoDB/XtraDB compression with external libraries |
258 |
- # Choices are bzip2, lz4, lzma, lzo. bzip2 and lzma enabled by default as they are system libraries |
259 |
- mysql_version_is_at_least "10.1.1" && IUSE="${IUSE} innodb-lz4 innodb-lzo" |
260 |
- |
261 |
- # It can also compress with app-arch/snappy |
262 |
- mysql_version_is_at_least "10.1.7" && IUSE="${IUSE} innodb-snappy" |
263 |
- |
264 |
- # 10.1.2 introduces a cracklib password checker |
265 |
- mysql_version_is_at_least "10.1.1" && IUSE="${IUSE} cracklib" |
266 |
-fi |
267 |
- |
268 |
-if [[ -n "${WSREP_REVISION}" ]]; then |
269 |
- if [[ ${PN} == "mariadb" ]]; then |
270 |
- IUSE="${IUSE} galera sst-rsync sst-xtrabackup" |
271 |
- REQUIRED_USE="${REQUIRED_USE} sst-rsync? ( galera ) sst-xtrabackup? ( galera )" |
272 |
- else |
273 |
- IUSE="${IUSE} +sst-rsync sst-xtrabackup" |
274 |
- fi |
275 |
-fi |
276 |
- |
277 |
-if [[ ${PN} == "percona-server" ]]; then |
278 |
- IUSE="${IUSE} pam" |
279 |
-fi |
280 |
- |
281 |
-if [[ ${HAS_TOOLS_PATCH} ]] ; then |
282 |
- IUSE="${IUSE} client-libs +server +tools" |
283 |
- REQUIRED_USE="${REQUIRED_USE} !server? ( !extraengine !embedded ) server? ( tools ) || ( client-libs server tools )" |
284 |
-else |
285 |
- IUSE="${IUSE} minimal" |
286 |
- REQUIRED_USE="${REQUIRED_USE} minimal? ( !extraengine !embedded )" |
287 |
-fi |
288 |
- |
289 |
-REQUIRED_USE=" |
290 |
- ${REQUIRED_USE} tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc ) |
291 |
- static? ( yassl !openssl !libressl )" |
292 |
- |
293 |
-# |
294 |
-# DEPENDENCIES: |
295 |
-# |
296 |
- |
297 |
-# Be warned, *DEPEND are version-dependant |
298 |
-# These are used for both runtime and compiletime |
299 |
-# MULTILIB_USEDEP only set for libraries used by the client library |
300 |
-DEPEND=" |
301 |
- kernel_linux? ( |
302 |
- sys-process/procps:0= |
303 |
- dev-libs/libaio:0= |
304 |
- ) |
305 |
- >=sys-apps/sed-4 |
306 |
- >=sys-apps/texinfo-4.7-r1 |
307 |
- !dev-db/mariadb-native-client[mysqlcompat] |
308 |
- jemalloc? ( dev-libs/jemalloc:0= ) |
309 |
- tcmalloc? ( dev-util/google-perftools:0= ) |
310 |
- systemtap? ( >=dev-util/systemtap-1.3:0= ) |
311 |
-" |
312 |
- |
313 |
-if [[ ${HAS_TOOLS_PATCH} ]] ; then |
314 |
- DEPEND+=" |
315 |
- client-libs? ( |
316 |
- openssl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) |
317 |
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) |
318 |
- >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] |
319 |
- ) |
320 |
- !client-libs? ( |
321 |
- openssl? ( >=dev-libs/openssl-1.0.0:0=[static-libs?] ) |
322 |
- libressl? ( dev-libs/libressl:0=[static-libs?] ) |
323 |
- >=sys-libs/zlib-1.2.3:0=[static-libs?] |
324 |
- ) |
325 |
- tools? ( sys-libs/ncurses:0= ) embedded? ( sys-libs/ncurses:0= ) |
326 |
- " |
327 |
-else |
328 |
- DEPEND+=" |
329 |
- openssl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] ) |
330 |
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] ) |
331 |
- >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] |
332 |
- sys-libs/ncurses:0=[${MULTILIB_USEDEP}] |
333 |
- " |
334 |
-fi |
335 |
- |
336 |
-### Begin readline/libedit |
337 |
-### If the world was perfect, we would use external libedit on both to have a similar experience |
338 |
-### However libedit does not seem to support UTF-8 keyboard input |
339 |
- |
340 |
-# dev-db/mysql-5.6.12+ only works with dev-libs/libedit |
341 |
-# mariadb 10.0.14 fixes libedit detection. changed to follow mysql |
342 |
-# This probably could be simplified |
343 |
-#if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \ |
344 |
-# mysql_version_is_at_least "5.6.12" ; then |
345 |
-# DEPEND="${DEPEND} dev-libs/libedit:0=[${MULTILIB_USEDEP}]" |
346 |
-#elif [[ ${PN} == "mysql-cluster" ]] && mysql_version_is_at_least "7.3"; then |
347 |
-# DEPEND="${DEPEND} dev-libs/libedit:0=[${MULTILIB_USEDEP}]" |
348 |
-#elif [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && \ |
349 |
-# mysql_version_is_at_least "10.0.14" ; then |
350 |
-# DEPEND="${DEPEND} dev-libs/libedit:0=[${MULTILIB_USEDEP}]" |
351 |
-#else |
352 |
-# DEPEND="${DEPEND} !bindist? ( >=sys-libs/readline-4.1:0=[${MULTILIB_USEDEP}] )" |
353 |
-#fi |
354 |
- |
355 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
356 |
- # Readline is only used for the command-line and embedded example |
357 |
- if [[ ${HAS_TOOLS_PATCH} ]] ; then |
358 |
- DEPEND="${DEPEND} !bindist? ( tools? ( >=sys-libs/readline-4.1:0= ) embedded? ( >=sys-libs/readline-4.1:0= ) )" |
359 |
- else |
360 |
- DEPEND="${DEPEND} !bindist? ( >=sys-libs/readline-4.1:0=[${MULTILIB_USEDEP}] )" |
361 |
- fi |
362 |
-fi |
363 |
- |
364 |
-### End readline/libedit |
365 |
- |
366 |
-if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then |
367 |
- if mysql_version_is_at_least "5.7.6" ; then DEPEND="${DEPEND} >=dev-libs/boost-1.57.0:0=" ; else |
368 |
- mysql_version_is_at_least "5.7.5" && DEPEND="${DEPEND} >=dev-libs/boost-1.56.0:0=" |
369 |
- fi |
370 |
-fi |
371 |
- |
372 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
373 |
- # Bug 441700 MariaDB >=5.3 include custom mytop |
374 |
- if [[ ${HAS_TOOLS_PATCH} ]] ; then |
375 |
- DEPEND="${DEPEND} server? ( pam? ( virtual/pam:0= ) )" |
376 |
- else |
377 |
- DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam:0= ) )" |
378 |
- fi |
379 |
- DEPEND="${DEPEND} |
380 |
- oqgraph? ( >=dev-libs/boost-1.40.0:0= ) |
381 |
- perl? ( !dev-db/mytop )" |
382 |
- if mysql_version_is_at_least "10.0.5" ; then |
383 |
- DEPEND="${DEPEND} |
384 |
- extraengine? ( |
385 |
- odbc? ( dev-db/unixODBC:0= ) |
386 |
- xml? ( dev-libs/libxml2:2= ) |
387 |
- ) |
388 |
- " |
389 |
- fi |
390 |
- mysql_version_is_at_least "10.0.7" && DEPEND="${DEPEND} oqgraph? ( dev-libs/judy:0= )" |
391 |
- mysql_version_is_at_least "10.0.9" && DEPEND="${DEPEND} >=dev-libs/libpcre-8.35:3=" |
392 |
- |
393 |
- mysql_version_is_at_least "10.1.1" && DEPEND="${DEPEND} |
394 |
- innodb-lz4? ( app-arch/lz4 ) |
395 |
- innodb-lzo? ( dev-libs/lzo ) |
396 |
- " |
397 |
- |
398 |
- mysql_version_is_at_least "10.1.2" && DEPEND="${DEPEND} cracklib? ( sys-libs/cracklib:0= )" |
399 |
- mysql_version_is_at_least "10.1.7" && DEPEND="${DEPEND} innodb-snappy? ( app-arch/snappy )" |
400 |
-fi |
401 |
- |
402 |
-if [[ ${PN} == "percona-server" ]] ; then |
403 |
- if [[ ${HAS_TOOLS_PATCH} ]] ; then |
404 |
- DEPEND="${DEPEND} server? ( pam? ( virtual/pam:0= ) )" |
405 |
- else |
406 |
- DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam:0= ) )" |
407 |
- fi |
408 |
-fi |
409 |
- |
410 |
-# Having different flavours at the same time is not a good idea |
411 |
-for i in "mysql" "mariadb" "mariadb-galera" "percona-server" "mysql-cluster" ; do |
412 |
- [[ ${i} == ${PN} ]] || |
413 |
- DEPEND="${DEPEND} !dev-db/${i}" |
414 |
-done |
415 |
- |
416 |
-if [[ ${PN} == "mysql-cluster" ]] ; then |
417 |
- # TODO: This really should include net-misc/memcached |
418 |
- # but the package does not install the files it seeks. |
419 |
- mysql_version_is_at_least "7.2.3" && \ |
420 |
- DEPEND="${DEPEND} dev-libs/libevent:0=" |
421 |
-fi |
422 |
- |
423 |
-# prefix: first need to implement something for #196294 |
424 |
-# TODO: check emul-linux-x86-db dep when it is multilib enabled |
425 |
-RDEPEND="${DEPEND} |
426 |
- selinux? ( sec-policy/selinux-mysql ) |
427 |
- abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] ) |
428 |
-" |
429 |
- |
430 |
-if [[ ${HAS_TOOLS_PATCH} ]] ; then |
431 |
- RDEPEND="${RDEPEND} |
432 |
- server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
433 |
- !client-libs? ( virtual/libmysqlclient ) |
434 |
- !<virtual/mysql-5.6-r4" |
435 |
-else |
436 |
- RDEPEND="${RDEPEND} !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )" |
437 |
-fi |
438 |
- |
439 |
-if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
440 |
- # Bug 455016 Add dependencies of mytop |
441 |
- RDEPEND="${RDEPEND} perl? ( |
442 |
- virtual/perl-Getopt-Long |
443 |
- dev-perl/TermReadKey |
444 |
- virtual/perl-Term-ANSIColor |
445 |
- virtual/perl-Time-HiRes ) " |
446 |
-fi |
447 |
- |
448 |
-# @ECLASS-VARIABLE: WSREP_REVISION |
449 |
-# @DEFAULT_UNSET |
450 |
-# @DESCRIPTION: |
451 |
-# Version of the sys-cluster/galera API (major version in portage) to use for galera clustering |
452 |
- |
453 |
-if [[ -n "${WSREP_REVISION}" ]] ; then |
454 |
- # The wsrep API version must match between the ebuild and sys-cluster/galera. |
455 |
- # This will be indicated by WSREP_REVISION in the ebuild and the first number |
456 |
- # in the version of sys-cluster/galera |
457 |
- # |
458 |
- # lsof is required as of 5.5.38 and 10.0.11 for the rsync sst |
459 |
- |
460 |
- GALERA_RDEPEND="sys-apps/iproute2 |
461 |
- =sys-cluster/galera-${WSREP_REVISION}* |
462 |
- " |
463 |
- if [[ ${PN} == "mariadb" ]]; then |
464 |
- GALERA_RDEPEND="galera? ( ${GALERA_RDEPEND} )" |
465 |
- fi |
466 |
- RDEPEND="${RDEPEND} ${GALERA_RDEPEND} |
467 |
- sst-rsync? ( sys-process/lsof ) |
468 |
- sst-xtrabackup? ( |
469 |
- net-misc/socat[ssl] |
470 |
- ) |
471 |
- " |
472 |
- # Causes a circular dependency if DBD-mysql is not already installed |
473 |
- PDEPEND="${PDEPEND} sst-xtrabackup? ( >=dev-db/xtrabackup-bin-2.2.4 )" |
474 |
-fi |
475 |
- |
476 |
-if [[ ${PN} == "mysql-cluster" ]] ; then |
477 |
- mysql_version_is_at_least "7.2.9" && RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.6 )" && \ |
478 |
- DEPEND="${DEPEND} java? ( >=virtual/jdk-1.6 )" |
479 |
-fi |
480 |
- |
481 |
-# compile-time-only |
482 |
-# ncurses only needs multilib for compile time due to a binary that will be not installed |
483 |
-DEPEND="${DEPEND} |
484 |
- virtual/yacc |
485 |
- static? ( sys-libs/ncurses[static-libs] ) |
486 |
- >=dev-util/cmake-2.8.9 |
487 |
-" |
488 |
- |
489 |
-# Transition dep until all ebuilds have client-libs patch and USE |
490 |
-if ! [[ ${HAS_TOOLS_PATCH} ]] ; then |
491 |
- DEPEND="${DEPEND} sys-libs/ncurses[${MULTILIB_USEDEP}]" |
492 |
-fi |
493 |
- |
494 |
-# For other stuff to bring us in |
495 |
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
496 |
-PDEPEND="${PDEPEND} perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
497 |
- ~virtual/mysql-${MYSQL_PV_MAJOR}" |
498 |
- |
499 |
-# my_config.h includes ABI specific data |
500 |
-MULTILIB_WRAPPED_HEADERS=( /usr/include/mysql/my_config.h /usr/include/mysql/private/embedded_priv.h ) |
501 |
- |
502 |
-[[ ${PN} == "mysql-cluster" ]] && \ |
503 |
- MULTILIB_WRAPPED_HEADERS+=( /usr/include/mysql/storage/ndb/ndb_types.h ) |
504 |
- |
505 |
-[[ ${PN} == "mariadb" ]] && mysql_version_is_at_least "10.1.1" && \ |
506 |
- MULTILIB_WRAPPED_HEADERS+=( /usr/include/mysql/mysql_version.h ) |
507 |
- |
508 |
-# |
509 |
-# HELPER FUNCTIONS: |
510 |
-# |
511 |
- |
512 |
-# @FUNCTION: mysql-multilib_disable_test |
513 |
-# @DESCRIPTION: |
514 |
-# Helper function to disable specific tests. |
515 |
-mysql-multilib_disable_test() { |
516 |
- mysql-cmake_disable_test "$@" |
517 |
-} |
518 |
- |
519 |
-# |
520 |
-# EBUILD FUNCTIONS |
521 |
-# |
522 |
- |
523 |
-# @FUNCTION: mysql-multilib_pkg_pretend |
524 |
-# @DESCRIPTION: |
525 |
-# Perform some basic tests and tasks during pkg_pretend phase: |
526 |
-mysql-multilib_pkg_pretend() { |
527 |
- if [[ ${MERGE_TYPE} != binary ]] ; then |
528 |
- local GCC_MAJOR_SET=$(gcc-major-version) |
529 |
- local GCC_MINOR_SET=$(gcc-minor-version) |
530 |
- if use_if_iuse tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
531 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
532 |
- eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
533 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
534 |
- die |
535 |
- fi |
536 |
- # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
537 |
- # non x86{,_64} arches |
538 |
- if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
539 |
- ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
540 |
- eerror "${PN} needs to be built with gcc-4.7 or later." |
541 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
542 |
- die |
543 |
- fi |
544 |
- fi |
545 |
-} |
546 |
- |
547 |
-# @FUNCTION: mysql-multilib_pkg_setup |
548 |
-# @DESCRIPTION: |
549 |
-# Perform some basic tests and tasks during pkg_setup phase: |
550 |
-# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv" |
551 |
-# create new user and group for mysql |
552 |
-# warn about deprecated features |
553 |
-mysql-multilib_pkg_setup() { |
554 |
- |
555 |
- if has test ${FEATURES} ; then |
556 |
- if use_if_iuse minimal ; then |
557 |
- : |
558 |
- elif ! in_iuse server || use_if_iuse server ; then |
559 |
- if ! has userpriv ${FEATURES} ; then |
560 |
- eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
561 |
- fi |
562 |
- fi |
563 |
- fi |
564 |
- |
565 |
- # This should come after all of the die statements |
566 |
- enewgroup mysql 60 || die "problem adding 'mysql' group" |
567 |
- enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
568 |
- |
569 |
- if [[ ${PN} == "mysql-cluster" ]] ; then |
570 |
- mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_setup |
571 |
- fi |
572 |
-} |
573 |
- |
574 |
-# @FUNCTION: mysql-multilib_src_unpack |
575 |
-# @DESCRIPTION: |
576 |
-# Unpack the source code |
577 |
-mysql-multilib_src_unpack() { |
578 |
- |
579 |
- # Initialize the proper variables first |
580 |
- mysql_init_vars |
581 |
- |
582 |
- unpack ${A} |
583 |
- # Grab the patches |
584 |
- [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
585 |
- |
586 |
- mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}" |
587 |
-} |
588 |
- |
589 |
-# @FUNCTION: mysql-multilib_src_prepare |
590 |
-# @DESCRIPTION: |
591 |
-# Apply patches to the source code and remove unneeded bundled libs. |
592 |
-mysql-multilib_src_prepare() { |
593 |
- mysql-cmake_src_prepare "$@" |
594 |
- if [[ ${PN} == "mysql-cluster" ]] ; then |
595 |
- mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_src_prepare |
596 |
- fi |
597 |
-} |
598 |
- |
599 |
- |
600 |
-# @FUNCTION: mysql-multilib_src_configure |
601 |
-# @DESCRIPTION: |
602 |
-# Configure mysql to build the code for Gentoo respecting the use flags. |
603 |
-mysql-multilib_src_configure() { |
604 |
- # Bug #114895, bug #110149 |
605 |
- filter-flags "-O" "-O[01]" |
606 |
- |
607 |
- CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing" |
608 |
- CXXFLAGS="${CXXFLAGS} -felide-constructors" |
609 |
- # Causes linkage failures. Upstream bug #59607 removes it |
610 |
- if ! mysql_version_is_at_least "5.6" ; then |
611 |
- CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" |
612 |
- fi |
613 |
- # As of 5.7, exceptions are used! |
614 |
- if [[ ${PN} == "percona-server" ]] && mysql_version_is_at_least "5.6.26" ; then |
615 |
- CXXFLAGS="${CXXFLAGS} -fno-rtti" |
616 |
- elif ! mysql_version_is_at_least "5.7" ; then |
617 |
- CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti" |
618 |
- fi |
619 |
- export CXXFLAGS |
620 |
- |
621 |
- # bug #283926, with GCC4.4, this is required to get correct behavior. |
622 |
- append-flags -fno-strict-aliasing |
623 |
- |
624 |
- # bug 508724 mariadb cannot use ld.gold |
625 |
- if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
626 |
- tc-ld-disable-gold |
627 |
- fi |
628 |
- |
629 |
- multilib-minimal_src_configure |
630 |
-} |
631 |
- |
632 |
-multilib_src_configure() { |
633 |
- |
634 |
- debug-print-function ${FUNCNAME} "$@" |
635 |
- |
636 |
- CMAKE_BUILD_TYPE="RelWithDebInfo" |
637 |
- |
638 |
- if ! multilib_is_native_abi && in_iuse client-libs ; then |
639 |
- if ! use client-libs ; then |
640 |
- einfo "Skipping multilib build due to client-libs USE disabled" |
641 |
- return 0 |
642 |
- fi |
643 |
- fi |
644 |
- |
645 |
- # debug hack wrt #497532 |
646 |
- mycmakeargs=( |
647 |
- -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")" |
648 |
- -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")" |
649 |
- -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr |
650 |
- -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql |
651 |
- -DSYSCONFDIR=${EPREFIX}/etc/mysql |
652 |
- -DINSTALL_BINDIR=bin |
653 |
- -DINSTALL_DOCDIR=share/doc/${PF} |
654 |
- -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
655 |
- -DINSTALL_INCLUDEDIR=include/mysql |
656 |
- -DINSTALL_INFODIR=share/info |
657 |
- -DINSTALL_LIBDIR=$(get_libdir) |
658 |
- -DINSTALL_ELIBDIR=$(get_libdir)/mysql |
659 |
- -DINSTALL_MANDIR=share/man |
660 |
- -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql |
661 |
- -DINSTALL_MYSQLSHAREDIR=share/mysql |
662 |
- -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test |
663 |
- -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
664 |
- -DINSTALL_SBINDIR=sbin |
665 |
- -DINSTALL_SCRIPTDIR=share/mysql/scripts |
666 |
- -DINSTALL_SQLBENCHDIR=share/mysql |
667 |
- -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql |
668 |
- -DWITH_COMMENT="Gentoo Linux ${PF}" |
669 |
- $(cmake-utils_use_with test UNIT_TESTS) |
670 |
- -DWITH_LIBEDIT=0 |
671 |
- -DWITH_ZLIB=system |
672 |
- -DWITHOUT_LIBWRAP=1 |
673 |
- -DENABLED_LOCAL_INFILE=1 |
674 |
- -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock |
675 |
- -DINSTALL_UNIX_ADDRDIR=${EPREFIX}/var/run/mysqld/mysqld.sock |
676 |
- -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
677 |
- -DWITH_DEFAULT_FEATURE_SET=0 |
678 |
- -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_unitdir)" |
679 |
- ) |
680 |
- |
681 |
- if in_iuse systemd ; then |
682 |
- mycmakeargs+=( -DWITH_SYSTEMD=$(usex systemd) ) |
683 |
- fi |
684 |
- |
685 |
- if use openssl || use libressl ; then |
686 |
- mycmakeargs+=( -DWITH_SSL=system ) |
687 |
- else |
688 |
- mycmakeargs+=( -DWITH_SSL=bundled ) |
689 |
- fi |
690 |
- |
691 |
- if in_iuse client-libs ; then |
692 |
- mycmakeargs+=( -DWITHOUT_CLIENTLIBS=$(usex client-libs 0 1) ) |
693 |
- fi |
694 |
- |
695 |
- if in_iuse tools ; then |
696 |
- if multilib_is_native_abi ; then |
697 |
- mycmakeargs+=( -DWITHOUT_TOOLS=$(usex tools 0 1) ) |
698 |
- else |
699 |
- mycmakeargs+=( -DWITHOUT_TOOLS=1 ) |
700 |
- fi |
701 |
- fi |
702 |
- |
703 |
- if in_iuse bindist ; then |
704 |
- # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
705 |
- if multilib_is_native_abi; then |
706 |
- mycmakeargs+=( |
707 |
- -DWITH_READLINE=$(usex bindist 1 0) |
708 |
- -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
709 |
- ) |
710 |
- elif ! in_iuse client-libs ; then |
711 |
- mycmakeargs+=( |
712 |
- -DWITH_READLINE=1 |
713 |
- -DNOT_FOR_DISTRIBUTION=0 |
714 |
- ) |
715 |
- fi |
716 |
- fi |
717 |
- |
718 |
- ### TODO: make this system but issues with UTF-8 prevent it |
719 |
- mycmakeargs+=( -DWITH_EDITLINE=bundled ) |
720 |
- |
721 |
- if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && multilib_is_native_abi ; then |
722 |
- mycmakeargs+=( |
723 |
- -DWITH_JEMALLOC=$(usex jemalloc system) |
724 |
- ) |
725 |
- |
726 |
- mysql_version_is_at_least "10.0.9" && mycmakeargs+=( -DWITH_PCRE=system ) |
727 |
- fi |
728 |
- |
729 |
- configure_cmake_locale |
730 |
- |
731 |
- if use_if_iuse minimal ; then |
732 |
- configure_cmake_minimal |
733 |
- elif in_iuse server ; then |
734 |
- if multilib_is_native_abi && use server ; then |
735 |
- configure_cmake_standard |
736 |
- else |
737 |
- configure_cmake_minimal |
738 |
- fi |
739 |
- else |
740 |
- if multilib_is_native_abi ; then |
741 |
- configure_cmake_standard |
742 |
- else |
743 |
- configure_cmake_minimal |
744 |
- fi |
745 |
- fi |
746 |
- |
747 |
- # systemtap only works on native ABI bug 530132 |
748 |
- if multilib_is_native_abi; then |
749 |
- mycmakeargs+=( $(cmake-utils_use_enable systemtap DTRACE) ) |
750 |
- [[ ${MYSQL_CMAKE_NATIVE_DEFINES} ]] && mycmakeargs+=( ${MYSQL_CMAKE_NATIVE_DEFINES} ) |
751 |
- else |
752 |
- mycmakeargs+=( -DENABLE_DTRACE=0 ) |
753 |
- [[ ${MYSQL_CMAKE_NONNATIVE_DEFINES} ]] && mycmakeargs+=( ${MYSQL_CMAKE_NONNATIVE_DEFINES} ) |
754 |
- fi |
755 |
- |
756 |
- [[ ${MYSQL_CMAKE_EXTRA_DEFINES} ]] && mycmakeargs+=( ${MYSQL_CMAKE_EXTRA_DEFINES} ) |
757 |
- |
758 |
- # Always build NDB with mysql-cluster for libndbclient |
759 |
- [[ ${PN} == "mysql-cluster" ]] && mycmakeargs+=( |
760 |
- -DWITH_NDBCLUSTER=1 -DWITH_PARTITION_STORAGE_ENGINE=1 |
761 |
- -DWITHOUT_PARTITION_STORAGE_ENGINE=0 ) |
762 |
- |
763 |
- cmake-utils_src_configure |
764 |
-} |
765 |
- |
766 |
-mysql-multilib_src_compile() { |
767 |
- local _cmake_args=( "${@}" ) |
768 |
- |
769 |
- multilib-minimal_src_compile |
770 |
-} |
771 |
- |
772 |
-multilib_src_compile() { |
773 |
- if ! multilib_is_native_abi && in_iuse client-libs ; then |
774 |
- if ! use client-libs ; then |
775 |
- return 0 |
776 |
- fi |
777 |
- fi |
778 |
- |
779 |
- cmake-utils_src_compile "${_cmake_args[@]}" |
780 |
-} |
781 |
- |
782 |
- |
783 |
-# @FUNCTION: mysql-multilib_src_install |
784 |
-# @DESCRIPTION: |
785 |
-# Install mysql. |
786 |
-mysql-multilib_src_install() { |
787 |
- if ! in_iuse client-libs || use_if_iuse client-libs ; then |
788 |
- # wrap the config script |
789 |
- MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config ) |
790 |
- fi |
791 |
- |
792 |
- if in_iuse client-libs && ! use client-libs ; then |
793 |
- multilib_foreach_abi multilib_src_install |
794 |
- else |
795 |
- multilib-minimal_src_install |
796 |
- fi |
797 |
-} |
798 |
- |
799 |
-multilib_src_install() { |
800 |
- debug-print-function ${FUNCNAME} "$@" |
801 |
- |
802 |
- if ! multilib_is_native_abi && in_iuse client-libs ; then |
803 |
- if ! use client-libs ; then |
804 |
- return 0 |
805 |
- fi |
806 |
- fi |
807 |
- |
808 |
- if multilib_is_native_abi; then |
809 |
- mysql-cmake_src_install |
810 |
- else |
811 |
- cmake-utils_src_install |
812 |
- if [[ "${PN}" == "mariadb" || "${PN}" == "mariadb-galera" ]] ; then |
813 |
- if use_if_iuse minimal ; then |
814 |
- : |
815 |
- elif use_if_iuse server || ! in_iuse server ; then |
816 |
- insinto /usr/include/mysql/private |
817 |
- doins "${S}"/sql/*.h |
818 |
- fi |
819 |
- fi |
820 |
- fi |
821 |
-} |
822 |
- |
823 |
-# @FUNCTION: mysql-multilib_pkg_preinst |
824 |
-# @DESCRIPTION: |
825 |
-# Call java-pkg-opt-2 eclass when mysql-cluster is installed |
826 |
-mysql-multilib_pkg_preinst() { |
827 |
- debug-print-function ${FUNCNAME} "$@" |
828 |
- |
829 |
- if [[ ${PN} == "mysql-cluster" ]] ; then |
830 |
- mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_preinst |
831 |
- fi |
832 |
- # Here we need to see if the implementation switched client libraries |
833 |
- # First, we check if this is a new instance of the package and a client library already exists |
834 |
- # Then, we check if this package is rebuilt but the previous instance did not |
835 |
- # have the client-libs USE set. |
836 |
- # Instances which do not have a client-libs USE can only be replaced by a different provider |
837 |
- local SHOW_ABI_MESSAGE |
838 |
- if ! in_iuse client-libs || use_if_iuse client-libs ; then |
839 |
- if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
840 |
- SHOW_ABI_MESSAGE=1 |
841 |
- elif [[ ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] && \ |
842 |
- in_iuse client-libs && has_version "${CATEGORY}/${PN}[-client-libs(+)]" ; then |
843 |
- SHOW_ABI_MESSAGE=1 |
844 |
- fi |
845 |
- |
846 |
- fi |
847 |
- if [[ ${SHOW_ABI_MESSAGE} ]] ; then |
848 |
- elog "Due to ABI changes when switching between different client libraries," |
849 |
- elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
850 |
- elog "Please run: revdep-rebuild --library libmysqlclient.so.${SUBSLOT:-18}" |
851 |
- ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
852 |
- fi |
853 |
-} |
854 |
- |
855 |
-# @FUNCTION: mysql-multilib_pkg_postinst |
856 |
-# @DESCRIPTION: |
857 |
-# Run post-installation tasks: |
858 |
-# create the dir for logfiles if non-existant |
859 |
-# touch the logfiles and secure them |
860 |
-# install scripts |
861 |
-# issue required steps for optional features |
862 |
-# issue deprecation warnings |
863 |
-mysql-multilib_pkg_postinst() { |
864 |
- debug-print-function ${FUNCNAME} "$@" |
865 |
- |
866 |
- # Make sure the vars are correctly initialized |
867 |
- mysql_init_vars |
868 |
- |
869 |
- # Create log directory securely if it does not exist |
870 |
- [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
871 |
- |
872 |
- # Minimal builds don't have the MySQL server |
873 |
- if use_if_iuse minimal ; then |
874 |
- : |
875 |
- elif ! in_iuse server || use_if_iuse server ; then |
876 |
- docinto "support-files" |
877 |
- for script in \ |
878 |
- support-files/my-*.cnf \ |
879 |
- support-files/magic \ |
880 |
- support-files/ndb-config-2-node.ini |
881 |
- do |
882 |
- [[ -f "${script}" ]] \ |
883 |
- && dodoc "${script}" |
884 |
- done |
885 |
- |
886 |
- docinto "scripts" |
887 |
- for script in scripts/mysql* ; do |
888 |
- if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then |
889 |
- dodoc "${script}" |
890 |
- fi |
891 |
- done |
892 |
- |
893 |
- if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then |
894 |
- if use_if_iuse pam ; then |
895 |
- einfo |
896 |
- elog "This install includes the PAM authentication plugin." |
897 |
- elog "To activate and configure the PAM plugin, please read:" |
898 |
- elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
899 |
- einfo |
900 |
- fi |
901 |
- fi |
902 |
- |
903 |
- einfo |
904 |
- elog "You might want to run:" |
905 |
- elog "\"emerge --config =${CATEGORY}/${PF}\"" |
906 |
- elog "if this is a new install." |
907 |
- einfo |
908 |
- |
909 |
- einfo |
910 |
- elog "If you are upgrading major versions, you should run the" |
911 |
- elog "mysql_upgrade tool." |
912 |
- einfo |
913 |
- |
914 |
- if [[ ${PN} == "mariadb-galera" ]] || use_if_iuse galera ; then |
915 |
- einfo |
916 |
- elog "Be sure to edit the my.cnf file to activate your cluster settings." |
917 |
- elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
918 |
- elog "The first time the cluster is activated, you should add" |
919 |
- elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
920 |
- elog "This option should then be removed for subsequent starts." |
921 |
- einfo |
922 |
- fi |
923 |
- fi |
924 |
-} |
925 |
- |
926 |
-# @FUNCTION: mysql-multilib_getopt |
927 |
-# @DESCRIPTION: |
928 |
-# Use my_print_defaults to extract specific config options |
929 |
-mysql-multilib_getopt() { |
930 |
- local mypd="${EROOT}"/usr/bin/my_print_defaults |
931 |
- section="$1" |
932 |
- flag="--${2}=" |
933 |
- "${mypd}" $section | sed -n "/^${flag}/p" |
934 |
-} |
935 |
- |
936 |
-# @FUNCTION: mysql-multilib_getoptval |
937 |
-# @DESCRIPTION: |
938 |
-# Use my_print_defaults to extract specific config options |
939 |
-mysql-multilib_getoptval() { |
940 |
- local mypd="${EROOT}"/usr/bin/my_print_defaults |
941 |
- local section="$1" |
942 |
- local flag="--${2}=" |
943 |
- local extra_options="${3}" |
944 |
- "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
945 |
-} |
946 |
- |
947 |
-# @FUNCTION: mysql-multilib_pkg_config |
948 |
-# @DESCRIPTION: |
949 |
-# Configure mysql environment. |
950 |
-mysql-multilib_pkg_config() { |
951 |
- |
952 |
- debug-print-function ${FUNCNAME} "$@" |
953 |
- |
954 |
- local old_MY_DATADIR="${MY_DATADIR}" |
955 |
- local old_HOME="${HOME}" |
956 |
- # my_print_defaults needs to read stuff in $HOME/.my.cnf |
957 |
- export HOME=${EPREFIX}/root |
958 |
- |
959 |
- # Make sure the vars are correctly initialized |
960 |
- mysql_init_vars |
961 |
- |
962 |
- [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
963 |
- if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
964 |
- die "Minimal builds do NOT include the MySQL server" |
965 |
- fi |
966 |
- |
967 |
- if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
968 |
- local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
969 |
- MY_DATADIR_s="${MY_DATADIR_s%%/}" |
970 |
- local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
971 |
- old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
972 |
- |
973 |
- if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
974 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
975 |
- ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
976 |
- ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
977 |
- else |
978 |
- elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
979 |
- mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
980 |
- || die "Moving MY_DATADIR failed" |
981 |
- fi |
982 |
- else |
983 |
- ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
984 |
- if [[ -d "${MY_DATADIR_s}" ]]; then |
985 |
- ewarn "Attempting to use ${MY_DATADIR_s}" |
986 |
- else |
987 |
- eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
988 |
- die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
989 |
- fi |
990 |
- fi |
991 |
- fi |
992 |
- |
993 |
- local pwd1="a" |
994 |
- local pwd2="b" |
995 |
- local maxtry=15 |
996 |
- |
997 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
998 |
- MYSQL_ROOT_PASSWORD="$(mysql-multilib_getoptval 'client mysql' password)" |
999 |
- # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
1000 |
- if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
1001 |
- MYSQL_ROOT_PASSWORD="$(mysql-multilib_getoptval 'client mysql' password --show)" |
1002 |
- fi |
1003 |
- fi |
1004 |
- MYSQL_TMPDIR="$(mysql-multilib_getoptval mysqld tmpdir)" |
1005 |
- # These are dir+prefix |
1006 |
- MYSQL_RELAY_LOG="$(mysql-multilib_getoptval mysqld relay-log)" |
1007 |
- MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
1008 |
- MYSQL_LOG_BIN="$(mysql-multilib_getoptval mysqld log-bin)" |
1009 |
- MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
1010 |
- |
1011 |
- if [[ ! -d "${ROOT}"/$MYSQL_TMPDIR ]]; then |
1012 |
- einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
1013 |
- install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_TMPDIR |
1014 |
- fi |
1015 |
- if [[ ! -d "${ROOT}"/$MYSQL_LOG_BIN ]]; then |
1016 |
- einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
1017 |
- install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_LOG_BIN |
1018 |
- fi |
1019 |
- if [[ ! -d "${EROOT}"/$MYSQL_RELAY_LOG ]]; then |
1020 |
- einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
1021 |
- install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_RELAY_LOG |
1022 |
- fi |
1023 |
- |
1024 |
- if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
1025 |
- ewarn "You have already a MySQL database in place." |
1026 |
- ewarn "(${ROOT}/${MY_DATADIR}/*)" |
1027 |
- ewarn "Please rename or delete it if you wish to replace it." |
1028 |
- die "MySQL database already exists!" |
1029 |
- fi |
1030 |
- |
1031 |
- # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1032 |
- # localhost. Also causes weird failures. |
1033 |
- [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1034 |
- |
1035 |
- if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
1036 |
- |
1037 |
- einfo "Please provide a password for the mysql 'root' user now" |
1038 |
- einfo "or through the ${HOME}/.my.cnf file." |
1039 |
- ewarn "Avoid [\"'\\_%] characters in the password" |
1040 |
- read -rsp " >" pwd1 ; echo |
1041 |
- |
1042 |
- einfo "Retype the password" |
1043 |
- read -rsp " >" pwd2 ; echo |
1044 |
- |
1045 |
- if [[ "x$pwd1" != "x$pwd2" ]] ; then |
1046 |
- die "Passwords are not the same" |
1047 |
- fi |
1048 |
- MYSQL_ROOT_PASSWORD="${pwd1}" |
1049 |
- unset pwd1 pwd2 |
1050 |
- fi |
1051 |
- |
1052 |
- local options |
1053 |
- local sqltmp="$(emktemp)" |
1054 |
- |
1055 |
- # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1056 |
- # see http://bugs.mysql.com/bug.php?id=31312 |
1057 |
- use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
1058 |
- |
1059 |
- local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql" |
1060 |
- [[ -r "${help_tables}" ]] \ |
1061 |
- && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \ |
1062 |
- || touch "${TMPDIR}/fill_help_tables.sql" |
1063 |
- help_tables="${TMPDIR}/fill_help_tables.sql" |
1064 |
- |
1065 |
- # Figure out which options we need to disable to do the setup |
1066 |
- local helpfile="${TMPDIR}/mysqld-help" |
1067 |
- ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null |
1068 |
- for opt in grant-tables host-cache name-resolve networking slave-start \ |
1069 |
- federated ssl log-bin relay-log slow-query-log external-locking \ |
1070 |
- ndbcluster log-slave-updates wsrep-on \ |
1071 |
- ; do |
1072 |
- optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1073 |
- egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
1074 |
- done |
1075 |
- # But some options changed names |
1076 |
- egrep -sq external-locking "${helpfile}" && \ |
1077 |
- options="${options/skip-locking/skip-external-locking}" |
1078 |
- |
1079 |
- # MySQL 5.6+ needs InnoDB |
1080 |
- if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then |
1081 |
- mysql_version_is_at_least "5.6" || options="${options} --loose-skip-innodb" |
1082 |
- fi |
1083 |
- |
1084 |
- einfo "Creating the mysql database and setting proper permissions on it ..." |
1085 |
- |
1086 |
- # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
1087 |
- PID_DIR="${EROOT}/var/run/mysqld" |
1088 |
- if [[ ! -d "${PID_DIR}" ]]; then |
1089 |
- install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1090 |
- fi |
1091 |
- |
1092 |
- if [[ ! -d "${MY_DATADIR}" ]]; then |
1093 |
- install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1094 |
- fi |
1095 |
- |
1096 |
- pushd "${TMPDIR}" &>/dev/null || die |
1097 |
- #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}" |
1098 |
- cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db |
1099 |
- [[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db |
1100 |
- cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options} '--datadir=${ROOT}/${MY_DATADIR}' '--tmpdir=${ROOT}/${MYSQL_TMPDIR}'" |
1101 |
- einfo "Command: $cmd" |
1102 |
- su -s /bin/sh -c "${cmd}" mysql \ |
1103 |
- >"${TMPDIR}"/mysql_install_db.log 2>&1 |
1104 |
- if [ $? -ne 0 ]; then |
1105 |
- grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
1106 |
- die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
1107 |
- fi |
1108 |
- popd &>/dev/null || die |
1109 |
- [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1110 |
- || die "MySQL databases not installed" |
1111 |
- |
1112 |
- # Filling timezones, see |
1113 |
- # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1114 |
- "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
1115 |
- |
1116 |
- if [[ -r "${help_tables}" ]] ; then |
1117 |
- cat "${help_tables}" >> "${sqltmp}" |
1118 |
- fi |
1119 |
- |
1120 |
- local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
1121 |
- local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
1122 |
- local mysqld="${EROOT}/usr/sbin/mysqld \ |
1123 |
- ${options} \ |
1124 |
- $(use prefix || echo --user=mysql) \ |
1125 |
- --log-warnings=0 \ |
1126 |
- --basedir=${EROOT}/usr \ |
1127 |
- --datadir=${ROOT}/${MY_DATADIR} \ |
1128 |
- --max_allowed_packet=8M \ |
1129 |
- --net_buffer_length=16K \ |
1130 |
- --default-storage-engine=MyISAM \ |
1131 |
- --socket=${socket} \ |
1132 |
- --pid-file=${pidfile} |
1133 |
- --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1134 |
- #einfo "About to start mysqld: ${mysqld}" |
1135 |
- ebegin "Starting mysqld" |
1136 |
- einfo "Command ${mysqld}" |
1137 |
- ${mysqld} & |
1138 |
- rc=$? |
1139 |
- while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1140 |
- maxtry=$((${maxtry}-1)) |
1141 |
- echo -n "." |
1142 |
- sleep 1 |
1143 |
- done |
1144 |
- eend $rc |
1145 |
- |
1146 |
- if ! [[ -S "${socket}" ]]; then |
1147 |
- die "Completely failed to start up mysqld with: ${mysqld}" |
1148 |
- fi |
1149 |
- |
1150 |
- ebegin "Setting root password" |
1151 |
- # Do this from memory, as we don't want clear text passwords in temp files |
1152 |
- local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
1153 |
- "${EROOT}/usr/bin/mysql" \ |
1154 |
- --socket=${socket} \ |
1155 |
- -hlocalhost \ |
1156 |
- -e "${sql}" |
1157 |
- eend $? |
1158 |
- |
1159 |
- ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
1160 |
- "${EROOT}/usr/bin/mysql" \ |
1161 |
- --socket=${socket} \ |
1162 |
- -hlocalhost \ |
1163 |
- -uroot \ |
1164 |
- --password="${MYSQL_ROOT_PASSWORD}" \ |
1165 |
- mysql < "${sqltmp}" |
1166 |
- rc=$? |
1167 |
- eend $? |
1168 |
- [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
1169 |
- |
1170 |
- # Stop the server and cleanup |
1171 |
- einfo "Stopping the server ..." |
1172 |
- kill $(< "${pidfile}" ) |
1173 |
- rm -f "${sqltmp}" |
1174 |
- wait %1 |
1175 |
- einfo "Done" |
1176 |
-} |