1 |
commit: 6c1b434333e109b516b56e76ecec1a58f8990385 |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Aug 1 00:28:45 2019 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Aug 1 00:28:45 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c1b4343 |
7 |
|
8 |
dev-db/mariadb: Version bump: 10.4.7 10.3.17 10.2.26 10.1.41 and 5.5.65 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/688482 |
11 |
Closes: https://bugs.gentoo.org/689412 |
12 |
Closes: https://bugs.gentoo.org/691090 |
13 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
14 |
|
15 |
dev-db/mariadb/Manifest | 6 + |
16 |
dev-db/mariadb/mariadb-10.1.41.ebuild | 889 ++++++++++++++++++++++++++++++ |
17 |
dev-db/mariadb/mariadb-10.2.26.ebuild | 974 +++++++++++++++++++++++++++++++++ |
18 |
dev-db/mariadb/mariadb-10.3.17.ebuild | 975 +++++++++++++++++++++++++++++++++ |
19 |
dev-db/mariadb/mariadb-10.4.7.ebuild | 992 ++++++++++++++++++++++++++++++++++ |
20 |
dev-db/mariadb/mariadb-5.5.65.ebuild | 831 ++++++++++++++++++++++++++++ |
21 |
6 files changed, 4667 insertions(+) |
22 |
|
23 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
24 |
index 2069aef15de..5bffeb585e4 100644 |
25 |
--- a/dev-db/mariadb/Manifest |
26 |
+++ b/dev-db/mariadb/Manifest |
27 |
@@ -1,10 +1,16 @@ |
28 |
DIST mariadb-10.1.38.tar.gz 63535685 BLAKE2B c179ea2f60287c2bc1c0d1c47ae989ac2653a24063e8344cef2f3062fc6798e18b969e8f9aa8287104ce2518e6c644cb8d3a4650b5a0bc5dfde973e76e618955 SHA512 184582f3a902a989ba3d9c4d21288c014c8b469adbbb4cbabc621c5006022cef29baed8c1140ed4476b124da83b76dfa414295ed0c3374be826e75aca953a77b |
29 |
DIST mariadb-10.1.40.tar.gz 63573615 BLAKE2B a57f89c3a9cbfdfc7ff85ec6d7f4231f29a8c2b5df8a86e069e9c077aafc16f60655eab2765a622ec2675fbec4739a477613a42c68f897785443d8366fb5d1a3 SHA512 6b946189c69905f1a23a96d34720f1592353e0095455bf452bba31d53c90143d088f0fd997cac3da0a779840bb6ae6cc30b45144cba474463a8e3a6978a8a8f3 |
30 |
+DIST mariadb-10.1.41.tar.gz 63615288 BLAKE2B 91ebc6d24c80ad9651c42a2f4553ce3ec3b7beb17493f90ebbf02ab23f425b0f729766cf2c81202832dfbca0a5e285f94a4daf794fcf4d445730fbe4fcc88871 SHA512 4a18b06fda49c5c3627b4e7cd32fb460e73762273a0c3d09098e34c71e63caa8fad03cdd92ae4a391cdfdb3719934688f0bdf312fa4af7ac3b9e5f5d90f404be |
31 |
DIST mariadb-10.2.22.tar.gz 71907765 BLAKE2B e7781a9e1bb0becca543ebb0b9e03912fbafa9de45bbd5c7232f92d29b934148dd124ad462bf8aa5aec2e4ee0bf75a03fae5e5fe97a77e1d93095052a577c14b SHA512 cd61d0c2d528b23b975e6ea142560d9b9ebff7ecda6fa9b3659b25b3406e8cc925918f4c3bb0e200ddb8d0520bcaa4d4f70d245b4731896f9ba2f1bdf0a817b2 |
32 |
DIST mariadb-10.2.25.tar.gz 71997847 BLAKE2B 03435106c5b2316e8f66028fa05b85042f35ebe84fa245d214622252048befa414d1630c4edead9ccb07f88f8c8085bb4c2e1361e08f58829b0a751326503cf1 SHA512 0d0f5e188f81715edb02ee91cc6c15ad0f674da67bc8d291a2bad9454190e9423f85ee1b69f88d3b429bc56c58a899f889f04862a4bddf2afdac744318c9c723 |
33 |
+DIST mariadb-10.2.26.tar.gz 73037655 BLAKE2B 54fd27959960736bffe0eeacc913b9aed0407d1be7a60d3035a1b84cbe8066aa1551c1c82a1b90b824debf85faaa9d11e3de29634a0108bc04bc17ca5c2a9d7c SHA512 1eaac1c1dda1017b64249d39d872729d3140d81653240c54f688f64440b1775e5f3a7c5a8486075fa1799411dfb0c2c09b7c1dbb46d95675572d90127048c124 |
34 |
DIST mariadb-10.3.16.tar.gz 70862041 BLAKE2B 522c3185e9928cfb669065fd8b1b8538f53a63d0413ae32e317a1ee6c572c6af458ba15e904e19b2cdb6e83b870360f56f4368eecc2774caab8ac85bc000f609 SHA512 b22a8c8fa0265f88962432ade71c3f0ec554f7d38042def832cfcb50f3aa1dd77a715c76706ffeae679b95438529b06e98b73b7e219f9c645980802027ec022f |
35 |
+DIST mariadb-10.3.17.tar.gz 71894997 BLAKE2B 8e04302f67a99c28751f9970b7e8dfc5ada0583fdabc416e0469e23fa93d22dae8b79e762ef14ca65957e22ec310a290b15d33746f6f2e7287f922803e6a6826 SHA512 6fba995d8c284a12f19ee5635f5d69d8fa89fc314f512cd1764b2c4593933baf71a472ddce630463debd3bfbafa1cf5afee3f40d3c4062242f58cea16259561e |
36 |
DIST mariadb-10.4.6.tar.gz 76710358 BLAKE2B 7fcaced6cbcc027ad2a1f1e681af30d0f4ec45f432bad4c6c7d9625a8d20978e4c49cbec3016be873ecda16cb113a8f3b6a8ec8995772255c23e908cc5d11178 SHA512 b04c47f72de2473d7b5edd04b4785a1d7179bb1f429f30ba53ae6cfbbb413200d9803eff1072949b2e81fd7d2164ea34c68620d621d4181b913daa2293ae140c |
37 |
+DIST mariadb-10.4.7.tar.gz 78155161 BLAKE2B b2c92093438b3574e494bda2180f4a2b5cbe10bac1c46acc45b5303fb4c2a1ca54f3ea88d138ab9cbb492460171dde86f3c21e5873d964b15c6c064e2e6eb47f SHA512 cb8b5adaef1970b9c8f04db08c18660f8b3df87f699aa93c1bee9497b887ddf50fcf3a2aebbe21a5fc9dfcbd118d0192d7421512522d98eaf30a014822c2f7ce |
38 |
DIST mariadb-5.5.64.tar.gz 45953561 BLAKE2B d6efe53e520b829ec337a00efadd7d813afd5e3ee6ac5a298773c7cd1b724d01856979317fe2bcf814af3bdabdbd7c6c3d2e27a60b4cdf6032b1dfd64e54d84d SHA512 3e93044eb30d2ce50fefce503f16f4b542fd647ff4367675147ebe1b1f576b4fbad5c0bb25670136d0758d2b8b0c571119244c87d66565bb9b3471811f5dc6b8 |
39 |
+DIST mariadb-5.5.65.tar.gz 45957577 BLAKE2B 9ed27349d008d2001ed4059370505064918ef3586f89157f5f28892bceabd3073b7070f4054c0a700f1504dde3a4077e274111d5b8cb3713bc5db0910b752628 SHA512 5dbaa2ba7a829a0d5ae6ab8394c31a58753cd93da2637cd83d1e055e78b0796d63214418ddc91a65cefdd791aad4f01b0743aa8c7c40ecbb404cb81fd0138443 |
40 |
DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec |
41 |
DIST mysql-extras-20190305-2052Z.tar.bz2 331304 BLAKE2B 1d2c35a961159fa5ce9ee6699fce943f5a5b5cf60b11c9bb4bcccee4943f4508a9eb6d01050c642353ac592ce1a6b421abf2a1bebc706c44c4c8a36aa698ec43 SHA512 ae63403320e010acbb92f8aec6da8ed4f267cef0bad37147d594076fd94571de7f98bfc2afbe94af5d716f58d57696fd958b1e13e20e87052f252ed4a188cd3c |
42 |
DIST mysql-extras-20190521-1824Z.tar.bz2 331441 BLAKE2B d45fd1be113d3dc7f10a3ff89cfda3d59974d88366a143b473a68493c93e244d45a836b4e13dc9e88bbd8b734507858d6b4b1251325c464f48572fe158d7edf7 SHA512 8b91f534acbd07e3a2f66e28b1301f960ed9192c2bc1edbc07741b6200ad0767fdc004faebce2a60fa67a8f3aee186c98ee2f56278d4e8773e5df77f609ef837 |
43 |
+DIST mysql-extras-20190731-2258Z.tar.bz2 332111 BLAKE2B cc144c9af852bfdd4149b96bdc22f8afb2d0aa92f95ebd272a244f0fb7743dc03f9244871d5c195260bac5d9ed20583093257ee2c95a5a4d0a4dae488d781adf SHA512 d4428a1128cd5aef62c463b659992b110090b1602cdcb6b8d922d570c6b946fde325bfcf5a9a955a8dcc61f3ccd3d612d8517ebf63e316f98ca9ff2cd8a807aa |
44 |
|
45 |
diff --git a/dev-db/mariadb/mariadb-10.1.41.ebuild b/dev-db/mariadb/mariadb-10.1.41.ebuild |
46 |
new file mode 100644 |
47 |
index 00000000000..cb8906ffaa5 |
48 |
--- /dev/null |
49 |
+++ b/dev-db/mariadb/mariadb-10.1.41.ebuild |
50 |
@@ -0,0 +1,889 @@ |
51 |
+# Copyright 1999-2019 Gentoo Authors |
52 |
+# Distributed under the terms of the GNU General Public License v2 |
53 |
+ |
54 |
+EAPI="6" |
55 |
+MY_EXTRAS_VER="20190305-2052Z" |
56 |
+SUBSLOT="18" |
57 |
+ |
58 |
+JAVA_PKG_OPT_USE="jdbc" |
59 |
+ |
60 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
61 |
+ |
62 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs java-pkg-opt-2 user cmake-utils multilib-build |
63 |
+ |
64 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
65 |
+ |
66 |
+# Gentoo patches to MySQL |
67 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
68 |
+ SRC_URI="${SRC_URI} |
69 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
70 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
71 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
72 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
73 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
74 |
+fi |
75 |
+ |
76 |
+HOMEPAGE="https://mariadb.org/" |
77 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
78 |
+LICENSE="GPL-2" |
79 |
+SLOT="0/${SUBSLOT:-0}" |
80 |
+IUSE="+backup bindist client-libs cracklib debug extraengine galera jdbc jemalloc kerberos |
81 |
+ innodb-lz4 innodb-lzo innodb-snappy latin1 libressl mroonga numa odbc oqgraph pam |
82 |
+ +perl profiling selinux +server sphinx sst-rsync sst-mariabackup sst-xtrabackup |
83 |
+ systemd systemtap static static-libs tcmalloc test tokudb xml yassl" |
84 |
+ |
85 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
86 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
87 |
+ |
88 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
89 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
90 |
+ ?? ( tcmalloc jemalloc ) |
91 |
+ static? ( yassl !pam )" |
92 |
+ |
93 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
94 |
+ |
95 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
96 |
+# and we will run a mysql server during test phase |
97 |
+S="${WORKDIR}/mysql" |
98 |
+ |
99 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
100 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
101 |
+ inherit git-r3 |
102 |
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" |
103 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
104 |
+ EGIT_CLONE_TYPE=shallow |
105 |
+else |
106 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
107 |
+fi |
108 |
+ |
109 |
+PATCHES=( |
110 |
+ "${MY_PATCH_DIR}"/20006_all_cmake_elib-mariadb-10.1.27.patch |
111 |
+ "${MY_PATCH_DIR}"/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch |
112 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
113 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.1.16-without-clientlibs-tools.patch |
114 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.1.26-gssapi-detect.patch |
115 |
+ "${MY_PATCH_DIR}"/20029_all_mariadb-10.1.37-enable-numa.patch |
116 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.1-atomic-detection.patch |
117 |
+) |
118 |
+ |
119 |
+# Be warned, *DEPEND are version-dependant |
120 |
+# These are used for both runtime and compiletime |
121 |
+COMMON_DEPEND=" |
122 |
+ kernel_linux? ( |
123 |
+ sys-process/procps:0= |
124 |
+ dev-libs/libaio:0= |
125 |
+ ) |
126 |
+ >=sys-apps/sed-4 |
127 |
+ >=sys-apps/texinfo-4.7-r1 |
128 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
129 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
130 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
131 |
+ !yassl? ( |
132 |
+ !libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 ) |
133 |
+ libressl? ( dev-libs/libressl:0= ) |
134 |
+ ) |
135 |
+ >=sys-libs/zlib-1.2.3:0= |
136 |
+ sys-libs/ncurses:0= |
137 |
+ !bindist? ( |
138 |
+ sys-libs/binutils-libs:0= |
139 |
+ >=sys-libs/readline-4.1:0= |
140 |
+ ) |
141 |
+ server? ( |
142 |
+ backup? ( app-arch/libarchive:0= ) |
143 |
+ cracklib? ( sys-libs/cracklib:0= ) |
144 |
+ extraengine? ( |
145 |
+ odbc? ( dev-db/unixODBC:0= ) |
146 |
+ xml? ( dev-libs/libxml2:2= ) |
147 |
+ sys-libs/zlib[minizip] |
148 |
+ ) |
149 |
+ innodb-lz4? ( app-arch/lz4 ) |
150 |
+ innodb-lzo? ( dev-libs/lzo ) |
151 |
+ innodb-snappy? ( app-arch/snappy ) |
152 |
+ kerberos? ( virtual/krb5 ) |
153 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
154 |
+ numa? ( sys-process/numactl ) |
155 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
156 |
+ pam? ( virtual/pam:0= ) |
157 |
+ systemd? ( sys-apps/systemd:= ) |
158 |
+ tokudb? ( app-arch/snappy ) |
159 |
+ ) |
160 |
+ !yassl? ( !libressl? ( !>=dev-libs/openssl-1.1.0 ) ) |
161 |
+ >=dev-libs/libpcre-8.41-r1:3= |
162 |
+ !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
163 |
+" |
164 |
+DEPEND="virtual/yacc |
165 |
+ static? ( sys-libs/ncurses[static-libs] ) |
166 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
167 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
168 |
+ ${COMMON_DEPEND}" |
169 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
170 |
+ client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
171 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
172 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
173 |
+ ${COMMON_DEPEND} |
174 |
+ server? ( galera? ( |
175 |
+ sys-apps/iproute2 |
176 |
+ =sys-cluster/galera-25* |
177 |
+ sst-rsync? ( sys-process/lsof ) |
178 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
179 |
+ sst-xtrabackup? ( net-misc/socat[ssl] ) |
180 |
+ ) ) |
181 |
+ perl? ( !dev-db/mytop |
182 |
+ virtual/perl-Getopt-Long |
183 |
+ dev-perl/TermReadKey |
184 |
+ virtual/perl-Term-ANSIColor |
185 |
+ virtual/perl-Time-HiRes ) |
186 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
187 |
+" |
188 |
+# For other stuff to bring us in |
189 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
190 |
+# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed |
191 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
192 |
+ server? ( galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" |
193 |
+ |
194 |
+pkg_setup() { |
195 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
196 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
197 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
198 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
199 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
200 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
201 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
202 |
+ die |
203 |
+ fi |
204 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
205 |
+ # non x86{,_64} arches |
206 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
207 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
208 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
209 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
210 |
+ die |
211 |
+ fi |
212 |
+ fi |
213 |
+ java-pkg-opt-2_pkg_setup |
214 |
+ if has test ${FEATURES} && \ |
215 |
+ use server && ! has userpriv ${FEATURES} ; then |
216 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
217 |
+ fi |
218 |
+ |
219 |
+ # This should come after all of the die statements |
220 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
221 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
222 |
+} |
223 |
+ |
224 |
+pkg_preinst() { |
225 |
+ java-pkg-opt-2_pkg_preinst |
226 |
+} |
227 |
+ |
228 |
+pkg_postinst() { |
229 |
+ # Make sure the vars are correctly initialized |
230 |
+ mysql_init_vars |
231 |
+ |
232 |
+ # Create log directory securely if it does not exist |
233 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
234 |
+ |
235 |
+ if use server ; then |
236 |
+ if use pam; then |
237 |
+ einfo |
238 |
+ elog "This install includes the PAM authentication plugin." |
239 |
+ elog "To activate and configure the PAM plugin, please read:" |
240 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
241 |
+ einfo |
242 |
+ fi |
243 |
+ |
244 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
245 |
+ einfo |
246 |
+ elog "You might want to run:" |
247 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
248 |
+ elog "if this is a new install." |
249 |
+ elog |
250 |
+ elog "If you are switching server implentations, you should run the" |
251 |
+ elog "mysql_upgrade tool." |
252 |
+ einfo |
253 |
+ else |
254 |
+ einfo |
255 |
+ elog "If you are upgrading major versions, you should run the" |
256 |
+ elog "mysql_upgrade tool." |
257 |
+ einfo |
258 |
+ fi |
259 |
+ |
260 |
+ einfo |
261 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
262 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
263 |
+ elog "The first time the cluster is activated, you should add" |
264 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
265 |
+ elog "This option should then be removed for subsequent starts." |
266 |
+ einfo |
267 |
+ fi |
268 |
+} |
269 |
+ |
270 |
+src_unpack() { |
271 |
+ unpack ${A} |
272 |
+ # Grab the patches |
273 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack |
274 |
+ |
275 |
+ mv -f "${WORKDIR%/}/${PN%%-galera}-${PV}" "${S}" || die |
276 |
+} |
277 |
+ |
278 |
+src_prepare() { |
279 |
+ _disable_engine() { |
280 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
281 |
+ } |
282 |
+ |
283 |
+ _disable_plugin() { |
284 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
285 |
+ } |
286 |
+ |
287 |
+ if use tcmalloc; then |
288 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die |
289 |
+ fi |
290 |
+ |
291 |
+ # Don't build bundled xz-utils for tokudb |
292 |
+ echo > "${S%/}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
293 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S%/}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
294 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
295 |
+ |
296 |
+ local plugin |
297 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
298 |
+ locale_info qc_info server_audit semisync sql_errlog ) |
299 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext ) |
300 |
+ if ! use server; then # These plugins are for the server |
301 |
+ for plugin in "${server_plugins[@]}" ; do |
302 |
+ _disable_plugin "${plugin}" |
303 |
+ done |
304 |
+ fi |
305 |
+ |
306 |
+ if ! use test; then # These plugins are only used during testing |
307 |
+ for plugin in "${test_plugins[@]}" ; do |
308 |
+ _disable_plugin "${plugin}" |
309 |
+ done |
310 |
+ fi |
311 |
+ |
312 |
+ # Collides with mariadb-connector-c bug 655980 |
313 |
+ _disable_plugin auth_dialog |
314 |
+ |
315 |
+ # Avoid useless library checks |
316 |
+ use mroonga || _disable_engine mroonga |
317 |
+ use oqgraph || _disable_engine oqgraph |
318 |
+ _disable_engine example |
319 |
+ |
320 |
+ cmake-utils_src_prepare |
321 |
+ java-pkg-opt-2_src_prepare |
322 |
+} |
323 |
+ |
324 |
+src_configure(){ |
325 |
+ # bug 508724 mariadb cannot use ld.gold |
326 |
+ tc-ld-disable-gold |
327 |
+ # Bug #114895, bug #110149 |
328 |
+ filter-flags "-O" "-O[01]" |
329 |
+ |
330 |
+ append-cxxflags -felide-constructors |
331 |
+ |
332 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
333 |
+ append-flags -fno-strict-aliasing |
334 |
+ |
335 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
336 |
+ |
337 |
+ # debug hack wrt #497532 |
338 |
+ mycmakeargs=( |
339 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
340 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
341 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" |
342 |
+ -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" |
343 |
+ -DINSTALL_BINDIR=bin |
344 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
345 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
346 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
347 |
+ -DINSTALL_INFODIR=share/info |
348 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
349 |
+ -DINSTALL_MANDIR=share/man |
350 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
351 |
+ -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mariadb/mysql-test' '') |
352 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
353 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
354 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" |
355 |
+ -DINSTALL_SBINDIR=sbin |
356 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" |
357 |
+ -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
358 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
359 |
+ -DWITH_ZLIB=system |
360 |
+ -DENABLED_LOCAL_INFILE=1 |
361 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
362 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
363 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
364 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
365 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
366 |
+ # The build forces this to be defined when cross-compiling. We pass it |
367 |
+ # all the time for simplicity and to make sure it is actually correct. |
368 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
369 |
+ -DWITHOUT_CLIENTLIBS=YES |
370 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
371 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
372 |
+ -DENABLE_DTRACE=$(usex systemtap) |
373 |
+ -DWITH_SSL=$(usex yassl bundled system) |
374 |
+ -DPLUGIN_CLIENT_ED25519=NO |
375 |
+ -DPLUGIN_AUTH_GSSAPI_CLIENT=NO |
376 |
+ ) |
377 |
+ |
378 |
+ if use server ; then |
379 |
+ |
380 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
381 |
+ if ! use extraengine ; then |
382 |
+ mycmakeargs+=( |
383 |
+ -DPLUGIN_FEDERATED=NO |
384 |
+ -DPLUGIN_FEDERATEDX=NO ) |
385 |
+ fi |
386 |
+ |
387 |
+ mycmakeargs+=( |
388 |
+ -DWITH_JEMALLOC=$(usex jemalloc system) |
389 |
+ -DWITH_PCRE=system |
390 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
391 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
392 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
393 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
394 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
395 |
+ -DPLUGIN_CASSANDRA=NO |
396 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
397 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
398 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
399 |
+ -DCONNECT_WITH_MYSQL=1 |
400 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
401 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
402 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
403 |
+ # Build failure and autodep wrt bug 639144 |
404 |
+ -DCONNECT_WITH_MONGO=OFF |
405 |
+ -DWITH_WSREP=$(usex galera) |
406 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
407 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
408 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
409 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
410 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
411 |
+ -DPLUGIN_AUTH_GSSAPI_CLIENT=NO |
412 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
413 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
414 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
415 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
416 |
+ -DINSTALL_SQLBENCHDIR='' |
417 |
+ ) |
418 |
+ |
419 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
420 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
421 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
422 |
+ ewarn "You MUST file bugs without these variables set." |
423 |
+ |
424 |
+ mycmakeargs+=( |
425 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
426 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
427 |
+ ) |
428 |
+ |
429 |
+ elif ! use latin1 ; then |
430 |
+ mycmakeargs+=( |
431 |
+ -DDEFAULT_CHARSET=utf8 |
432 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
433 |
+ ) |
434 |
+ else |
435 |
+ mycmakeargs+=( |
436 |
+ -DDEFAULT_CHARSET=latin1 |
437 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
438 |
+ ) |
439 |
+ fi |
440 |
+ mycmakeargs+=( |
441 |
+ -DEXTRA_CHARSETS=all |
442 |
+ -DMYSQL_USER=mysql |
443 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
444 |
+ -DWITH_DEBUG=$(usex debug) |
445 |
+ -DWITH_EMBEDDED_SERVER=OFF |
446 |
+ -DENABLED_PROFILING=$(usex profiling) |
447 |
+ ) |
448 |
+ |
449 |
+ if use static; then |
450 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
451 |
+ fi |
452 |
+ |
453 |
+ if use jemalloc || use tcmalloc ; then |
454 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
455 |
+ fi |
456 |
+ |
457 |
+ # Storage engines |
458 |
+ mycmakeargs+=( |
459 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
460 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
461 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
462 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
463 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
464 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
465 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
466 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
467 |
+ ) |
468 |
+ |
469 |
+ else |
470 |
+ mycmakeargs+=( |
471 |
+ -DWITHOUT_SERVER=1 |
472 |
+ -DWITH_EMBEDDED_SERVER=OFF |
473 |
+ -DEXTRA_CHARSETS=none |
474 |
+ -DINSTALL_SQLBENCHDIR= |
475 |
+ -DWITH_SYSTEMD=no |
476 |
+ ) |
477 |
+ fi |
478 |
+ |
479 |
+ cmake-utils_src_configure |
480 |
+} |
481 |
+ |
482 |
+src_compile() { |
483 |
+ cmake-utils_src_compile |
484 |
+} |
485 |
+ |
486 |
+src_install() { |
487 |
+ cmake-utils_src_install |
488 |
+ |
489 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
490 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
491 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
492 |
+ fi |
493 |
+ |
494 |
+ # Make sure the vars are correctly initialized |
495 |
+ mysql_init_vars |
496 |
+ |
497 |
+ # Convenience links |
498 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
499 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
500 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
501 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
502 |
+ |
503 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
504 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
505 |
+ rm -Rf "${ED}/usr/data" || die |
506 |
+ fi |
507 |
+ |
508 |
+ # Unless they explicitly specific USE=test, then do not install the |
509 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
510 |
+ # validation of your database configuration after tuning it. |
511 |
+ if ! use test ; then |
512 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
513 |
+ fi |
514 |
+ |
515 |
+ # Configuration stuff |
516 |
+ einfo "Building default configuration ..." |
517 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
518 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
519 |
+ local mycnf_src="my.cnf-5.6-r1" |
520 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
521 |
+ "${FILESDIR}/${mycnf_src}" \ |
522 |
+ > "${TMPDIR}/my.cnf.ok" || die |
523 |
+ use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok" |
524 |
+ if use latin1 ; then |
525 |
+ sed -i \ |
526 |
+ -e "/character-set/s|utf8|latin1|g" \ |
527 |
+ "${TMPDIR}/my.cnf.ok" || die |
528 |
+ fi |
529 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
530 |
+ newins "${TMPDIR}/my.cnf.ok" my.cnf |
531 |
+ |
532 |
+ if use server ; then |
533 |
+ einfo "Including support files and sample configurations" |
534 |
+ docinto "support-files" |
535 |
+ local script |
536 |
+ for script in \ |
537 |
+ "${S}"/support-files/magic |
538 |
+ do |
539 |
+ [[ -f "$script" ]] && dodoc "${script}" |
540 |
+ done |
541 |
+ |
542 |
+ docinto "scripts" |
543 |
+ for script in "${S}"/scripts/mysql* ; do |
544 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
545 |
+ done |
546 |
+ # Manually install supporting files that conflict with other packages |
547 |
+ # but are needed for galera and initial installation |
548 |
+ exeinto /usr/libexec/mariadb |
549 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
550 |
+ fi |
551 |
+ |
552 |
+ #Remove mytop if perl is not selected |
553 |
+ [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
554 |
+} |
555 |
+ |
556 |
+# Official test instructions: |
557 |
+# USE='extraengine perl server' \ |
558 |
+# FEATURES='test userpriv -usersandbox' \ |
559 |
+# ebuild mariadb-X.X.XX.ebuild \ |
560 |
+# digest clean package |
561 |
+src_test() { |
562 |
+ |
563 |
+ _disable_test() { |
564 |
+ local rawtestname reason |
565 |
+ rawtestname="${1}" ; shift |
566 |
+ reason="${@}" |
567 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
568 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
569 |
+ } |
570 |
+ |
571 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
572 |
+ local retstatus_unit |
573 |
+ local retstatus_tests |
574 |
+ |
575 |
+ if ! use server ; then |
576 |
+ einfo "Skipping server tests due to minimal build." |
577 |
+ return 0 |
578 |
+ fi |
579 |
+ |
580 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
581 |
+ # localhost. Also causes weird failures. |
582 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
583 |
+ |
584 |
+ if [[ $UID -eq 0 ]]; then |
585 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
586 |
+ fi |
587 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
588 |
+ |
589 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
590 |
+ |
591 |
+ # Run CTest (test-units) |
592 |
+# cmake-utils_src_test |
593 |
+# retstatus_unit=$? |
594 |
+ |
595 |
+ # Ensure that parallel runs don't die |
596 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
597 |
+ # Enable parallel testing, auto will try to detect number of cores |
598 |
+ # You may set this by hand. |
599 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
600 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
601 |
+ |
602 |
+ # create directories because mysqladmin might run out of order |
603 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
604 |
+ |
605 |
+ # Run mysql tests |
606 |
+ pushd "${TESTDIR}" > /dev/null || die |
607 |
+ |
608 |
+ touch "${T}/disabled.def" |
609 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
610 |
+ # false positives: |
611 |
+ # |
612 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
613 |
+ # main.mysql_client_test_comp: |
614 |
+ # segfaults at random under Portage only, suspect resource limits. |
615 |
+ |
616 |
+ local t |
617 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
618 |
+ _disable_test "$t" "False positive due to varying policies" |
619 |
+ done |
620 |
+ |
621 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
622 |
+ rpl.rpl_semi_sync_uninstall_plugin \ |
623 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
624 |
+ _disable_test "$t" "False positives in Gentoo" |
625 |
+ done |
626 |
+ |
627 |
+ if ! use client-libs ; then |
628 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
629 |
+ fi |
630 |
+ |
631 |
+ _disable_test sys_vars.sysvars_server_notembedded "Broken test" # bug #661700 required profiling always on |
632 |
+ |
633 |
+ # run mysql-test tests |
634 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
635 |
+ retstatus_tests=$? |
636 |
+ |
637 |
+ popd > /dev/null || die |
638 |
+ |
639 |
+ # Cleanup is important for these testcases. |
640 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
641 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
642 |
+ |
643 |
+ local failures="" |
644 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
645 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
646 |
+ |
647 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
648 |
+ einfo "Tests successfully completed" |
649 |
+} |
650 |
+ |
651 |
+mysql_init_vars() { |
652 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
653 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
654 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
655 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
656 |
+ |
657 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
658 |
+ MY_DATADIR="" |
659 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
660 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
661 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
662 |
+ | tail -n1` |
663 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
664 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
665 |
+ | sed -e 's/.*=\s*//' \ |
666 |
+ | tail -n1` |
667 |
+ fi |
668 |
+ fi |
669 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
670 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
671 |
+ einfo "Using default MY_DATADIR" |
672 |
+ fi |
673 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
674 |
+ |
675 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
676 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
677 |
+ # If you get this and you're wondering about it, see bug #207636 |
678 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
679 |
+ elog "A new one will not be created." |
680 |
+ PREVIOUS_DATADIR="yes" |
681 |
+ else |
682 |
+ PREVIOUS_DATADIR="no" |
683 |
+ fi |
684 |
+ export PREVIOUS_DATADIR |
685 |
+ fi |
686 |
+ else |
687 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
688 |
+ local new_MY_DATADIR |
689 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
690 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
691 |
+ | tail -n1` |
692 |
+ |
693 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
694 |
+ ewarn "MySQL MY_DATADIR has changed" |
695 |
+ ewarn "from ${MY_DATADIR}" |
696 |
+ ewarn "to ${new_MY_DATADIR}" |
697 |
+ MY_DATADIR="${new_MY_DATADIR}" |
698 |
+ fi |
699 |
+ fi |
700 |
+ fi |
701 |
+ |
702 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
703 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
704 |
+ export MY_DATADIR |
705 |
+} |
706 |
+ |
707 |
+pkg_config() { |
708 |
+ _getoptval() { |
709 |
+ local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults |
710 |
+ local section="$1" |
711 |
+ local flag="--${2}=" |
712 |
+ local extra_options="${3}" |
713 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
714 |
+ } |
715 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
716 |
+ local old_HOME="${HOME}" |
717 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
718 |
+ export HOME=${EPREFIX}/root |
719 |
+ |
720 |
+ # Make sure the vars are correctly initialized |
721 |
+ mysql_init_vars |
722 |
+ |
723 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
724 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
725 |
+ die "Minimal builds do NOT include the MySQL server" |
726 |
+ fi |
727 |
+ |
728 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
729 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
730 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
731 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
732 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
733 |
+ |
734 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
735 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
736 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
737 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
738 |
+ else |
739 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
740 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
741 |
+ || die "Moving MY_DATADIR failed" |
742 |
+ fi |
743 |
+ else |
744 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
745 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
746 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
747 |
+ else |
748 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
749 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
750 |
+ fi |
751 |
+ fi |
752 |
+ fi |
753 |
+ |
754 |
+ local pwd1="a" |
755 |
+ local pwd2="b" |
756 |
+ local maxtry=15 |
757 |
+ |
758 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
759 |
+ local tmp_mysqld_password_source= |
760 |
+ |
761 |
+ for tmp_mysqld_password_source in mysql client; do |
762 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
763 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
764 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
765 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
766 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
767 |
+ MYSQL_ROOT_PASSWORD= |
768 |
+ continue |
769 |
+ fi |
770 |
+ |
771 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
772 |
+ break |
773 |
+ fi |
774 |
+ done |
775 |
+ |
776 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
777 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
778 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
779 |
+ fi |
780 |
+ |
781 |
+ unset tmp_mysqld_password_source |
782 |
+ fi |
783 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
784 |
+ # These are dir+prefix |
785 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
786 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
787 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
788 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
789 |
+ |
790 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
791 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
792 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
793 |
+ fi |
794 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
795 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
796 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
797 |
+ fi |
798 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
799 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
800 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
801 |
+ fi |
802 |
+ |
803 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
804 |
+ ewarn "You have already a MySQL database in place." |
805 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
806 |
+ ewarn "Please rename or delete it if you wish to replace it." |
807 |
+ die "MySQL database already exists!" |
808 |
+ fi |
809 |
+ |
810 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
811 |
+ # localhost. Also causes weird failures. |
812 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
813 |
+ |
814 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
815 |
+ |
816 |
+ einfo "Please provide a password for the mysql 'root' user now" |
817 |
+ einfo "or through the ${HOME}/.my.cnf file." |
818 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
819 |
+ read -rsp " >" pwd1 ; echo |
820 |
+ |
821 |
+ einfo "Retype the password" |
822 |
+ read -rsp " >" pwd2 ; echo |
823 |
+ |
824 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
825 |
+ die "Passwords are not the same" |
826 |
+ fi |
827 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
828 |
+ unset pwd1 pwd2 |
829 |
+ fi |
830 |
+ |
831 |
+ local options |
832 |
+ local sqltmp="$(emktemp)" |
833 |
+ |
834 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
835 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
836 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
837 |
+ |
838 |
+ # Figure out which options we need to disable to do the setup |
839 |
+ local helpfile="${TMPDIR}/mysqld-help" |
840 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
841 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
842 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
843 |
+ log-slave-updates \ |
844 |
+ ; do |
845 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
846 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
847 |
+ done |
848 |
+ |
849 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
850 |
+ |
851 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
852 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
853 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
854 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
855 |
+ fi |
856 |
+ |
857 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
858 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
859 |
+ fi |
860 |
+ |
861 |
+ pushd "${TMPDIR}" &>/dev/null || die |
862 |
+ |
863 |
+ # Filling timezones, see |
864 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
865 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
866 |
+ |
867 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
868 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
869 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
870 |
+ einfo "Command: ${cmd[*]}" |
871 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
872 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
873 |
+ if [ $? -ne 0 ]; then |
874 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
875 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
876 |
+ fi |
877 |
+ popd &>/dev/null || die |
878 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
879 |
+ || die "MySQL databases not installed" |
880 |
+ |
881 |
+ use prefix || options="${options} --user=mysql" |
882 |
+ |
883 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
884 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
885 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
886 |
+ ${options} \ |
887 |
+ --log-warnings=0 \ |
888 |
+ --basedir=${EROOT}/usr \ |
889 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
890 |
+ --max_allowed_packet=8M \ |
891 |
+ --net_buffer_length=16K \ |
892 |
+ --socket=${socket} \ |
893 |
+ --pid-file=${pidfile} \ |
894 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
895 |
+ #einfo "About to start mysqld: ${mysqld}" |
896 |
+ ebegin "Starting mysqld" |
897 |
+ einfo "Command ${mysqld}" |
898 |
+ ${mysqld} & |
899 |
+ rc=$? |
900 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
901 |
+ maxtry=$((${maxtry}-1)) |
902 |
+ echo -n "." |
903 |
+ sleep 1 |
904 |
+ done |
905 |
+ eend $rc |
906 |
+ |
907 |
+ if ! [[ -S "${socket}" ]]; then |
908 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
909 |
+ fi |
910 |
+ |
911 |
+ ebegin "Setting root password" |
912 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
913 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
914 |
+ "${EROOT}/usr/bin/mysql" \ |
915 |
+ "--socket=${socket}" \ |
916 |
+ -hlocalhost \ |
917 |
+ -e "${sql}" |
918 |
+ eend $? |
919 |
+ |
920 |
+ if [[ -n "${sqltmp}" ]] ; then |
921 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
922 |
+ "${EROOT}/usr/bin/mysql" \ |
923 |
+ "--socket=${socket}" \ |
924 |
+ -hlocalhost \ |
925 |
+ -uroot \ |
926 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
927 |
+ mysql < "${sqltmp}" |
928 |
+ rc=$? |
929 |
+ eend $? |
930 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
931 |
+ fi |
932 |
+ |
933 |
+ # Stop the server and cleanup |
934 |
+ einfo "Stopping the server ..." |
935 |
+ kill $(< "${pidfile}" ) |
936 |
+ rm -f "${sqltmp}" |
937 |
+ wait %1 |
938 |
+ einfo "Done" |
939 |
+} |
940 |
|
941 |
diff --git a/dev-db/mariadb/mariadb-10.2.26.ebuild b/dev-db/mariadb/mariadb-10.2.26.ebuild |
942 |
new file mode 100644 |
943 |
index 00000000000..21d67c30226 |
944 |
--- /dev/null |
945 |
+++ b/dev-db/mariadb/mariadb-10.2.26.ebuild |
946 |
@@ -0,0 +1,974 @@ |
947 |
+# Copyright 1999-2019 Gentoo Authors |
948 |
+# Distributed under the terms of the GNU General Public License v2 |
949 |
+ |
950 |
+EAPI="6" |
951 |
+MY_EXTRAS_VER="20190305-2052Z" |
952 |
+SUBSLOT="18" |
953 |
+ |
954 |
+JAVA_PKG_OPT_USE="jdbc" |
955 |
+ |
956 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
957 |
+ |
958 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
959 |
+ java-pkg-opt-2 user cmake-utils |
960 |
+ |
961 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
962 |
+ |
963 |
+# Gentoo patches to MySQL |
964 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
965 |
+ SRC_URI="${SRC_URI} |
966 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
967 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
968 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
969 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
970 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
971 |
+fi |
972 |
+ |
973 |
+HOMEPAGE="https://mariadb.org/" |
974 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
975 |
+LICENSE="GPL-2 LGPL-2.1+" |
976 |
+SLOT="0/${SUBSLOT:-0}" |
977 |
+IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 |
978 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
979 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
980 |
+ sst-rsync sst-mariabackup sst-xtrabackup static systemd systemtap tcmalloc |
981 |
+ test tokudb xml yassl" |
982 |
+ |
983 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
984 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
985 |
+ |
986 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
987 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
988 |
+ ?? ( tcmalloc jemalloc ) |
989 |
+ static? ( yassl !pam )" |
990 |
+ |
991 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
992 |
+ |
993 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
994 |
+# and we will run a mysql server during test phase |
995 |
+S="${WORKDIR}/mysql" |
996 |
+ |
997 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
998 |
+ inherit git-r3 |
999 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
1000 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
1001 |
+ EGIT_CLONE_TYPE=shallow |
1002 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
1003 |
+else |
1004 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
1005 |
+fi |
1006 |
+ |
1007 |
+PATCHES=( |
1008 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
1009 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.16-without-clientlibs-tools.patch |
1010 |
+ "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch |
1011 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch |
1012 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.2-atomic-detection.patch |
1013 |
+) |
1014 |
+ |
1015 |
+# Be warned, *DEPEND are version-dependant |
1016 |
+# These are used for both runtime and compiletime |
1017 |
+COMMON_DEPEND=" |
1018 |
+ kernel_linux? ( |
1019 |
+ sys-process/procps:0= |
1020 |
+ dev-libs/libaio:0= |
1021 |
+ ) |
1022 |
+ >=sys-apps/sed-4 |
1023 |
+ >=sys-apps/texinfo-4.7-r1 |
1024 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
1025 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
1026 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
1027 |
+ >=sys-libs/zlib-1.2.3:0= |
1028 |
+ kerberos? ( virtual/krb5 ) |
1029 |
+ yassl? ( net-libs/gnutls:0= ) |
1030 |
+ !yassl? ( |
1031 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
1032 |
+ libressl? ( dev-libs/libressl:0= ) |
1033 |
+ ) |
1034 |
+ sys-libs/ncurses:0= |
1035 |
+ !bindist? ( |
1036 |
+ sys-libs/binutils-libs:0= |
1037 |
+ >=sys-libs/readline-4.1:0= |
1038 |
+ ) |
1039 |
+ server? ( |
1040 |
+ backup? ( app-arch/libarchive:0= ) |
1041 |
+ cracklib? ( sys-libs/cracklib:0= ) |
1042 |
+ extraengine? ( |
1043 |
+ odbc? ( dev-db/unixODBC:0= ) |
1044 |
+ xml? ( dev-libs/libxml2:2= ) |
1045 |
+ ) |
1046 |
+ innodb-lz4? ( app-arch/lz4 ) |
1047 |
+ innodb-lzo? ( dev-libs/lzo ) |
1048 |
+ innodb-snappy? ( app-arch/snappy ) |
1049 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
1050 |
+ numa? ( sys-process/numactl ) |
1051 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
1052 |
+ pam? ( virtual/pam:0= ) |
1053 |
+ systemd? ( sys-apps/systemd:= ) |
1054 |
+ tokudb? ( app-arch/snappy ) |
1055 |
+ ) |
1056 |
+ >=dev-libs/libpcre-8.41-r1:3= |
1057 |
+" |
1058 |
+DEPEND="virtual/yacc |
1059 |
+ static? ( sys-libs/ncurses[static-libs] ) |
1060 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
1061 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
1062 |
+ ${COMMON_DEPEND}" |
1063 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
1064 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
1065 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
1066 |
+ !<virtual/mysql-5.6-r11 |
1067 |
+ ${COMMON_DEPEND} |
1068 |
+ server? ( galera? ( |
1069 |
+ sys-apps/iproute2 |
1070 |
+ =sys-cluster/galera-25* |
1071 |
+ sst-rsync? ( sys-process/lsof ) |
1072 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
1073 |
+ sst-xtrabackup? ( net-misc/socat[ssl] ) |
1074 |
+ ) ) |
1075 |
+ perl? ( !dev-db/mytop |
1076 |
+ virtual/perl-Getopt-Long |
1077 |
+ dev-perl/TermReadKey |
1078 |
+ virtual/perl-Term-ANSIColor |
1079 |
+ virtual/perl-Time-HiRes ) |
1080 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
1081 |
+" |
1082 |
+# For other stuff to bring us in |
1083 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
1084 |
+# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed |
1085 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
1086 |
+ server? ( ~virtual/mysql-5.6[static=] |
1087 |
+ galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" |
1088 |
+ |
1089 |
+pkg_setup() { |
1090 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
1091 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
1092 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
1093 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
1094 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
1095 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
1096 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
1097 |
+ die |
1098 |
+ fi |
1099 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
1100 |
+ # non x86{,_64} arches |
1101 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
1102 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
1103 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
1104 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
1105 |
+ die |
1106 |
+ fi |
1107 |
+ fi |
1108 |
+ java-pkg-opt-2_pkg_setup |
1109 |
+ if has test ${FEATURES} && \ |
1110 |
+ use server && ! has userpriv ${FEATURES} ; then |
1111 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1112 |
+ fi |
1113 |
+ |
1114 |
+ # This should come after all of the die statements |
1115 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
1116 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
1117 |
+} |
1118 |
+ |
1119 |
+pkg_preinst() { |
1120 |
+ java-pkg-opt-2_pkg_preinst |
1121 |
+ |
1122 |
+ # Here we need to see if the implementation switched client libraries |
1123 |
+ # We check if this is a new instance of the package and a client library already exists |
1124 |
+ local SHOW_ABI_MESSAGE libpath |
1125 |
+ if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
1126 |
+ libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
1127 |
+ elog "Due to ABI changes when switching between different client libraries," |
1128 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
1129 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
1130 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
1131 |
+ fi |
1132 |
+} |
1133 |
+ |
1134 |
+pkg_postinst() { |
1135 |
+ # Make sure the vars are correctly initialized |
1136 |
+ mysql_init_vars |
1137 |
+ |
1138 |
+ # Create log directory securely if it does not exist |
1139 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
1140 |
+ |
1141 |
+ if use server ; then |
1142 |
+ if use pam; then |
1143 |
+ einfo |
1144 |
+ elog "This install includes the PAM authentication plugin." |
1145 |
+ elog "To activate and configure the PAM plugin, please read:" |
1146 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
1147 |
+ einfo |
1148 |
+ fi |
1149 |
+ |
1150 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
1151 |
+ einfo |
1152 |
+ elog "You might want to run:" |
1153 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
1154 |
+ elog "if this is a new install." |
1155 |
+ elog |
1156 |
+ elog "If you are switching server implentations, you should run the" |
1157 |
+ elog "mysql_upgrade tool." |
1158 |
+ einfo |
1159 |
+ else |
1160 |
+ einfo |
1161 |
+ elog "If you are upgrading major versions, you should run the" |
1162 |
+ elog "mysql_upgrade tool." |
1163 |
+ einfo |
1164 |
+ fi |
1165 |
+ |
1166 |
+ if use galera ; then |
1167 |
+ einfo |
1168 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
1169 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
1170 |
+ elog "The first time the cluster is activated, you should add" |
1171 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
1172 |
+ elog "This option should then be removed for subsequent starts." |
1173 |
+ einfo |
1174 |
+ if use sst-xtrabackup ; then |
1175 |
+ ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup" |
1176 |
+ ewarn "as an SST is broken by default beginning with 10.2.19 with the setting" |
1177 |
+ ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead." |
1178 |
+ ewarn "sst-xtrabackup is being removed in 10.3 and higher." |
1179 |
+ fi |
1180 |
+ fi |
1181 |
+ fi |
1182 |
+ |
1183 |
+ # Note about configuration change |
1184 |
+ einfo |
1185 |
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf" |
1186 |
+ elog "to several files in /etc/mysql/${PN}.d." |
1187 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
1188 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
1189 |
+ elog "You may have as many files as needed and they are read alphabetically." |
1190 |
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
1191 |
+ einfo |
1192 |
+} |
1193 |
+ |
1194 |
+src_unpack() { |
1195 |
+ unpack ${A} |
1196 |
+ # Grab the patches |
1197 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack |
1198 |
+ |
1199 |
+ mv -f "${WORKDIR%/}/${P}" "${S}" || die |
1200 |
+} |
1201 |
+ |
1202 |
+src_prepare() { |
1203 |
+ _disable_plugin() { |
1204 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
1205 |
+ } |
1206 |
+ _disable_engine() { |
1207 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
1208 |
+ } |
1209 |
+ |
1210 |
+ local malloc |
1211 |
+ for malloc in jemalloc tcmalloc ; do |
1212 |
+ if use ${malloc}; then |
1213 |
+ echo "TARGET_LINK_LIBRARIES(mysqld ${malloc})" >> "${S}/sql/CMakeLists.txt" |
1214 |
+ fi |
1215 |
+ done |
1216 |
+ |
1217 |
+ # Don't build bundled xz-utils for tokudb |
1218 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
1219 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
1220 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
1221 |
+ |
1222 |
+ local plugin |
1223 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
1224 |
+ locale_info qc_info server_audit sql_errlog auth_ed25519 ) |
1225 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext |
1226 |
+ debug_key_management example_key_management ) |
1227 |
+ if ! use server; then # These plugins are for the server |
1228 |
+ for plugin in "${server_plugins[@]}" ; do |
1229 |
+ _disable_plugin "${plugin}" |
1230 |
+ done |
1231 |
+ fi |
1232 |
+ |
1233 |
+ if ! use test; then # These plugins are only used during testing |
1234 |
+ for plugin in "${test_plugins[@]}" ; do |
1235 |
+ _disable_plugin "${plugin}" |
1236 |
+ done |
1237 |
+ _disable_engine test_sql_discovery |
1238 |
+ fi |
1239 |
+ |
1240 |
+ _disable_engine example |
1241 |
+ |
1242 |
+ if ! use oqgraph ; then # avoids extra library checks |
1243 |
+ _disable_engine oqgraph |
1244 |
+ fi |
1245 |
+ |
1246 |
+ if use mroonga ; then |
1247 |
+ # Remove the bundled groonga |
1248 |
+ # There is no CMake flag, it simply checks for existance |
1249 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
1250 |
+ else |
1251 |
+ _disable_engine mroonga |
1252 |
+ fi |
1253 |
+ |
1254 |
+ cmake-utils_src_prepare |
1255 |
+ java-pkg-opt-2_src_prepare |
1256 |
+} |
1257 |
+ |
1258 |
+src_configure(){ |
1259 |
+ # bug 508724 mariadb cannot use ld.gold |
1260 |
+ tc-ld-disable-gold |
1261 |
+ # Bug #114895, bug #110149 |
1262 |
+ filter-flags "-O" "-O[01]" |
1263 |
+ |
1264 |
+ append-cxxflags -felide-constructors |
1265 |
+ |
1266 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
1267 |
+ append-flags -fno-strict-aliasing |
1268 |
+ |
1269 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
1270 |
+ |
1271 |
+ # debug hack wrt #497532 |
1272 |
+ mycmakeargs=( |
1273 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1274 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
1275 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
1276 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
1277 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
1278 |
+ -DINSTALL_BINDIR=bin |
1279 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
1280 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
1281 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
1282 |
+ -DINSTALL_INFODIR=share/info |
1283 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
1284 |
+ -DINSTALL_MANDIR=share/man |
1285 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
1286 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
1287 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
1288 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
1289 |
+ -DINSTALL_SBINDIR=sbin |
1290 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
1291 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
1292 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
1293 |
+ -DWITH_LIBEDIT=0 |
1294 |
+ -DWITH_ZLIB=system |
1295 |
+ -DWITHOUT_LIBWRAP=1 |
1296 |
+ -DENABLED_LOCAL_INFILE=1 |
1297 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
1298 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
1299 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
1300 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
1301 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
1302 |
+ # The build forces this to be defined when cross-compiling. We pass it |
1303 |
+ # all the time for simplicity and to make sure it is actually correct. |
1304 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
1305 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
1306 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
1307 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
1308 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
1309 |
+ -DWITH_EXTERNAL_ZLIB=YES |
1310 |
+ -DSUFFIX_INSTALL_DIR="" |
1311 |
+ -DWITH_UNITTEST=OFF |
1312 |
+ -DWITHOUT_CLIENTLIBS=YES |
1313 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
1314 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF |
1315 |
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF |
1316 |
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC |
1317 |
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF |
1318 |
+ ) |
1319 |
+ if use test ; then |
1320 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
1321 |
+ else |
1322 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
1323 |
+ fi |
1324 |
+ |
1325 |
+ if ! use yassl ; then |
1326 |
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) |
1327 |
+ else |
1328 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
1329 |
+ fi |
1330 |
+ |
1331 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
1332 |
+ mycmakeargs+=( |
1333 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
1334 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
1335 |
+ -DENABLE_DTRACE=$(usex systemtap) |
1336 |
+ ) |
1337 |
+ |
1338 |
+ if use server ; then |
1339 |
+ |
1340 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
1341 |
+ if ! use extraengine ; then |
1342 |
+ mycmakeargs+=( |
1343 |
+ -DPLUGIN_FEDERATED=NO |
1344 |
+ -DPLUGIN_FEDERATEDX=NO ) |
1345 |
+ fi |
1346 |
+ |
1347 |
+ mycmakeargs+=( |
1348 |
+ -DWITH_JEMALLOC=$(usex jemalloc system) |
1349 |
+ -DWITH_PCRE=system |
1350 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
1351 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
1352 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
1353 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
1354 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
1355 |
+ -DPLUGIN_CASSANDRA=NO |
1356 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
1357 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
1358 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
1359 |
+ -DCONNECT_WITH_MYSQL=1 |
1360 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
1361 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
1362 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
1363 |
+ # Build failure and autodep wrt bug 639144 |
1364 |
+ -DCONNECT_WITH_MONGO=OFF |
1365 |
+ -DWITH_WSREP=$(usex galera) |
1366 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
1367 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
1368 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
1369 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
1370 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
1371 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
1372 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
1373 |
+ -DINSTALL_SQLBENCHDIR=share/mariadb |
1374 |
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) |
1375 |
+ # systemd is only linked to for server notification |
1376 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
1377 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
1378 |
+ ) |
1379 |
+ |
1380 |
+ # Workaround for MDEV-14524 |
1381 |
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) |
1382 |
+ |
1383 |
+ if use test ; then |
1384 |
+ # This is needed for the new client lib which tests a real, open server |
1385 |
+ mycmakeargs+=( -DSKIP_TESTS=ON ) |
1386 |
+ fi |
1387 |
+ |
1388 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
1389 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
1390 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
1391 |
+ ewarn "You MUST file bugs without these variables set." |
1392 |
+ |
1393 |
+ mycmakeargs+=( |
1394 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
1395 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
1396 |
+ ) |
1397 |
+ |
1398 |
+ elif ! use latin1 ; then |
1399 |
+ mycmakeargs+=( |
1400 |
+ -DDEFAULT_CHARSET=utf8 |
1401 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
1402 |
+ ) |
1403 |
+ else |
1404 |
+ mycmakeargs+=( |
1405 |
+ -DDEFAULT_CHARSET=latin1 |
1406 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
1407 |
+ ) |
1408 |
+ fi |
1409 |
+ mycmakeargs+=( |
1410 |
+ -DEXTRA_CHARSETS=all |
1411 |
+ -DMYSQL_USER=mysql |
1412 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
1413 |
+ -DWITH_DEBUG=$(usex debug) |
1414 |
+ -DWITH_EMBEDDED_SERVER=OFF |
1415 |
+ -DWITH_PROFILING=$(usex profiling) |
1416 |
+ ) |
1417 |
+ |
1418 |
+ if use static; then |
1419 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
1420 |
+ fi |
1421 |
+ |
1422 |
+ if use jemalloc || use tcmalloc ; then |
1423 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
1424 |
+ fi |
1425 |
+ |
1426 |
+ # Storage engines |
1427 |
+ mycmakeargs+=( |
1428 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
1429 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
1430 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
1431 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
1432 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
1433 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
1434 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
1435 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
1436 |
+ ) |
1437 |
+ |
1438 |
+ else |
1439 |
+ mycmakeargs+=( |
1440 |
+ -DWITHOUT_SERVER=1 |
1441 |
+ -DWITH_EMBEDDED_SERVER=OFF |
1442 |
+ -DEXTRA_CHARSETS=none |
1443 |
+ -DINSTALL_SQLBENCHDIR= |
1444 |
+ -DWITH_SYSTEMD=no |
1445 |
+ ) |
1446 |
+ fi |
1447 |
+ |
1448 |
+ cmake-utils_src_configure |
1449 |
+} |
1450 |
+ |
1451 |
+src_compile() { |
1452 |
+ cmake-utils_src_compile |
1453 |
+} |
1454 |
+ |
1455 |
+src_install() { |
1456 |
+ cmake-utils_src_install |
1457 |
+ |
1458 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
1459 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
1460 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
1461 |
+ fi |
1462 |
+ |
1463 |
+ # Make sure the vars are correctly initialized |
1464 |
+ mysql_init_vars |
1465 |
+ |
1466 |
+ # Convenience links |
1467 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
1468 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
1469 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
1470 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
1471 |
+ |
1472 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
1473 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
1474 |
+ rm -Rf "${ED}/usr/data" || die |
1475 |
+ fi |
1476 |
+ |
1477 |
+ # Unless they explicitly specific USE=test, then do not install the |
1478 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
1479 |
+ # validation of your database configuration after tuning it. |
1480 |
+ if ! use test ; then |
1481 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
1482 |
+ fi |
1483 |
+ |
1484 |
+ # Configuration stuff |
1485 |
+ einfo "Building default configuration ..." |
1486 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
1487 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
1488 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
1489 |
+ eprefixify "${TMPDIR}/my.cnf" |
1490 |
+ doins "${TMPDIR}/my.cnf" |
1491 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
1492 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
1493 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
1494 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
1495 |
+ |
1496 |
+ if use server ; then |
1497 |
+ mycnf_src="my.cnf.distro-server" |
1498 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
1499 |
+ "${FILESDIR}/${mycnf_src}" \ |
1500 |
+ > "${TMPDIR}/my.cnf.ok" || die |
1501 |
+ if use prefix ; then |
1502 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
1503 |
+ "${TMPDIR}/my.cnf.ok" || die |
1504 |
+ fi |
1505 |
+ if use latin1 ; then |
1506 |
+ sed -i \ |
1507 |
+ -e "/character-set/s|utf8|latin1|g" \ |
1508 |
+ "${TMPDIR}/my.cnf.ok" || die |
1509 |
+ fi |
1510 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
1511 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
1512 |
+ |
1513 |
+ einfo "Including support files and sample configurations" |
1514 |
+ docinto "support-files" |
1515 |
+ local script |
1516 |
+ for script in \ |
1517 |
+ "${S}"/support-files/magic |
1518 |
+ do |
1519 |
+ [[ -f "$script" ]] && dodoc "${script}" |
1520 |
+ done |
1521 |
+ |
1522 |
+ docinto "scripts" |
1523 |
+ for script in "${S}"/scripts/mysql* ; do |
1524 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
1525 |
+ done |
1526 |
+ # Manually install supporting files that conflict with other packages |
1527 |
+ # but are needed for galera and initial installation |
1528 |
+ exeinto /usr/libexec/mariadb |
1529 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
1530 |
+ fi |
1531 |
+ |
1532 |
+ #Remove mytop if perl is not selected |
1533 |
+ [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
1534 |
+} |
1535 |
+ |
1536 |
+# Official test instructions: |
1537 |
+# USE='extraengine perl server' \ |
1538 |
+# FEATURES='test userpriv -usersandbox' \ |
1539 |
+# ebuild mariadb-X.X.XX.ebuild \ |
1540 |
+# digest clean package |
1541 |
+src_test() { |
1542 |
+ |
1543 |
+ _disable_test() { |
1544 |
+ local rawtestname reason |
1545 |
+ rawtestname="${1}" ; shift |
1546 |
+ reason="${@}" |
1547 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
1548 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
1549 |
+ } |
1550 |
+ |
1551 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
1552 |
+ local retstatus_unit |
1553 |
+ local retstatus_tests |
1554 |
+ |
1555 |
+ if ! use server ; then |
1556 |
+ einfo "Skipping server tests due to minimal build." |
1557 |
+ return 0 |
1558 |
+ fi |
1559 |
+ |
1560 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1561 |
+ # localhost. Also causes weird failures. |
1562 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1563 |
+ |
1564 |
+ if [[ $UID -eq 0 ]]; then |
1565 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
1566 |
+ fi |
1567 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
1568 |
+ |
1569 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
1570 |
+ |
1571 |
+ # Run CTest (test-units) |
1572 |
+ cmake-utils_src_test |
1573 |
+ retstatus_unit=$? |
1574 |
+ |
1575 |
+ # Ensure that parallel runs don't die |
1576 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
1577 |
+ # Enable parallel testing, auto will try to detect number of cores |
1578 |
+ # You may set this by hand. |
1579 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
1580 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
1581 |
+ |
1582 |
+ # create directories because mysqladmin might run out of order |
1583 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
1584 |
+ |
1585 |
+ # Run mysql tests |
1586 |
+ pushd "${TESTDIR}" > /dev/null || die |
1587 |
+ |
1588 |
+ touch "${T}/disabled.def" |
1589 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
1590 |
+ # false positives: |
1591 |
+ # |
1592 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
1593 |
+ # main.mysql_client_test_comp: |
1594 |
+ # segfaults at random under Portage only, suspect resource limits. |
1595 |
+ |
1596 |
+ local t |
1597 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
1598 |
+ _disable_test "$t" "False positive due to varying policies" |
1599 |
+ done |
1600 |
+ |
1601 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock main.mysql \ |
1602 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
1603 |
+ _disable_test "$t" "False positives in Gentoo" |
1604 |
+ done |
1605 |
+ |
1606 |
+ _disable_test main.gis_notembedded "Needs latin1 USE set" |
1607 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
1608 |
+ _disable_test main.mysqldump "Test fails past 2018-12-31 due to event expiration" |
1609 |
+ |
1610 |
+ # Likely environment issues as only number of clients connected fails |
1611 |
+ _disable_test rpl.rpl_semi_sync_uninstall_plugin \ |
1612 |
+ "Fails intermittently on parallel testing" |
1613 |
+ |
1614 |
+ # run mysql-test tests |
1615 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
1616 |
+ retstatus_tests=$? |
1617 |
+ |
1618 |
+ popd > /dev/null || die |
1619 |
+ |
1620 |
+ # Cleanup is important for these testcases. |
1621 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
1622 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
1623 |
+ |
1624 |
+ local failures="" |
1625 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
1626 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
1627 |
+ |
1628 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
1629 |
+ einfo "Tests successfully completed" |
1630 |
+} |
1631 |
+ |
1632 |
+mysql_init_vars() { |
1633 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
1634 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
1635 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
1636 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
1637 |
+ |
1638 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
1639 |
+ MY_DATADIR="" |
1640 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
1641 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1642 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
1643 |
+ | tail -n1` |
1644 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
1645 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
1646 |
+ | sed -e 's/.*=\s*//' \ |
1647 |
+ | tail -n1` |
1648 |
+ fi |
1649 |
+ fi |
1650 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
1651 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
1652 |
+ einfo "Using default MY_DATADIR" |
1653 |
+ fi |
1654 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
1655 |
+ |
1656 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
1657 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
1658 |
+ # If you get this and you're wondering about it, see bug #207636 |
1659 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
1660 |
+ elog "A new one will not be created." |
1661 |
+ PREVIOUS_DATADIR="yes" |
1662 |
+ else |
1663 |
+ PREVIOUS_DATADIR="no" |
1664 |
+ fi |
1665 |
+ export PREVIOUS_DATADIR |
1666 |
+ fi |
1667 |
+ else |
1668 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
1669 |
+ local new_MY_DATADIR |
1670 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
1671 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
1672 |
+ | tail -n1` |
1673 |
+ |
1674 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
1675 |
+ ewarn "MySQL MY_DATADIR has changed" |
1676 |
+ ewarn "from ${MY_DATADIR}" |
1677 |
+ ewarn "to ${new_MY_DATADIR}" |
1678 |
+ MY_DATADIR="${new_MY_DATADIR}" |
1679 |
+ fi |
1680 |
+ fi |
1681 |
+ fi |
1682 |
+ |
1683 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
1684 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
1685 |
+ export MY_DATADIR |
1686 |
+} |
1687 |
+ |
1688 |
+pkg_config() { |
1689 |
+ _getoptval() { |
1690 |
+ local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults |
1691 |
+ local section="$1" |
1692 |
+ local flag="--${2}=" |
1693 |
+ local extra_options="${3}" |
1694 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
1695 |
+ } |
1696 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
1697 |
+ local old_HOME="${HOME}" |
1698 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
1699 |
+ export HOME=${EPREFIX}/root |
1700 |
+ |
1701 |
+ # Make sure the vars are correctly initialized |
1702 |
+ mysql_init_vars |
1703 |
+ |
1704 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
1705 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
1706 |
+ die "Minimal builds do NOT include the MySQL server" |
1707 |
+ fi |
1708 |
+ |
1709 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
1710 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
1711 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
1712 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
1713 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
1714 |
+ |
1715 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
1716 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
1717 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
1718 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
1719 |
+ else |
1720 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
1721 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
1722 |
+ || die "Moving MY_DATADIR failed" |
1723 |
+ fi |
1724 |
+ else |
1725 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
1726 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
1727 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
1728 |
+ else |
1729 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
1730 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
1731 |
+ fi |
1732 |
+ fi |
1733 |
+ fi |
1734 |
+ |
1735 |
+ local pwd1="a" |
1736 |
+ local pwd2="b" |
1737 |
+ local maxtry=15 |
1738 |
+ |
1739 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
1740 |
+ local tmp_mysqld_password_source= |
1741 |
+ |
1742 |
+ for tmp_mysqld_password_source in mysql client; do |
1743 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
1744 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
1745 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
1746 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
1747 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
1748 |
+ MYSQL_ROOT_PASSWORD= |
1749 |
+ continue |
1750 |
+ fi |
1751 |
+ |
1752 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
1753 |
+ break |
1754 |
+ fi |
1755 |
+ done |
1756 |
+ |
1757 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
1758 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
1759 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
1760 |
+ fi |
1761 |
+ |
1762 |
+ unset tmp_mysqld_password_source |
1763 |
+ fi |
1764 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
1765 |
+ # These are dir+prefix |
1766 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
1767 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
1768 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
1769 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
1770 |
+ |
1771 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
1772 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
1773 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
1774 |
+ fi |
1775 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
1776 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
1777 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
1778 |
+ fi |
1779 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
1780 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
1781 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
1782 |
+ fi |
1783 |
+ |
1784 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
1785 |
+ ewarn "You have already a MySQL database in place." |
1786 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
1787 |
+ ewarn "Please rename or delete it if you wish to replace it." |
1788 |
+ die "MySQL database already exists!" |
1789 |
+ fi |
1790 |
+ |
1791 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
1792 |
+ # localhost. Also causes weird failures. |
1793 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
1794 |
+ |
1795 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
1796 |
+ |
1797 |
+ einfo "Please provide a password for the mysql 'root' user now" |
1798 |
+ einfo "or through the ${HOME}/.my.cnf file." |
1799 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
1800 |
+ read -rsp " >" pwd1 ; echo |
1801 |
+ |
1802 |
+ einfo "Retype the password" |
1803 |
+ read -rsp " >" pwd2 ; echo |
1804 |
+ |
1805 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
1806 |
+ die "Passwords are not the same" |
1807 |
+ fi |
1808 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
1809 |
+ unset pwd1 pwd2 |
1810 |
+ fi |
1811 |
+ |
1812 |
+ local options |
1813 |
+ local sqltmp="$(emktemp)" |
1814 |
+ |
1815 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
1816 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
1817 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
1818 |
+ |
1819 |
+ # Figure out which options we need to disable to do the setup |
1820 |
+ local helpfile="${TMPDIR}/mysqld-help" |
1821 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
1822 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
1823 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
1824 |
+ log-slave-updates \ |
1825 |
+ ; do |
1826 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
1827 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
1828 |
+ done |
1829 |
+ |
1830 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
1831 |
+ |
1832 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
1833 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
1834 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
1835 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
1836 |
+ fi |
1837 |
+ |
1838 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
1839 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
1840 |
+ fi |
1841 |
+ |
1842 |
+ pushd "${TMPDIR}" &>/dev/null || die |
1843 |
+ |
1844 |
+ # Filling timezones, see |
1845 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
1846 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
1847 |
+ |
1848 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
1849 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
1850 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
1851 |
+ einfo "Command: ${cmd[*]}" |
1852 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
1853 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
1854 |
+ if [ $? -ne 0 ]; then |
1855 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
1856 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
1857 |
+ fi |
1858 |
+ popd &>/dev/null || die |
1859 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
1860 |
+ || die "MySQL databases not installed" |
1861 |
+ |
1862 |
+ use prefix || options="${options} --user=mysql" |
1863 |
+ |
1864 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
1865 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
1866 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
1867 |
+ ${options} \ |
1868 |
+ --log-warnings=0 \ |
1869 |
+ --basedir=${EROOT}/usr \ |
1870 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
1871 |
+ --max_allowed_packet=8M \ |
1872 |
+ --net_buffer_length=16K \ |
1873 |
+ --socket=${socket} \ |
1874 |
+ --pid-file=${pidfile} \ |
1875 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
1876 |
+ #einfo "About to start mysqld: ${mysqld}" |
1877 |
+ ebegin "Starting mysqld" |
1878 |
+ einfo "Command ${mysqld}" |
1879 |
+ ${mysqld} & |
1880 |
+ rc=$? |
1881 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
1882 |
+ maxtry=$((${maxtry}-1)) |
1883 |
+ echo -n "." |
1884 |
+ sleep 1 |
1885 |
+ done |
1886 |
+ eend $rc |
1887 |
+ |
1888 |
+ if ! [[ -S "${socket}" ]]; then |
1889 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
1890 |
+ fi |
1891 |
+ |
1892 |
+ ebegin "Setting root password" |
1893 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
1894 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
1895 |
+ "${EROOT}/usr/bin/mysql" \ |
1896 |
+ "--socket=${socket}" \ |
1897 |
+ -hlocalhost \ |
1898 |
+ -e "${sql}" |
1899 |
+ eend $? |
1900 |
+ |
1901 |
+ if [[ -n "${sqltmp}" ]] ; then |
1902 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
1903 |
+ "${EROOT}/usr/bin/mysql" \ |
1904 |
+ "--socket=${socket}" \ |
1905 |
+ -hlocalhost \ |
1906 |
+ -uroot \ |
1907 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
1908 |
+ mysql < "${sqltmp}" |
1909 |
+ rc=$? |
1910 |
+ eend $? |
1911 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
1912 |
+ fi |
1913 |
+ |
1914 |
+ # Stop the server and cleanup |
1915 |
+ einfo "Stopping the server ..." |
1916 |
+ kill $(< "${pidfile}" ) |
1917 |
+ rm -f "${sqltmp}" |
1918 |
+ wait %1 |
1919 |
+ einfo "Done" |
1920 |
+} |
1921 |
|
1922 |
diff --git a/dev-db/mariadb/mariadb-10.3.17.ebuild b/dev-db/mariadb/mariadb-10.3.17.ebuild |
1923 |
new file mode 100644 |
1924 |
index 00000000000..e502845dbd5 |
1925 |
--- /dev/null |
1926 |
+++ b/dev-db/mariadb/mariadb-10.3.17.ebuild |
1927 |
@@ -0,0 +1,975 @@ |
1928 |
+# Copyright 1999-2019 Gentoo Authors |
1929 |
+# Distributed under the terms of the GNU General Public License v2 |
1930 |
+ |
1931 |
+EAPI="6" |
1932 |
+MY_EXTRAS_VER="20190305-2052Z" |
1933 |
+SUBSLOT="18" |
1934 |
+ |
1935 |
+JAVA_PKG_OPT_USE="jdbc" |
1936 |
+ |
1937 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
1938 |
+ |
1939 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
1940 |
+ java-pkg-opt-2 user cmake-utils |
1941 |
+ |
1942 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
1943 |
+ |
1944 |
+# Gentoo patches to MySQL |
1945 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
1946 |
+ SRC_URI="${SRC_URI} |
1947 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
1948 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
1949 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
1950 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
1951 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
1952 |
+fi |
1953 |
+ |
1954 |
+HOMEPAGE="https://mariadb.org/" |
1955 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
1956 |
+LICENSE="GPL-2 LGPL-2.1+" |
1957 |
+SLOT="0/${SUBSLOT:-0}" |
1958 |
+IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 |
1959 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
1960 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
1961 |
+ sst-rsync sst-mariabackup static systemd systemtap tcmalloc |
1962 |
+ test tokudb xml yassl" |
1963 |
+ |
1964 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
1965 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
1966 |
+ |
1967 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
1968 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
1969 |
+ ?? ( tcmalloc jemalloc ) |
1970 |
+ static? ( yassl !pam )" |
1971 |
+ |
1972 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
1973 |
+ |
1974 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
1975 |
+# and we will run a mysql server during test phase |
1976 |
+S="${WORKDIR}/mysql" |
1977 |
+ |
1978 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
1979 |
+ inherit git-r3 |
1980 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
1981 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
1982 |
+ EGIT_CLONE_TYPE=shallow |
1983 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
1984 |
+else |
1985 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
1986 |
+fi |
1987 |
+ |
1988 |
+PATCHES=( |
1989 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
1990 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.3.12-without-clientlibs-tools.patch |
1991 |
+ "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch |
1992 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch |
1993 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch |
1994 |
+) |
1995 |
+ |
1996 |
+# Be warned, *DEPEND are version-dependant |
1997 |
+# These are used for both runtime and compiletime |
1998 |
+COMMON_DEPEND=" |
1999 |
+ kernel_linux? ( |
2000 |
+ sys-process/procps:0= |
2001 |
+ dev-libs/libaio:0= |
2002 |
+ ) |
2003 |
+ >=sys-apps/sed-4 |
2004 |
+ >=sys-apps/texinfo-4.7-r1 |
2005 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
2006 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
2007 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
2008 |
+ >=sys-libs/zlib-1.2.3:0= |
2009 |
+ kerberos? ( virtual/krb5 ) |
2010 |
+ yassl? ( net-libs/gnutls:0= ) |
2011 |
+ !yassl? ( |
2012 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
2013 |
+ libressl? ( dev-libs/libressl:0= ) |
2014 |
+ ) |
2015 |
+ sys-libs/ncurses:0= |
2016 |
+ !bindist? ( |
2017 |
+ sys-libs/binutils-libs:0= |
2018 |
+ >=sys-libs/readline-4.1:0= |
2019 |
+ ) |
2020 |
+ server? ( |
2021 |
+ backup? ( app-arch/libarchive:0= ) |
2022 |
+ cracklib? ( sys-libs/cracklib:0= ) |
2023 |
+ extraengine? ( |
2024 |
+ odbc? ( dev-db/unixODBC:0= ) |
2025 |
+ xml? ( dev-libs/libxml2:2= ) |
2026 |
+ ) |
2027 |
+ innodb-lz4? ( app-arch/lz4 ) |
2028 |
+ innodb-lzo? ( dev-libs/lzo ) |
2029 |
+ innodb-snappy? ( app-arch/snappy ) |
2030 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
2031 |
+ numa? ( sys-process/numactl ) |
2032 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
2033 |
+ pam? ( virtual/pam:0= ) |
2034 |
+ systemd? ( sys-apps/systemd:= ) |
2035 |
+ tokudb? ( app-arch/snappy ) |
2036 |
+ ) |
2037 |
+ >=dev-libs/libpcre-8.41-r1:3= |
2038 |
+" |
2039 |
+DEPEND="virtual/yacc |
2040 |
+ static? ( sys-libs/ncurses[static-libs] ) |
2041 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
2042 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
2043 |
+ ${COMMON_DEPEND}" |
2044 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
2045 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
2046 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
2047 |
+ !<virtual/mysql-5.6-r11 |
2048 |
+ ${COMMON_DEPEND} |
2049 |
+ server? ( galera? ( |
2050 |
+ sys-apps/iproute2 |
2051 |
+ =sys-cluster/galera-25* |
2052 |
+ sst-rsync? ( sys-process/lsof ) |
2053 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
2054 |
+ ) ) |
2055 |
+ perl? ( !dev-db/mytop |
2056 |
+ virtual/perl-Getopt-Long |
2057 |
+ dev-perl/TermReadKey |
2058 |
+ virtual/perl-Term-ANSIColor |
2059 |
+ virtual/perl-Time-HiRes ) |
2060 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
2061 |
+" |
2062 |
+# For other stuff to bring us in |
2063 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
2064 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
2065 |
+ server? ( ~virtual/mysql-5.6[static=] )" |
2066 |
+ |
2067 |
+pkg_setup() { |
2068 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
2069 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
2070 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
2071 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
2072 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
2073 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
2074 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
2075 |
+ die |
2076 |
+ fi |
2077 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
2078 |
+ # non x86{,_64} arches |
2079 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
2080 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
2081 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
2082 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
2083 |
+ die |
2084 |
+ fi |
2085 |
+ fi |
2086 |
+ java-pkg-opt-2_pkg_setup |
2087 |
+ if has test ${FEATURES} && \ |
2088 |
+ use server && ! has userpriv ${FEATURES} ; then |
2089 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
2090 |
+ fi |
2091 |
+ |
2092 |
+ # This should come after all of the die statements |
2093 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
2094 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
2095 |
+} |
2096 |
+ |
2097 |
+pkg_preinst() { |
2098 |
+ java-pkg-opt-2_pkg_preinst |
2099 |
+ |
2100 |
+ # Here we need to see if the implementation switched client libraries |
2101 |
+ # We check if this is a new instance of the package and a client library already exists |
2102 |
+ local SHOW_ABI_MESSAGE libpath |
2103 |
+ if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
2104 |
+ libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
2105 |
+ elog "Due to ABI changes when switching between different client libraries," |
2106 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
2107 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
2108 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
2109 |
+ fi |
2110 |
+} |
2111 |
+ |
2112 |
+pkg_postinst() { |
2113 |
+ # Make sure the vars are correctly initialized |
2114 |
+ mysql_init_vars |
2115 |
+ |
2116 |
+ # Create log directory securely if it does not exist |
2117 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
2118 |
+ |
2119 |
+ if use server ; then |
2120 |
+ if use pam; then |
2121 |
+ einfo |
2122 |
+ elog "This install includes the PAM authentication plugin." |
2123 |
+ elog "To activate and configure the PAM plugin, please read:" |
2124 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
2125 |
+ einfo |
2126 |
+ fi |
2127 |
+ |
2128 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
2129 |
+ einfo |
2130 |
+ elog "You might want to run:" |
2131 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
2132 |
+ elog "if this is a new install." |
2133 |
+ elog |
2134 |
+ elog "If you are switching server implentations, you should run the" |
2135 |
+ elog "mysql_upgrade tool." |
2136 |
+ einfo |
2137 |
+ else |
2138 |
+ einfo |
2139 |
+ elog "If you are upgrading major versions, you should run the" |
2140 |
+ elog "mysql_upgrade tool." |
2141 |
+ einfo |
2142 |
+ fi |
2143 |
+ |
2144 |
+ if use galera ; then |
2145 |
+ einfo |
2146 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
2147 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
2148 |
+ elog "The first time the cluster is activated, you should add" |
2149 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
2150 |
+ elog "This option should then be removed for subsequent starts." |
2151 |
+ einfo |
2152 |
+ fi |
2153 |
+ fi |
2154 |
+ |
2155 |
+ # Note about configuration change |
2156 |
+ einfo |
2157 |
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf" |
2158 |
+ elog "to several files in /etc/mysql/${PN}.d." |
2159 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
2160 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
2161 |
+ elog "You may have as many files as needed and they are read alphabetically." |
2162 |
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
2163 |
+ einfo |
2164 |
+} |
2165 |
+ |
2166 |
+src_unpack() { |
2167 |
+ unpack ${A} |
2168 |
+ # Grab the patches |
2169 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
2170 |
+ |
2171 |
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die |
2172 |
+} |
2173 |
+ |
2174 |
+src_prepare() { |
2175 |
+ _disable_plugin() { |
2176 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
2177 |
+ } |
2178 |
+ _disable_engine() { |
2179 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
2180 |
+ } |
2181 |
+ |
2182 |
+ if use jemalloc; then |
2183 |
+ echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" |
2184 |
+ elif use tcmalloc; then |
2185 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" |
2186 |
+ fi |
2187 |
+ |
2188 |
+ # Don't build bundled xz-utils for tokudb |
2189 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
2190 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
2191 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
2192 |
+ |
2193 |
+ local plugin |
2194 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
2195 |
+ locale_info qc_info server_audit sql_errlog auth_ed25519 ) |
2196 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext |
2197 |
+ debug_key_management example_key_management versioning ) |
2198 |
+ if ! use server; then # These plugins are for the server |
2199 |
+ for plugin in "${server_plugins[@]}" ; do |
2200 |
+ _disable_plugin "${plugin}" |
2201 |
+ done |
2202 |
+ fi |
2203 |
+ |
2204 |
+ if ! use test; then # These plugins are only used during testing |
2205 |
+ for plugin in "${test_plugins[@]}" ; do |
2206 |
+ _disable_plugin "${plugin}" |
2207 |
+ done |
2208 |
+ _disable_engine test_sql_discovery |
2209 |
+ fi |
2210 |
+ |
2211 |
+ _disable_engine example |
2212 |
+ |
2213 |
+ if ! use oqgraph ; then # avoids extra library checks |
2214 |
+ _disable_engine oqgraph |
2215 |
+ fi |
2216 |
+ |
2217 |
+ if use mroonga ; then |
2218 |
+ # Remove the bundled groonga |
2219 |
+ # There is no CMake flag, it simply checks for existance |
2220 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
2221 |
+ else |
2222 |
+ _disable_engine mroonga |
2223 |
+ fi |
2224 |
+ |
2225 |
+ cmake-utils_src_prepare |
2226 |
+ java-pkg-opt-2_src_prepare |
2227 |
+} |
2228 |
+ |
2229 |
+src_configure(){ |
2230 |
+ # bug 508724 mariadb cannot use ld.gold |
2231 |
+ tc-ld-disable-gold |
2232 |
+ # Bug #114895, bug #110149 |
2233 |
+ filter-flags "-O" "-O[01]" |
2234 |
+ |
2235 |
+ append-cxxflags -felide-constructors |
2236 |
+ |
2237 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
2238 |
+ append-flags -fno-strict-aliasing |
2239 |
+ |
2240 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
2241 |
+ |
2242 |
+ # debug hack wrt #497532 |
2243 |
+ mycmakeargs=( |
2244 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
2245 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
2246 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
2247 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
2248 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
2249 |
+ -DINSTALL_BINDIR=bin |
2250 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
2251 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
2252 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
2253 |
+ -DINSTALL_INFODIR=share/info |
2254 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
2255 |
+ -DINSTALL_MANDIR=share/man |
2256 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
2257 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
2258 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
2259 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
2260 |
+ -DINSTALL_SBINDIR=sbin |
2261 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
2262 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
2263 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
2264 |
+ -DWITH_LIBEDIT=0 |
2265 |
+ -DWITH_ZLIB=system |
2266 |
+ -DWITHOUT_LIBWRAP=1 |
2267 |
+ -DENABLED_LOCAL_INFILE=1 |
2268 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
2269 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
2270 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
2271 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
2272 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
2273 |
+ # The build forces this to be defined when cross-compiling. We pass it |
2274 |
+ # all the time for simplicity and to make sure it is actually correct. |
2275 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
2276 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
2277 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
2278 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
2279 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
2280 |
+ -DWITH_EXTERNAL_ZLIB=YES |
2281 |
+ -DSUFFIX_INSTALL_DIR="" |
2282 |
+ -DWITH_UNITTEST=OFF |
2283 |
+ -DWITHOUT_CLIENTLIBS=YES |
2284 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
2285 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF |
2286 |
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF |
2287 |
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC |
2288 |
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF |
2289 |
+ ) |
2290 |
+ if use test ; then |
2291 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
2292 |
+ else |
2293 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
2294 |
+ fi |
2295 |
+ |
2296 |
+ if ! use yassl ; then |
2297 |
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) |
2298 |
+ else |
2299 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
2300 |
+ fi |
2301 |
+ |
2302 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
2303 |
+ mycmakeargs+=( |
2304 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
2305 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
2306 |
+ -DENABLE_DTRACE=$(usex systemtap) |
2307 |
+ ) |
2308 |
+ |
2309 |
+ if use server ; then |
2310 |
+ |
2311 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
2312 |
+ if ! use extraengine ; then |
2313 |
+ mycmakeargs+=( |
2314 |
+ -DPLUGIN_FEDERATED=NO |
2315 |
+ -DPLUGIN_FEDERATEDX=NO ) |
2316 |
+ fi |
2317 |
+ |
2318 |
+ mycmakeargs+=( |
2319 |
+ -DWITH_PCRE=system |
2320 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
2321 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
2322 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
2323 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
2324 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
2325 |
+ -DPLUGIN_CASSANDRA=NO |
2326 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
2327 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
2328 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
2329 |
+ -DCONNECT_WITH_MYSQL=1 |
2330 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
2331 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
2332 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
2333 |
+ # Build failure and autodep wrt bug 639144 |
2334 |
+ -DCONNECT_WITH_MONGO=OFF |
2335 |
+ -DWITH_WSREP=$(usex galera) |
2336 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
2337 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
2338 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
2339 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
2340 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
2341 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
2342 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
2343 |
+ -DINSTALL_SQLBENCHDIR="" |
2344 |
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) |
2345 |
+ # systemd is only linked to for server notification |
2346 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
2347 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
2348 |
+ ) |
2349 |
+ |
2350 |
+ # Workaround for MDEV-14524 |
2351 |
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) |
2352 |
+ |
2353 |
+ if use test ; then |
2354 |
+ # This is needed for the new client lib which tests a real, open server |
2355 |
+ mycmakeargs+=( -DSKIP_TESTS=ON ) |
2356 |
+ fi |
2357 |
+ |
2358 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
2359 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
2360 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
2361 |
+ ewarn "You MUST file bugs without these variables set." |
2362 |
+ |
2363 |
+ mycmakeargs+=( |
2364 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
2365 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
2366 |
+ ) |
2367 |
+ |
2368 |
+ elif ! use latin1 ; then |
2369 |
+ mycmakeargs+=( |
2370 |
+ -DDEFAULT_CHARSET=utf8 |
2371 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
2372 |
+ ) |
2373 |
+ else |
2374 |
+ mycmakeargs+=( |
2375 |
+ -DDEFAULT_CHARSET=latin1 |
2376 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
2377 |
+ ) |
2378 |
+ fi |
2379 |
+ mycmakeargs+=( |
2380 |
+ -DEXTRA_CHARSETS=all |
2381 |
+ -DMYSQL_USER=mysql |
2382 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
2383 |
+ -DWITH_DEBUG=$(usex debug) |
2384 |
+ -DWITH_EMBEDDED_SERVER=OFF |
2385 |
+ -DWITH_PROFILING=$(usex profiling) |
2386 |
+ ) |
2387 |
+ |
2388 |
+ if use static; then |
2389 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
2390 |
+ fi |
2391 |
+ |
2392 |
+ if use jemalloc || use tcmalloc ; then |
2393 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
2394 |
+ fi |
2395 |
+ |
2396 |
+ # Storage engines |
2397 |
+ mycmakeargs+=( |
2398 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
2399 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
2400 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
2401 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
2402 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
2403 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
2404 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
2405 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
2406 |
+ ) |
2407 |
+ |
2408 |
+ else |
2409 |
+ mycmakeargs+=( |
2410 |
+ -DWITHOUT_SERVER=1 |
2411 |
+ -DWITH_EMBEDDED_SERVER=OFF |
2412 |
+ -DEXTRA_CHARSETS=none |
2413 |
+ -DINSTALL_SQLBENCHDIR= |
2414 |
+ -DWITH_SYSTEMD=no |
2415 |
+ ) |
2416 |
+ fi |
2417 |
+ |
2418 |
+ cmake-utils_src_configure |
2419 |
+} |
2420 |
+ |
2421 |
+src_compile() { |
2422 |
+ cmake-utils_src_compile |
2423 |
+} |
2424 |
+ |
2425 |
+src_install() { |
2426 |
+ cmake-utils_src_install |
2427 |
+ |
2428 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
2429 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
2430 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
2431 |
+ fi |
2432 |
+ |
2433 |
+ # Make sure the vars are correctly initialized |
2434 |
+ mysql_init_vars |
2435 |
+ |
2436 |
+ # Convenience links |
2437 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
2438 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
2439 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
2440 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
2441 |
+ |
2442 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
2443 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
2444 |
+ rm -Rf "${ED}/usr/data" || die |
2445 |
+ fi |
2446 |
+ |
2447 |
+ # Unless they explicitly specific USE=test, then do not install the |
2448 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
2449 |
+ # validation of your database configuration after tuning it. |
2450 |
+ if ! use test ; then |
2451 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
2452 |
+ fi |
2453 |
+ |
2454 |
+ # Configuration stuff |
2455 |
+ einfo "Building default configuration ..." |
2456 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
2457 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
2458 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
2459 |
+ eprefixify "${TMPDIR}/my.cnf" |
2460 |
+ doins "${TMPDIR}/my.cnf" |
2461 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
2462 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
2463 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
2464 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
2465 |
+ |
2466 |
+ if use server ; then |
2467 |
+ mycnf_src="my.cnf.distro-server" |
2468 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
2469 |
+ "${FILESDIR}/${mycnf_src}" \ |
2470 |
+ > "${TMPDIR}/my.cnf.ok" || die |
2471 |
+ if use prefix ; then |
2472 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
2473 |
+ "${TMPDIR}/my.cnf.ok" || die |
2474 |
+ fi |
2475 |
+ if use latin1 ; then |
2476 |
+ sed -i \ |
2477 |
+ -e "/character-set/s|utf8|latin1|g" \ |
2478 |
+ "${TMPDIR}/my.cnf.ok" || die |
2479 |
+ fi |
2480 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
2481 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
2482 |
+ |
2483 |
+ einfo "Including support files and sample configurations" |
2484 |
+ docinto "support-files" |
2485 |
+ local script |
2486 |
+ for script in \ |
2487 |
+ "${S}"/support-files/magic |
2488 |
+ do |
2489 |
+ [[ -f "$script" ]] && dodoc "${script}" |
2490 |
+ done |
2491 |
+ |
2492 |
+ docinto "scripts" |
2493 |
+ for script in "${S}"/scripts/mysql* ; do |
2494 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
2495 |
+ done |
2496 |
+ # Manually install supporting files that conflict with other packages |
2497 |
+ # but are needed for galera and initial installation |
2498 |
+ exeinto /usr/libexec/mariadb |
2499 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
2500 |
+ fi |
2501 |
+ |
2502 |
+ # Remove mytop if perl is not selected |
2503 |
+ if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then |
2504 |
+ rm -f "${ED}/usr/bin/mytop" || die |
2505 |
+ fi |
2506 |
+ |
2507 |
+ # Fix a dangling symlink when galera is not built |
2508 |
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then |
2509 |
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die |
2510 |
+ fi |
2511 |
+ |
2512 |
+ # Remove broken SST scripts that are incompatible |
2513 |
+ local scriptremove |
2514 |
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do |
2515 |
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then |
2516 |
+ rm "${ED}/usr/bin/${scriptremove}" || die |
2517 |
+ fi |
2518 |
+ done |
2519 |
+} |
2520 |
+ |
2521 |
+# Official test instructions: |
2522 |
+# USE='extraengine perl server' \ |
2523 |
+# FEATURES='test userpriv -usersandbox' \ |
2524 |
+# ebuild mariadb-X.X.XX.ebuild \ |
2525 |
+# digest clean package |
2526 |
+src_test() { |
2527 |
+ |
2528 |
+ _disable_test() { |
2529 |
+ local rawtestname reason |
2530 |
+ rawtestname="${1}" ; shift |
2531 |
+ reason="${@}" |
2532 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
2533 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
2534 |
+ } |
2535 |
+ |
2536 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
2537 |
+ local retstatus_unit |
2538 |
+ local retstatus_tests |
2539 |
+ |
2540 |
+ if ! use server ; then |
2541 |
+ einfo "Skipping server tests due to minimal build." |
2542 |
+ return 0 |
2543 |
+ fi |
2544 |
+ |
2545 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
2546 |
+ # localhost. Also causes weird failures. |
2547 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
2548 |
+ |
2549 |
+ if [[ $UID -eq 0 ]]; then |
2550 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
2551 |
+ fi |
2552 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
2553 |
+ |
2554 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
2555 |
+ |
2556 |
+ # Run CTest (test-units) |
2557 |
+ cmake-utils_src_test |
2558 |
+ retstatus_unit=$? |
2559 |
+ |
2560 |
+ # Ensure that parallel runs don't die |
2561 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
2562 |
+ # Enable parallel testing, auto will try to detect number of cores |
2563 |
+ # You may set this by hand. |
2564 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
2565 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
2566 |
+ |
2567 |
+ # create directories because mysqladmin might run out of order |
2568 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
2569 |
+ |
2570 |
+ # Run mysql tests |
2571 |
+ pushd "${TESTDIR}" > /dev/null || die |
2572 |
+ |
2573 |
+ touch "${T}/disabled.def" |
2574 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
2575 |
+ # false positives: |
2576 |
+ # |
2577 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
2578 |
+ # main.mysql_client_test_comp: |
2579 |
+ # segfaults at random under Portage only, suspect resource limits. |
2580 |
+ |
2581 |
+ local t |
2582 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
2583 |
+ _disable_test "$t" "False positive due to varying policies" |
2584 |
+ done |
2585 |
+ |
2586 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
2587 |
+ main.mysql main.gis_notembedded \ |
2588 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
2589 |
+ _disable_test "$t" "False positives in Gentoo" |
2590 |
+ done |
2591 |
+ |
2592 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
2593 |
+ |
2594 |
+ _disable_test main.func_time "Dependent on time test was written" |
2595 |
+ |
2596 |
+ # run mysql-test tests |
2597 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
2598 |
+ retstatus_tests=$? |
2599 |
+ |
2600 |
+ popd > /dev/null || die |
2601 |
+ |
2602 |
+ # Cleanup is important for these testcases. |
2603 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
2604 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
2605 |
+ |
2606 |
+ local failures="" |
2607 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
2608 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
2609 |
+ |
2610 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
2611 |
+ einfo "Tests successfully completed" |
2612 |
+} |
2613 |
+ |
2614 |
+mysql_init_vars() { |
2615 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
2616 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
2617 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
2618 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
2619 |
+ |
2620 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
2621 |
+ MY_DATADIR="" |
2622 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
2623 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
2624 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
2625 |
+ | tail -n1` |
2626 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
2627 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
2628 |
+ | sed -e 's/.*=\s*//' \ |
2629 |
+ | tail -n1` |
2630 |
+ fi |
2631 |
+ fi |
2632 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
2633 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
2634 |
+ einfo "Using default MY_DATADIR" |
2635 |
+ fi |
2636 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
2637 |
+ |
2638 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
2639 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
2640 |
+ # If you get this and you're wondering about it, see bug #207636 |
2641 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
2642 |
+ elog "A new one will not be created." |
2643 |
+ PREVIOUS_DATADIR="yes" |
2644 |
+ else |
2645 |
+ PREVIOUS_DATADIR="no" |
2646 |
+ fi |
2647 |
+ export PREVIOUS_DATADIR |
2648 |
+ fi |
2649 |
+ else |
2650 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
2651 |
+ local new_MY_DATADIR |
2652 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
2653 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
2654 |
+ | tail -n1` |
2655 |
+ |
2656 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
2657 |
+ ewarn "MySQL MY_DATADIR has changed" |
2658 |
+ ewarn "from ${MY_DATADIR}" |
2659 |
+ ewarn "to ${new_MY_DATADIR}" |
2660 |
+ MY_DATADIR="${new_MY_DATADIR}" |
2661 |
+ fi |
2662 |
+ fi |
2663 |
+ fi |
2664 |
+ |
2665 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
2666 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
2667 |
+ export MY_DATADIR |
2668 |
+} |
2669 |
+ |
2670 |
+pkg_config() { |
2671 |
+ _getoptval() { |
2672 |
+ local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults |
2673 |
+ local section="$1" |
2674 |
+ local flag="--${2}=" |
2675 |
+ local extra_options="${3}" |
2676 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
2677 |
+ } |
2678 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
2679 |
+ local old_HOME="${HOME}" |
2680 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
2681 |
+ export HOME=${EPREFIX}/root |
2682 |
+ |
2683 |
+ # Make sure the vars are correctly initialized |
2684 |
+ mysql_init_vars |
2685 |
+ |
2686 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
2687 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
2688 |
+ die "Minimal builds do NOT include the MySQL server" |
2689 |
+ fi |
2690 |
+ |
2691 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
2692 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
2693 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
2694 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
2695 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
2696 |
+ |
2697 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
2698 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
2699 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
2700 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
2701 |
+ else |
2702 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
2703 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
2704 |
+ || die "Moving MY_DATADIR failed" |
2705 |
+ fi |
2706 |
+ else |
2707 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
2708 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
2709 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
2710 |
+ else |
2711 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
2712 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
2713 |
+ fi |
2714 |
+ fi |
2715 |
+ fi |
2716 |
+ |
2717 |
+ local pwd1="a" |
2718 |
+ local pwd2="b" |
2719 |
+ local maxtry=15 |
2720 |
+ |
2721 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
2722 |
+ local tmp_mysqld_password_source= |
2723 |
+ |
2724 |
+ for tmp_mysqld_password_source in mysql client; do |
2725 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
2726 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
2727 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
2728 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
2729 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
2730 |
+ MYSQL_ROOT_PASSWORD= |
2731 |
+ continue |
2732 |
+ fi |
2733 |
+ |
2734 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
2735 |
+ break |
2736 |
+ fi |
2737 |
+ done |
2738 |
+ |
2739 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
2740 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
2741 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
2742 |
+ fi |
2743 |
+ |
2744 |
+ unset tmp_mysqld_password_source |
2745 |
+ fi |
2746 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
2747 |
+ # These are dir+prefix |
2748 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
2749 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
2750 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
2751 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
2752 |
+ |
2753 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
2754 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
2755 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
2756 |
+ fi |
2757 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
2758 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
2759 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
2760 |
+ fi |
2761 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
2762 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
2763 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
2764 |
+ fi |
2765 |
+ |
2766 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
2767 |
+ ewarn "You have already a MySQL database in place." |
2768 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
2769 |
+ ewarn "Please rename or delete it if you wish to replace it." |
2770 |
+ die "MySQL database already exists!" |
2771 |
+ fi |
2772 |
+ |
2773 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
2774 |
+ # localhost. Also causes weird failures. |
2775 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
2776 |
+ |
2777 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
2778 |
+ |
2779 |
+ einfo "Please provide a password for the mysql 'root' user now" |
2780 |
+ einfo "or through the ${HOME}/.my.cnf file." |
2781 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
2782 |
+ read -rsp " >" pwd1 ; echo |
2783 |
+ |
2784 |
+ einfo "Retype the password" |
2785 |
+ read -rsp " >" pwd2 ; echo |
2786 |
+ |
2787 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
2788 |
+ die "Passwords are not the same" |
2789 |
+ fi |
2790 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
2791 |
+ unset pwd1 pwd2 |
2792 |
+ fi |
2793 |
+ |
2794 |
+ local options |
2795 |
+ local sqltmp="$(emktemp)" |
2796 |
+ |
2797 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
2798 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
2799 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
2800 |
+ |
2801 |
+ # Figure out which options we need to disable to do the setup |
2802 |
+ local helpfile="${TMPDIR}/mysqld-help" |
2803 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
2804 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
2805 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
2806 |
+ log-slave-updates \ |
2807 |
+ ; do |
2808 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
2809 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
2810 |
+ done |
2811 |
+ |
2812 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
2813 |
+ |
2814 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
2815 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
2816 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
2817 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
2818 |
+ fi |
2819 |
+ |
2820 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
2821 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
2822 |
+ fi |
2823 |
+ |
2824 |
+ pushd "${TMPDIR}" &>/dev/null || die |
2825 |
+ |
2826 |
+ # Filling timezones, see |
2827 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
2828 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
2829 |
+ |
2830 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
2831 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
2832 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
2833 |
+ einfo "Command: ${cmd[*]}" |
2834 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
2835 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
2836 |
+ if [ $? -ne 0 ]; then |
2837 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
2838 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
2839 |
+ fi |
2840 |
+ popd &>/dev/null || die |
2841 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
2842 |
+ || die "MySQL databases not installed" |
2843 |
+ |
2844 |
+ use prefix || options="${options} --user=mysql" |
2845 |
+ |
2846 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
2847 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
2848 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
2849 |
+ ${options} \ |
2850 |
+ --log-warnings=0 \ |
2851 |
+ --basedir=${EROOT}/usr \ |
2852 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
2853 |
+ --max_allowed_packet=8M \ |
2854 |
+ --net_buffer_length=16K \ |
2855 |
+ --socket=${socket} \ |
2856 |
+ --pid-file=${pidfile} \ |
2857 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
2858 |
+ #einfo "About to start mysqld: ${mysqld}" |
2859 |
+ ebegin "Starting mysqld" |
2860 |
+ einfo "Command ${mysqld}" |
2861 |
+ ${mysqld} & |
2862 |
+ rc=$? |
2863 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
2864 |
+ maxtry=$((${maxtry}-1)) |
2865 |
+ echo -n "." |
2866 |
+ sleep 1 |
2867 |
+ done |
2868 |
+ eend $rc |
2869 |
+ |
2870 |
+ if ! [[ -S "${socket}" ]]; then |
2871 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
2872 |
+ fi |
2873 |
+ |
2874 |
+ ebegin "Setting root password" |
2875 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
2876 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
2877 |
+ "${EROOT}/usr/bin/mysql" \ |
2878 |
+ "--socket=${socket}" \ |
2879 |
+ -hlocalhost \ |
2880 |
+ -e "${sql}" |
2881 |
+ eend $? |
2882 |
+ |
2883 |
+ if [[ -n "${sqltmp}" ]] ; then |
2884 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
2885 |
+ "${EROOT}/usr/bin/mysql" \ |
2886 |
+ "--socket=${socket}" \ |
2887 |
+ -hlocalhost \ |
2888 |
+ -uroot \ |
2889 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
2890 |
+ mysql < "${sqltmp}" |
2891 |
+ rc=$? |
2892 |
+ eend $? |
2893 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
2894 |
+ fi |
2895 |
+ |
2896 |
+ # Stop the server and cleanup |
2897 |
+ einfo "Stopping the server ..." |
2898 |
+ kill $(< "${pidfile}" ) |
2899 |
+ rm -f "${sqltmp}" |
2900 |
+ wait %1 |
2901 |
+ einfo "Done" |
2902 |
+} |
2903 |
|
2904 |
diff --git a/dev-db/mariadb/mariadb-10.4.7.ebuild b/dev-db/mariadb/mariadb-10.4.7.ebuild |
2905 |
new file mode 100644 |
2906 |
index 00000000000..97ab3c2da74 |
2907 |
--- /dev/null |
2908 |
+++ b/dev-db/mariadb/mariadb-10.4.7.ebuild |
2909 |
@@ -0,0 +1,992 @@ |
2910 |
+# Copyright 1999-2019 Gentoo Authors |
2911 |
+# Distributed under the terms of the GNU General Public License v2 |
2912 |
+ |
2913 |
+EAPI="7" |
2914 |
+MY_EXTRAS_VER="20190731-2258Z" |
2915 |
+SUBSLOT="18" |
2916 |
+ |
2917 |
+JAVA_PKG_OPT_USE="jdbc" |
2918 |
+ |
2919 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
2920 |
+ java-pkg-opt-2 cmake-utils |
2921 |
+ |
2922 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
2923 |
+ |
2924 |
+# Gentoo patches to MySQL |
2925 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
2926 |
+ SRC_URI="${SRC_URI} |
2927 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
2928 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
2929 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
2930 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
2931 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
2932 |
+fi |
2933 |
+ |
2934 |
+HOMEPAGE="https://mariadb.org/" |
2935 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
2936 |
+LICENSE="GPL-2 LGPL-2.1+" |
2937 |
+SLOT="0/${SUBSLOT:-0}" |
2938 |
+IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4 |
2939 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
2940 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
2941 |
+ sst-rsync sst-mariabackup static systemd systemtap tcmalloc |
2942 |
+ test tokudb xml yassl" |
2943 |
+ |
2944 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
2945 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
2946 |
+ |
2947 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
2948 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
2949 |
+ ?? ( tcmalloc jemalloc ) |
2950 |
+ static? ( yassl !pam )" |
2951 |
+ |
2952 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
2953 |
+ |
2954 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
2955 |
+# and we will run a mysql server during test phase |
2956 |
+S="${WORKDIR}/mysql" |
2957 |
+ |
2958 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
2959 |
+ inherit git-r3 |
2960 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
2961 |
+ EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras" |
2962 |
+ EGIT_CLONE_TYPE=shallow |
2963 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras" |
2964 |
+else |
2965 |
+ MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" |
2966 |
+fi |
2967 |
+ |
2968 |
+PATCHES=( |
2969 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
2970 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.4.5-without-clientlibs-tools.patch |
2971 |
+ "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch |
2972 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch |
2973 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch |
2974 |
+) |
2975 |
+ |
2976 |
+# Be warned, *DEPEND are version-dependant |
2977 |
+# These are used for both runtime and compiletime |
2978 |
+COMMON_DEPEND=" |
2979 |
+ kernel_linux? ( |
2980 |
+ sys-process/procps:0= |
2981 |
+ dev-libs/libaio:0= |
2982 |
+ ) |
2983 |
+ >=sys-apps/sed-4 |
2984 |
+ >=sys-apps/texinfo-4.7-r1 |
2985 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
2986 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
2987 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
2988 |
+ >=sys-libs/zlib-1.2.3:0= |
2989 |
+ kerberos? ( virtual/krb5 ) |
2990 |
+ yassl? ( net-libs/gnutls:0= ) |
2991 |
+ !yassl? ( |
2992 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
2993 |
+ libressl? ( dev-libs/libressl:0= ) |
2994 |
+ ) |
2995 |
+ sys-libs/ncurses:0= |
2996 |
+ !bindist? ( |
2997 |
+ sys-libs/binutils-libs:0= |
2998 |
+ >=sys-libs/readline-4.1:0= |
2999 |
+ ) |
3000 |
+ server? ( |
3001 |
+ backup? ( app-arch/libarchive:0= ) |
3002 |
+ cracklib? ( sys-libs/cracklib:0= ) |
3003 |
+ extraengine? ( |
3004 |
+ odbc? ( dev-db/unixODBC:0= ) |
3005 |
+ xml? ( dev-libs/libxml2:2= ) |
3006 |
+ ) |
3007 |
+ innodb-lz4? ( app-arch/lz4 ) |
3008 |
+ innodb-lzo? ( dev-libs/lzo ) |
3009 |
+ innodb-snappy? ( app-arch/snappy ) |
3010 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
3011 |
+ numa? ( sys-process/numactl ) |
3012 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
3013 |
+ pam? ( virtual/pam:0= ) |
3014 |
+ systemd? ( sys-apps/systemd:= ) |
3015 |
+ tokudb? ( app-arch/snappy ) |
3016 |
+ ) |
3017 |
+ >=dev-libs/libpcre-8.41-r1:3= |
3018 |
+" |
3019 |
+BDEPEND="virtual/yacc |
3020 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
3021 |
+" |
3022 |
+DEPEND="static? ( sys-libs/ncurses[static-libs] ) |
3023 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) |
3024 |
+ test? ( acct-group/mysql acct-user/mysql ) ) |
3025 |
+ ${COMMON_DEPEND}" |
3026 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
3027 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
3028 |
+ !<virtual/mysql-5.6-r11 |
3029 |
+ !<virtual/libmysqlclient-18-r1 |
3030 |
+ ${COMMON_DEPEND} |
3031 |
+ server? ( |
3032 |
+ galera? ( |
3033 |
+ sys-apps/iproute2 |
3034 |
+ =sys-cluster/galera-26* |
3035 |
+ sst-rsync? ( sys-process/lsof ) |
3036 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
3037 |
+ ) |
3038 |
+ !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql ) |
3039 |
+ extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) |
3040 |
+ ) |
3041 |
+ perl? ( !dev-db/mytop |
3042 |
+ virtual/perl-Getopt-Long |
3043 |
+ dev-perl/TermReadKey |
3044 |
+ virtual/perl-Term-ANSIColor |
3045 |
+ virtual/perl-Time-HiRes ) |
3046 |
+" |
3047 |
+# For other stuff to bring us in |
3048 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
3049 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
3050 |
+ server? ( ~virtual/mysql-5.6[static=] )" |
3051 |
+ |
3052 |
+pkg_setup() { |
3053 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
3054 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
3055 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
3056 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
3057 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
3058 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
3059 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
3060 |
+ die |
3061 |
+ fi |
3062 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
3063 |
+ # non x86{,_64} arches |
3064 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
3065 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
3066 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
3067 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
3068 |
+ die |
3069 |
+ fi |
3070 |
+ fi |
3071 |
+ java-pkg-opt-2_pkg_setup |
3072 |
+ if has test ${FEATURES} && \ |
3073 |
+ use server && ! has userpriv ${FEATURES} ; then |
3074 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
3075 |
+ fi |
3076 |
+ |
3077 |
+} |
3078 |
+ |
3079 |
+pkg_preinst() { |
3080 |
+ java-pkg-opt-2_pkg_preinst |
3081 |
+} |
3082 |
+ |
3083 |
+pkg_postinst() { |
3084 |
+ # Make sure the vars are correctly initialized |
3085 |
+ mysql_init_vars |
3086 |
+ |
3087 |
+ # Create log directory securely if it does not exist |
3088 |
+ [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" |
3089 |
+ |
3090 |
+ if use server ; then |
3091 |
+ if use pam; then |
3092 |
+ einfo |
3093 |
+ elog "This install includes the PAM authentication plugin." |
3094 |
+ elog "To activate and configure the PAM plugin, please read:" |
3095 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
3096 |
+ einfo |
3097 |
+ chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die |
3098 |
+ fi |
3099 |
+ |
3100 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
3101 |
+ einfo |
3102 |
+ elog "You might want to run:" |
3103 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
3104 |
+ elog "if this is a new install." |
3105 |
+ elog |
3106 |
+ elog "If you are switching server implentations, you should run the" |
3107 |
+ elog "mysql_upgrade tool." |
3108 |
+ einfo |
3109 |
+ else |
3110 |
+ einfo |
3111 |
+ elog "If you are upgrading major versions, you should run the" |
3112 |
+ elog "mysql_upgrade tool." |
3113 |
+ einfo |
3114 |
+ fi |
3115 |
+ |
3116 |
+ if use galera ; then |
3117 |
+ einfo |
3118 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
3119 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
3120 |
+ elog "The first time the cluster is activated, you should add" |
3121 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
3122 |
+ elog "This option should then be removed for subsequent starts." |
3123 |
+ einfo |
3124 |
+ if [[ -n "${REPLACING_VERSIONS}" ]] ; then |
3125 |
+ local rver |
3126 |
+ for rver in ${REPLACING_VERSIONS} ; do |
3127 |
+ if ver_test "${rver}" -lt "10.4.0" ; then |
3128 |
+ ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." |
3129 |
+ ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" |
3130 |
+ ewarn "for more information" |
3131 |
+ fi |
3132 |
+ done |
3133 |
+ fi |
3134 |
+ fi |
3135 |
+ fi |
3136 |
+ |
3137 |
+ # Note about configuration change |
3138 |
+ einfo |
3139 |
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf" |
3140 |
+ elog "to several files in /etc/mysql/${PN}.d." |
3141 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
3142 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
3143 |
+ elog "You may have as many files as needed and they are read alphabetically." |
3144 |
+ elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." |
3145 |
+ einfo |
3146 |
+} |
3147 |
+ |
3148 |
+src_unpack() { |
3149 |
+ unpack ${A} |
3150 |
+ # Grab the patches |
3151 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
3152 |
+ |
3153 |
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die |
3154 |
+} |
3155 |
+ |
3156 |
+src_prepare() { |
3157 |
+ _disable_plugin() { |
3158 |
+ echo > "${S}/plugin/${1}/CMakeLists.txt" || die |
3159 |
+ } |
3160 |
+ _disable_engine() { |
3161 |
+ echo > "${S}/storage/${1}/CMakeLists.txt" || die |
3162 |
+ } |
3163 |
+ |
3164 |
+ if use jemalloc; then |
3165 |
+ echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" |
3166 |
+ elif use tcmalloc; then |
3167 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" |
3168 |
+ fi |
3169 |
+ |
3170 |
+ # Don't build bundled xz-utils for tokudb |
3171 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
3172 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
3173 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
3174 |
+ |
3175 |
+ local plugin |
3176 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
3177 |
+ locale_info qc_info server_audit sql_errlog auth_ed25519 ) |
3178 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext |
3179 |
+ debug_key_management example_key_management versioning ) |
3180 |
+ if ! use server; then # These plugins are for the server |
3181 |
+ for plugin in "${server_plugins[@]}" ; do |
3182 |
+ _disable_plugin "${plugin}" |
3183 |
+ done |
3184 |
+ fi |
3185 |
+ |
3186 |
+ if ! use test; then # These plugins are only used during testing |
3187 |
+ for plugin in "${test_plugins[@]}" ; do |
3188 |
+ _disable_plugin "${plugin}" |
3189 |
+ done |
3190 |
+ _disable_engine test_sql_discovery |
3191 |
+ echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die |
3192 |
+ fi |
3193 |
+ |
3194 |
+ _disable_engine example |
3195 |
+ |
3196 |
+ if ! use oqgraph ; then # avoids extra library checks |
3197 |
+ _disable_engine oqgraph |
3198 |
+ fi |
3199 |
+ |
3200 |
+ if use mroonga ; then |
3201 |
+ # Remove the bundled groonga |
3202 |
+ # There is no CMake flag, it simply checks for existance |
3203 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
3204 |
+ else |
3205 |
+ _disable_engine mroonga |
3206 |
+ fi |
3207 |
+ |
3208 |
+ cmake-utils_src_prepare |
3209 |
+ java-pkg-opt-2_src_prepare |
3210 |
+} |
3211 |
+ |
3212 |
+src_configure(){ |
3213 |
+ # bug 508724 mariadb cannot use ld.gold |
3214 |
+ tc-ld-disable-gold |
3215 |
+ # Bug #114895, bug #110149 |
3216 |
+ filter-flags "-O" "-O[01]" |
3217 |
+ |
3218 |
+ append-cxxflags -felide-constructors |
3219 |
+ |
3220 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
3221 |
+ append-flags -fno-strict-aliasing |
3222 |
+ |
3223 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
3224 |
+ |
3225 |
+ # debug hack wrt #497532 |
3226 |
+ mycmakeargs=( |
3227 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
3228 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
3229 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
3230 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
3231 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
3232 |
+ -DINSTALL_BINDIR=bin |
3233 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
3234 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
3235 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
3236 |
+ -DINSTALL_INFODIR=share/info |
3237 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
3238 |
+ -DINSTALL_MANDIR=share/man |
3239 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
3240 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
3241 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
3242 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
3243 |
+ -DINSTALL_SBINDIR=sbin |
3244 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
3245 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
3246 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
3247 |
+ -DWITH_LIBEDIT=0 |
3248 |
+ -DWITH_ZLIB=system |
3249 |
+ -DWITHOUT_LIBWRAP=1 |
3250 |
+ -DENABLED_LOCAL_INFILE=1 |
3251 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
3252 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
3253 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
3254 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
3255 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
3256 |
+ # The build forces this to be defined when cross-compiling. We pass it |
3257 |
+ # all the time for simplicity and to make sure it is actually correct. |
3258 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
3259 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
3260 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
3261 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
3262 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
3263 |
+ -DWITH_EXTERNAL_ZLIB=YES |
3264 |
+ -DSUFFIX_INSTALL_DIR="" |
3265 |
+ -DWITH_UNITTEST=OFF |
3266 |
+ -DWITHOUT_CLIENTLIBS=YES |
3267 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
3268 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF |
3269 |
+ -DCLIENT_PLUGIN_CLIENT_ED25519=OFF |
3270 |
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC |
3271 |
+ -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF |
3272 |
+ ) |
3273 |
+ if use test ; then |
3274 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
3275 |
+ else |
3276 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
3277 |
+ fi |
3278 |
+ |
3279 |
+ if ! use yassl ; then |
3280 |
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) |
3281 |
+ else |
3282 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
3283 |
+ fi |
3284 |
+ |
3285 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
3286 |
+ mycmakeargs+=( |
3287 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
3288 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
3289 |
+ -DENABLE_DTRACE=$(usex systemtap) |
3290 |
+ ) |
3291 |
+ |
3292 |
+ if use server ; then |
3293 |
+ |
3294 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
3295 |
+ if ! use extraengine ; then |
3296 |
+ mycmakeargs+=( |
3297 |
+ -DPLUGIN_FEDERATED=NO |
3298 |
+ -DPLUGIN_FEDERATEDX=NO ) |
3299 |
+ fi |
3300 |
+ |
3301 |
+ mycmakeargs+=( |
3302 |
+ -DWITH_PCRE=system |
3303 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
3304 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
3305 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
3306 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
3307 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
3308 |
+ -DPLUGIN_CASSANDRA=NO |
3309 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
3310 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
3311 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
3312 |
+ -DCONNECT_WITH_MYSQL=1 |
3313 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
3314 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
3315 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
3316 |
+ # Build failure and autodep wrt bug 639144 |
3317 |
+ -DCONNECT_WITH_MONGO=OFF |
3318 |
+ -DWITH_WSREP=$(usex galera) |
3319 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
3320 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
3321 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
3322 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
3323 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
3324 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
3325 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
3326 |
+ -DINSTALL_SQLBENCHDIR="" |
3327 |
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) |
3328 |
+ # systemd is only linked to for server notification |
3329 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
3330 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
3331 |
+ ) |
3332 |
+ |
3333 |
+ # Workaround for MDEV-14524 |
3334 |
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) |
3335 |
+ |
3336 |
+ if use test ; then |
3337 |
+ # This is needed for the new client lib which tests a real, open server |
3338 |
+ mycmakeargs+=( -DSKIP_TESTS=ON ) |
3339 |
+ fi |
3340 |
+ |
3341 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
3342 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
3343 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
3344 |
+ ewarn "You MUST file bugs without these variables set." |
3345 |
+ |
3346 |
+ mycmakeargs+=( |
3347 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
3348 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
3349 |
+ ) |
3350 |
+ |
3351 |
+ elif ! use latin1 ; then |
3352 |
+ mycmakeargs+=( |
3353 |
+ -DDEFAULT_CHARSET=utf8 |
3354 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
3355 |
+ ) |
3356 |
+ else |
3357 |
+ mycmakeargs+=( |
3358 |
+ -DDEFAULT_CHARSET=latin1 |
3359 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
3360 |
+ ) |
3361 |
+ fi |
3362 |
+ mycmakeargs+=( |
3363 |
+ -DEXTRA_CHARSETS=all |
3364 |
+ -DMYSQL_USER=mysql |
3365 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
3366 |
+ -DWITH_DEBUG=$(usex debug) |
3367 |
+ -DWITH_EMBEDDED_SERVER=OFF |
3368 |
+ -DWITH_PROFILING=$(usex profiling) |
3369 |
+ ) |
3370 |
+ |
3371 |
+ if use static; then |
3372 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
3373 |
+ fi |
3374 |
+ |
3375 |
+ if use jemalloc || use tcmalloc ; then |
3376 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
3377 |
+ fi |
3378 |
+ |
3379 |
+ # Storage engines |
3380 |
+ mycmakeargs+=( |
3381 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
3382 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
3383 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
3384 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
3385 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
3386 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
3387 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
3388 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
3389 |
+ ) |
3390 |
+ |
3391 |
+ else |
3392 |
+ mycmakeargs+=( |
3393 |
+ -DWITHOUT_SERVER=1 |
3394 |
+ -DWITH_EMBEDDED_SERVER=OFF |
3395 |
+ -DEXTRA_CHARSETS=none |
3396 |
+ -DINSTALL_SQLBENCHDIR= |
3397 |
+ -DWITH_SYSTEMD=no |
3398 |
+ ) |
3399 |
+ fi |
3400 |
+ |
3401 |
+ cmake-utils_src_configure |
3402 |
+} |
3403 |
+ |
3404 |
+src_compile() { |
3405 |
+ cmake-utils_src_compile |
3406 |
+} |
3407 |
+ |
3408 |
+src_install() { |
3409 |
+ cmake-utils_src_install |
3410 |
+ |
3411 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
3412 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
3413 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
3414 |
+ fi |
3415 |
+ |
3416 |
+ # Make sure the vars are correctly initialized |
3417 |
+ mysql_init_vars |
3418 |
+ |
3419 |
+ # Convenience links |
3420 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
3421 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
3422 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
3423 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
3424 |
+ |
3425 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
3426 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
3427 |
+ rm -Rf "${ED}/usr/data" || die |
3428 |
+ fi |
3429 |
+ |
3430 |
+ # Unless they explicitly specific USE=test, then do not install the |
3431 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
3432 |
+ # validation of your database configuration after tuning it. |
3433 |
+ if ! use test ; then |
3434 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
3435 |
+ fi |
3436 |
+ |
3437 |
+ # Configuration stuff |
3438 |
+ einfo "Building default configuration ..." |
3439 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
3440 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
3441 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
3442 |
+ eprefixify "${TMPDIR}/my.cnf" |
3443 |
+ doins "${TMPDIR}/my.cnf" |
3444 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
3445 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
3446 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
3447 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
3448 |
+ |
3449 |
+ if use server ; then |
3450 |
+ mycnf_src="my.cnf.distro-server" |
3451 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
3452 |
+ "${FILESDIR}/${mycnf_src}" \ |
3453 |
+ > "${TMPDIR}/my.cnf.ok" || die |
3454 |
+ if use prefix ; then |
3455 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
3456 |
+ "${TMPDIR}/my.cnf.ok" || die |
3457 |
+ fi |
3458 |
+ if use latin1 ; then |
3459 |
+ sed -i \ |
3460 |
+ -e "/character-set/s|utf8|latin1|g" \ |
3461 |
+ "${TMPDIR}/my.cnf.ok" || die |
3462 |
+ fi |
3463 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
3464 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
3465 |
+ |
3466 |
+ einfo "Including support files and sample configurations" |
3467 |
+ docinto "support-files" |
3468 |
+ local script |
3469 |
+ for script in \ |
3470 |
+ "${S}"/support-files/magic |
3471 |
+ do |
3472 |
+ [[ -f "$script" ]] && dodoc "${script}" |
3473 |
+ done |
3474 |
+ |
3475 |
+ docinto "scripts" |
3476 |
+ for script in "${S}"/scripts/mysql* ; do |
3477 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
3478 |
+ done |
3479 |
+ # Manually install supporting files that conflict with other packages |
3480 |
+ # but are needed for galera and initial installation |
3481 |
+ exeinto /usr/libexec/mariadb |
3482 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
3483 |
+ |
3484 |
+ if use pam ; then |
3485 |
+ keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir |
3486 |
+ fi |
3487 |
+ fi |
3488 |
+ |
3489 |
+ # Remove mytop if perl is not selected |
3490 |
+ if [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl ; then |
3491 |
+ rm -f "${ED}/usr/bin/mytop" || die |
3492 |
+ fi |
3493 |
+ |
3494 |
+ # Fix a dangling symlink when galera is not built |
3495 |
+ if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then |
3496 |
+ rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die |
3497 |
+ fi |
3498 |
+ |
3499 |
+ # Remove broken SST scripts that are incompatible |
3500 |
+ local scriptremove |
3501 |
+ for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do |
3502 |
+ if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then |
3503 |
+ rm "${ED}/usr/bin/${scriptremove}" || die |
3504 |
+ fi |
3505 |
+ done |
3506 |
+} |
3507 |
+ |
3508 |
+# Official test instructions: |
3509 |
+# USE='extraengine perl server' \ |
3510 |
+# FEATURES='test userpriv -usersandbox' \ |
3511 |
+# ebuild mariadb-X.X.XX.ebuild \ |
3512 |
+# digest clean package |
3513 |
+src_test() { |
3514 |
+ |
3515 |
+ _disable_test() { |
3516 |
+ local rawtestname reason |
3517 |
+ rawtestname="${1}" ; shift |
3518 |
+ reason="${@}" |
3519 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
3520 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
3521 |
+ } |
3522 |
+ |
3523 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
3524 |
+ local retstatus_unit |
3525 |
+ local retstatus_tests |
3526 |
+ |
3527 |
+ if ! use server ; then |
3528 |
+ einfo "Skipping server tests due to minimal build." |
3529 |
+ return 0 |
3530 |
+ fi |
3531 |
+ |
3532 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
3533 |
+ # localhost. Also causes weird failures. |
3534 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
3535 |
+ |
3536 |
+ if [[ $UID -eq 0 ]]; then |
3537 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
3538 |
+ fi |
3539 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
3540 |
+ |
3541 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
3542 |
+ |
3543 |
+ # Run CTest (test-units) |
3544 |
+ cmake-utils_src_test |
3545 |
+ retstatus_unit=$? |
3546 |
+ |
3547 |
+ # Ensure that parallel runs don't die |
3548 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
3549 |
+ # Enable parallel testing, auto will try to detect number of cores |
3550 |
+ # You may set this by hand. |
3551 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
3552 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
3553 |
+ |
3554 |
+ # create directories because mysqladmin might run out of order |
3555 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
3556 |
+ |
3557 |
+ # Run mysql tests |
3558 |
+ pushd "${TESTDIR}" > /dev/null || die |
3559 |
+ |
3560 |
+ touch "${T}/disabled.def" |
3561 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
3562 |
+ # false positives: |
3563 |
+ # |
3564 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
3565 |
+ # main.mysql_client_test_comp: |
3566 |
+ # segfaults at random under Portage only, suspect resource limits. |
3567 |
+ |
3568 |
+ local t |
3569 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
3570 |
+ _disable_test "$t" "False positive due to varying policies" |
3571 |
+ done |
3572 |
+ |
3573 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
3574 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
3575 |
+ _disable_test "$t" "False positives in Gentoo" |
3576 |
+ done |
3577 |
+ |
3578 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
3579 |
+ |
3580 |
+ _disable_test main.func_time "Dependent on time test was written" |
3581 |
+ |
3582 |
+ _disable_test compat/oracle.plugin "Needs example plugin which Gentoo disables" |
3583 |
+ |
3584 |
+ # run mysql-test tests |
3585 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
3586 |
+ retstatus_tests=$? |
3587 |
+ |
3588 |
+ popd > /dev/null || die |
3589 |
+ |
3590 |
+ # Cleanup is important for these testcases. |
3591 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
3592 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
3593 |
+ |
3594 |
+ local failures="" |
3595 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
3596 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
3597 |
+ |
3598 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
3599 |
+ einfo "Tests successfully completed" |
3600 |
+} |
3601 |
+ |
3602 |
+mysql_init_vars() { |
3603 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
3604 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
3605 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
3606 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
3607 |
+ |
3608 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
3609 |
+ MY_DATADIR="" |
3610 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
3611 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
3612 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
3613 |
+ | tail -n1` |
3614 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
3615 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
3616 |
+ | sed -e 's/.*=\s*//' \ |
3617 |
+ | tail -n1` |
3618 |
+ fi |
3619 |
+ fi |
3620 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
3621 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
3622 |
+ einfo "Using default MY_DATADIR" |
3623 |
+ fi |
3624 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
3625 |
+ |
3626 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
3627 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
3628 |
+ # If you get this and you're wondering about it, see bug #207636 |
3629 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
3630 |
+ elog "A new one will not be created." |
3631 |
+ PREVIOUS_DATADIR="yes" |
3632 |
+ else |
3633 |
+ PREVIOUS_DATADIR="no" |
3634 |
+ fi |
3635 |
+ export PREVIOUS_DATADIR |
3636 |
+ fi |
3637 |
+ else |
3638 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
3639 |
+ local new_MY_DATADIR |
3640 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
3641 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
3642 |
+ | tail -n1` |
3643 |
+ |
3644 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
3645 |
+ ewarn "MySQL MY_DATADIR has changed" |
3646 |
+ ewarn "from ${MY_DATADIR}" |
3647 |
+ ewarn "to ${new_MY_DATADIR}" |
3648 |
+ MY_DATADIR="${new_MY_DATADIR}" |
3649 |
+ fi |
3650 |
+ fi |
3651 |
+ fi |
3652 |
+ |
3653 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
3654 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
3655 |
+ export MY_DATADIR |
3656 |
+} |
3657 |
+ |
3658 |
+pkg_config() { |
3659 |
+ _getoptval() { |
3660 |
+ local mypd="${EROOT}"/usr/libexec/mariadb/my_print_defaults |
3661 |
+ local section="$1" |
3662 |
+ local flag="--${2}=" |
3663 |
+ local extra_options="${3}" |
3664 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
3665 |
+ } |
3666 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
3667 |
+ local old_HOME="${HOME}" |
3668 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
3669 |
+ export HOME=${EPREFIX}/root |
3670 |
+ |
3671 |
+ # Make sure the vars are correctly initialized |
3672 |
+ mysql_init_vars |
3673 |
+ |
3674 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
3675 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
3676 |
+ die "Minimal builds do NOT include the MySQL server" |
3677 |
+ fi |
3678 |
+ |
3679 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
3680 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
3681 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
3682 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
3683 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
3684 |
+ |
3685 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
3686 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
3687 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
3688 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
3689 |
+ else |
3690 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
3691 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
3692 |
+ || die "Moving MY_DATADIR failed" |
3693 |
+ fi |
3694 |
+ else |
3695 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
3696 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
3697 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
3698 |
+ else |
3699 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
3700 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
3701 |
+ fi |
3702 |
+ fi |
3703 |
+ fi |
3704 |
+ |
3705 |
+ local pwd1="a" |
3706 |
+ local pwd2="b" |
3707 |
+ local maxtry=15 |
3708 |
+ |
3709 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
3710 |
+ local tmp_mysqld_password_source= |
3711 |
+ |
3712 |
+ for tmp_mysqld_password_source in mysql client; do |
3713 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
3714 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
3715 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
3716 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
3717 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
3718 |
+ MYSQL_ROOT_PASSWORD= |
3719 |
+ continue |
3720 |
+ fi |
3721 |
+ |
3722 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
3723 |
+ break |
3724 |
+ fi |
3725 |
+ done |
3726 |
+ |
3727 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
3728 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
3729 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
3730 |
+ fi |
3731 |
+ |
3732 |
+ unset tmp_mysqld_password_source |
3733 |
+ fi |
3734 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n1)" |
3735 |
+ # These are dir+prefix |
3736 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n1)" |
3737 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
3738 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n1)" |
3739 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
3740 |
+ |
3741 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
3742 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
3743 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
3744 |
+ fi |
3745 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
3746 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
3747 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
3748 |
+ fi |
3749 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
3750 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
3751 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
3752 |
+ fi |
3753 |
+ |
3754 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
3755 |
+ ewarn "You have already a MySQL database in place." |
3756 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
3757 |
+ ewarn "Please rename or delete it if you wish to replace it." |
3758 |
+ die "MySQL database already exists!" |
3759 |
+ fi |
3760 |
+ |
3761 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
3762 |
+ # localhost. Also causes weird failures. |
3763 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
3764 |
+ |
3765 |
+ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then |
3766 |
+ |
3767 |
+ einfo "Please provide a password for the mysql 'root'@'localhost' user now" |
3768 |
+ einfo "or through the ${HOME}/.my.cnf file." |
3769 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
3770 |
+ einfo "Not entering a password defaults to UNIX authentication" |
3771 |
+ read -rsp " >" pwd1 ; echo |
3772 |
+ |
3773 |
+ if [[ -n "${pwd1}" ]] ; then |
3774 |
+ |
3775 |
+ einfo "Retype the password" |
3776 |
+ read -rsp " >" pwd2 ; echo |
3777 |
+ |
3778 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
3779 |
+ die "Passwords are not the same" |
3780 |
+ fi |
3781 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
3782 |
+ fi |
3783 |
+ unset pwd1 pwd2 |
3784 |
+ fi |
3785 |
+ |
3786 |
+ local options |
3787 |
+ local sqltmp="$(emktemp)" |
3788 |
+ |
3789 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
3790 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
3791 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
3792 |
+ |
3793 |
+ # Figure out which options we need to disable to do the setup |
3794 |
+ local helpfile="${TMPDIR}/mysqld-help" |
3795 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
3796 |
+ for opt in host-cache name-resolve networking slave-start \ |
3797 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
3798 |
+ log-slave-updates \ |
3799 |
+ ; do |
3800 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
3801 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
3802 |
+ done |
3803 |
+ |
3804 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
3805 |
+ |
3806 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
3807 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
3808 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
3809 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
3810 |
+ fi |
3811 |
+ |
3812 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
3813 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
3814 |
+ fi |
3815 |
+ |
3816 |
+ pushd "${TMPDIR}" &>/dev/null || die |
3817 |
+ |
3818 |
+ # Filling timezones, see |
3819 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
3820 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
3821 |
+ |
3822 |
+ local cmd=( "${EROOT}/usr/share/mariadb/scripts/mysql_install_db" ) |
3823 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}/usr/bin/mysql_install_db" ) |
3824 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
3825 |
+ einfo "Command: ${cmd[*]}" |
3826 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
3827 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
3828 |
+ if [[ $? -ne 0 ]]; then |
3829 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
3830 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
3831 |
+ fi |
3832 |
+ popd &>/dev/null || die |
3833 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
3834 |
+ || die "MySQL databases not installed" |
3835 |
+ |
3836 |
+ if [[ -z ${sqltmp} && -z ${MYSQL_ROOT_PASSWORD} ]] ; then |
3837 |
+ einfo "Done" |
3838 |
+ exit 0 |
3839 |
+ fi |
3840 |
+ |
3841 |
+ use prefix || options="${options} --user=mysql" |
3842 |
+ |
3843 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
3844 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
3845 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
3846 |
+ ${options} \ |
3847 |
+ --log-warnings=0 \ |
3848 |
+ --basedir=${EROOT}/usr \ |
3849 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
3850 |
+ --max_allowed_packet=8M \ |
3851 |
+ --net_buffer_length=16K \ |
3852 |
+ --socket=${socket} \ |
3853 |
+ --pid-file=${pidfile} \ |
3854 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
3855 |
+ #einfo "About to start mysqld: ${mysqld}" |
3856 |
+ ebegin "Starting mysqld" |
3857 |
+ einfo "Command ${mysqld}" |
3858 |
+ ${mysqld} & |
3859 |
+ rc=$? |
3860 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
3861 |
+ maxtry=$((${maxtry}-1)) |
3862 |
+ echo -n "." |
3863 |
+ sleep 1 |
3864 |
+ done |
3865 |
+ eend $rc |
3866 |
+ |
3867 |
+ [[ -S "${socket}" ]] || |
3868 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
3869 |
+ |
3870 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then |
3871 |
+ ebegin "Setting root password" |
3872 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
3873 |
+ local sql="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MYSQL_ROOT_PASSWORD}')" |
3874 |
+ "${EROOT}/usr/bin/mysql" \ |
3875 |
+ "--socket=${socket}" \ |
3876 |
+ -hlocalhost \ |
3877 |
+ -e "${sql}" |
3878 |
+ unset sql |
3879 |
+ eend $? |
3880 |
+ fi |
3881 |
+ |
3882 |
+ if [[ -n "${sqltmp}" ]] ; then |
3883 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
3884 |
+ "${EROOT}/usr/bin/mysql" \ |
3885 |
+ "--socket=${socket}" \ |
3886 |
+ -hlocalhost \ |
3887 |
+ -uroot \ |
3888 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
3889 |
+ mysql < "${sqltmp}" |
3890 |
+ rc=$? |
3891 |
+ eend $? |
3892 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
3893 |
+ fi |
3894 |
+ |
3895 |
+ # Stop the server and cleanup |
3896 |
+ einfo "Stopping the server ..." |
3897 |
+ kill $(< "${pidfile}" ) |
3898 |
+ rm -f "${sqltmp}" |
3899 |
+ wait %1 |
3900 |
+ einfo "Done" |
3901 |
+} |
3902 |
|
3903 |
diff --git a/dev-db/mariadb/mariadb-5.5.65.ebuild b/dev-db/mariadb/mariadb-5.5.65.ebuild |
3904 |
new file mode 100644 |
3905 |
index 00000000000..c09952b96da |
3906 |
--- /dev/null |
3907 |
+++ b/dev-db/mariadb/mariadb-5.5.65.ebuild |
3908 |
@@ -0,0 +1,831 @@ |
3909 |
+# Copyright 1999-2019 Gentoo Authors |
3910 |
+# Distributed under the terms of the GNU General Public License v2 |
3911 |
+ |
3912 |
+EAPI="6" |
3913 |
+MY_EXTRAS_VER="20180809-1700Z" |
3914 |
+SUBSLOT="18" |
3915 |
+ |
3916 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
3917 |
+ |
3918 |
+inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build |
3919 |
+ |
3920 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
3921 |
+ |
3922 |
+# Gentoo patches to MySQL |
3923 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
3924 |
+ SRC_URI="${SRC_URI} |
3925 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
3926 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
3927 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
3928 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
3929 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
3930 |
+fi |
3931 |
+ |
3932 |
+HOMEPAGE="https://mariadb.org/" |
3933 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
3934 |
+LICENSE="GPL-2" |
3935 |
+SLOT="0/${SUBSLOT:-0}" |
3936 |
+IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl |
3937 |
+ oqgraph pam +perl profiling selinux +server sphinx |
3938 |
+ static static-libs systemtap tcmalloc |
3939 |
+ test tokudb yassl" |
3940 |
+ |
3941 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
3942 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
3943 |
+ |
3944 |
+REQUIRED_USE="server? ( tokudb? ( jemalloc !tcmalloc ) ) |
3945 |
+ ?? ( tcmalloc jemalloc ) |
3946 |
+ static? ( yassl !pam )" |
3947 |
+ |
3948 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
3949 |
+ |
3950 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
3951 |
+# and we will run a mysql server during test phase |
3952 |
+S="${WORKDIR}/mysql" |
3953 |
+ |
3954 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
3955 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
3956 |
+ inherit git-r3 |
3957 |
+ EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git" |
3958 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
3959 |
+ EGIT_CLONE_TYPE=shallow |
3960 |
+else |
3961 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
3962 |
+fi |
3963 |
+ |
3964 |
+PATCHES=( |
3965 |
+ "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch" |
3966 |
+ "${MY_PATCH_DIR}/20004_all_mariadb-filter-tokudb-flags.patch" |
3967 |
+ "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-5.5.50.patch" |
3968 |
+ "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch" |
3969 |
+ "${MY_PATCH_DIR}/20018_all_mariadb-5.5.60-without-clientlibs-tools.patch" |
3970 |
+) |
3971 |
+ |
3972 |
+# Be warned, *DEPEND are version-dependant |
3973 |
+# These are used for both runtime and compiletime |
3974 |
+COMMON_DEPEND=" |
3975 |
+ kernel_linux? ( |
3976 |
+ sys-process/procps:0= |
3977 |
+ dev-libs/libaio:0= |
3978 |
+ ) |
3979 |
+ >=sys-apps/sed-4 |
3980 |
+ >=sys-apps/texinfo-4.7-r1 |
3981 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
3982 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
3983 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
3984 |
+ !yassl? ( |
3985 |
+ !libressl? ( <dev-libs/openssl-1.1.0:0= ) |
3986 |
+ libressl? ( dev-libs/libressl:0= ) |
3987 |
+ ) |
3988 |
+ >=sys-libs/zlib-1.2.3:0= |
3989 |
+ sys-libs/ncurses:0= |
3990 |
+ !bindist? ( |
3991 |
+ >=sys-libs/readline-4.1:0= |
3992 |
+ ) |
3993 |
+ server? ( |
3994 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
3995 |
+ pam? ( virtual/pam:0= ) |
3996 |
+ ) |
3997 |
+ !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] ) |
3998 |
+" |
3999 |
+DEPEND="virtual/yacc |
4000 |
+ static? ( sys-libs/ncurses[static-libs] ) |
4001 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
4002 |
+ ${COMMON_DEPEND}" |
4003 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
4004 |
+ client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c ) |
4005 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
4006 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
4007 |
+ ${COMMON_DEPEND} |
4008 |
+ perl? ( !dev-db/mytop |
4009 |
+ virtual/perl-Getopt-Long |
4010 |
+ dev-perl/TermReadKey |
4011 |
+ virtual/perl-Term-ANSIColor |
4012 |
+ virtual/perl-Time-HiRes ) |
4013 |
+" |
4014 |
+# For other stuff to bring us in |
4015 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
4016 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" |
4017 |
+ |
4018 |
+pkg_setup() { |
4019 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
4020 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
4021 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
4022 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
4023 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
4024 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
4025 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
4026 |
+ die |
4027 |
+ fi |
4028 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
4029 |
+ # non x86{,_64} arches |
4030 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
4031 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
4032 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
4033 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
4034 |
+ die |
4035 |
+ fi |
4036 |
+ fi |
4037 |
+ if has test ${FEATURES} && \ |
4038 |
+ use server && ! has userpriv ${FEATURES} ; then |
4039 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
4040 |
+ fi |
4041 |
+ |
4042 |
+ # This should come after all of the die statements |
4043 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
4044 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
4045 |
+} |
4046 |
+ |
4047 |
+pkg_postinst() { |
4048 |
+ # Make sure the vars are correctly initialized |
4049 |
+ mysql_init_vars |
4050 |
+ |
4051 |
+ # Create log directory securely if it does not exist |
4052 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
4053 |
+ |
4054 |
+ if use server ; then |
4055 |
+ if use pam; then |
4056 |
+ einfo |
4057 |
+ elog "This install includes the PAM authentication plugin." |
4058 |
+ elog "To activate and configure the PAM plugin, please read:" |
4059 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
4060 |
+ einfo |
4061 |
+ fi |
4062 |
+ |
4063 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
4064 |
+ einfo |
4065 |
+ elog "You might want to run:" |
4066 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
4067 |
+ elog "if this is a new install." |
4068 |
+ elog |
4069 |
+ elog "If you are switching server implentations, you should run the" |
4070 |
+ elog "mysql_upgrade tool." |
4071 |
+ einfo |
4072 |
+ else |
4073 |
+ einfo |
4074 |
+ elog "If you are upgrading major versions, you should run the" |
4075 |
+ elog "mysql_upgrade tool." |
4076 |
+ einfo |
4077 |
+ fi |
4078 |
+ |
4079 |
+ einfo |
4080 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
4081 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
4082 |
+ elog "The first time the cluster is activated, you should add" |
4083 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
4084 |
+ elog "This option should then be removed for subsequent starts." |
4085 |
+ einfo |
4086 |
+ fi |
4087 |
+} |
4088 |
+ |
4089 |
+src_unpack() { |
4090 |
+ unpack ${A} |
4091 |
+ # Grab the patches |
4092 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack |
4093 |
+ |
4094 |
+ mv -f "${WORKDIR%/}/${P}" "${S}" || die |
4095 |
+} |
4096 |
+ |
4097 |
+src_prepare() { |
4098 |
+ _disable_engine() { |
4099 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
4100 |
+ } |
4101 |
+ |
4102 |
+ _disable_plugin() { |
4103 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
4104 |
+ } |
4105 |
+ |
4106 |
+ if use tcmalloc; then |
4107 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die |
4108 |
+ fi |
4109 |
+ |
4110 |
+ # Don't build bundled xz-utils for tokudb |
4111 |
+ echo > "${S%/}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die |
4112 |
+ sed -i -e 's/ build_lzma//' "${S%/}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die |
4113 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/ft-index/portability/CMakeLists.txt" || die |
4114 |
+ |
4115 |
+ local plugin |
4116 |
+ local server_plugins=( handler_socket auth_socket feedback qc_info server_audit semisync sql_errlog ) |
4117 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext ) |
4118 |
+ if ! use server; then # These plugins are for the server |
4119 |
+ for plugin in "${server_plugins[@]}" ; do |
4120 |
+ _disable_plugin "${plugin}" |
4121 |
+ done |
4122 |
+ fi |
4123 |
+ |
4124 |
+ if ! use test; then # These plugins are only used during testing |
4125 |
+ for plugin in "${test_plugins[@]}" ; do |
4126 |
+ _disable_plugin "${plugin}" |
4127 |
+ done |
4128 |
+ fi |
4129 |
+ |
4130 |
+ # Collides with mariadb-connector-c bug 655980 |
4131 |
+ _disable_plugin auth_dialog |
4132 |
+ |
4133 |
+ # Don't build example |
4134 |
+ _disable_engine example |
4135 |
+ |
4136 |
+ if ! use oqgraph ; then # avoids extra library checks |
4137 |
+ _disable_engine oqgraph |
4138 |
+ fi |
4139 |
+ |
4140 |
+ cmake-utils_src_prepare |
4141 |
+} |
4142 |
+ |
4143 |
+src_configure(){ |
4144 |
+ # bug 508724 mariadb cannot use ld.gold |
4145 |
+ tc-ld-disable-gold |
4146 |
+ # Bug #114895, bug #110149 |
4147 |
+ filter-flags "-O" "-O[01]" |
4148 |
+ |
4149 |
+ append-cxxflags -felide-constructors |
4150 |
+ |
4151 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
4152 |
+ append-flags -fno-strict-aliasing |
4153 |
+ |
4154 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
4155 |
+ |
4156 |
+ # debug hack wrt #497532 |
4157 |
+ mycmakeargs=( |
4158 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
4159 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
4160 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr" |
4161 |
+ -DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql" |
4162 |
+ -DINSTALL_BINDIR=bin |
4163 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
4164 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
4165 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
4166 |
+ -DINSTALL_INFODIR=share/info |
4167 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
4168 |
+ -DINSTALL_MANDIR=share/man |
4169 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
4170 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
4171 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
4172 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql" |
4173 |
+ -DINSTALL_SBINDIR=sbin |
4174 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mariadb" |
4175 |
+ -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" |
4176 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
4177 |
+ -DWITH_ZLIB=system |
4178 |
+ -DENABLED_LOCAL_INFILE=1 |
4179 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
4180 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX%/}/var/run/mysqld/mysqld.sock" |
4181 |
+ # The build forces this to be defined when cross-compiling. We pass it |
4182 |
+ # all the time for simplicity and to make sure it is actually correct. |
4183 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
4184 |
+ -DWITHOUT_CLIENTLIBS=YES |
4185 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
4186 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
4187 |
+ -DENABLE_DTRACE=$(usex systemtap) |
4188 |
+ ) |
4189 |
+ if use test ; then |
4190 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
4191 |
+ else |
4192 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
4193 |
+ fi |
4194 |
+ |
4195 |
+ if ! use yassl ; then |
4196 |
+ mycmakeargs+=( -DWITH_SSL=system ) |
4197 |
+ else |
4198 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
4199 |
+ fi |
4200 |
+ |
4201 |
+ if use server ; then |
4202 |
+ |
4203 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
4204 |
+ if ! use extraengine ; then |
4205 |
+ mycmakeargs+=( |
4206 |
+ -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 |
4207 |
+ -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 ) |
4208 |
+ fi |
4209 |
+ |
4210 |
+ mycmakeargs+=( |
4211 |
+ -DWITH_JEMALLOC=$(usex jemalloc system) |
4212 |
+ -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1 |
4213 |
+ -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1 |
4214 |
+ -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1 |
4215 |
+ -DINSTALL_SQLBENCHDIR=share/mariadb |
4216 |
+ ) |
4217 |
+ |
4218 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
4219 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
4220 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
4221 |
+ ewarn "You MUST file bugs without these variables set." |
4222 |
+ |
4223 |
+ mycmakeargs+=( |
4224 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
4225 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
4226 |
+ ) |
4227 |
+ |
4228 |
+ elif ! use latin1 ; then |
4229 |
+ mycmakeargs+=( |
4230 |
+ -DDEFAULT_CHARSET=utf8 |
4231 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
4232 |
+ ) |
4233 |
+ else |
4234 |
+ mycmakeargs+=( |
4235 |
+ -DDEFAULT_CHARSET=latin1 |
4236 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
4237 |
+ ) |
4238 |
+ fi |
4239 |
+ mycmakeargs+=( |
4240 |
+ -DEXTRA_CHARSETS=all |
4241 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
4242 |
+ -DWITH_EMBEDDED_SERVER=OFF |
4243 |
+ -DENABLED_PROFILING=$(usex profiling) |
4244 |
+ ) |
4245 |
+ |
4246 |
+ if use static; then |
4247 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
4248 |
+ fi |
4249 |
+ |
4250 |
+ if use jemalloc || use tcmalloc ; then |
4251 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
4252 |
+ fi |
4253 |
+ |
4254 |
+ # Storage engines |
4255 |
+ mycmakeargs+=( |
4256 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
4257 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
4258 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
4259 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
4260 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
4261 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
4262 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
4263 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
4264 |
+ ) |
4265 |
+ |
4266 |
+ else |
4267 |
+ mycmakeargs+=( |
4268 |
+ -DWITHOUT_SERVER=1 |
4269 |
+ -DEXTRA_CHARSETS=none |
4270 |
+ -DINSTALL_SQLBENCHDIR= |
4271 |
+ ) |
4272 |
+ fi |
4273 |
+ |
4274 |
+ cmake-utils_src_configure |
4275 |
+} |
4276 |
+ |
4277 |
+src_compile() { |
4278 |
+ cmake-utils_src_compile |
4279 |
+} |
4280 |
+ |
4281 |
+src_install() { |
4282 |
+ cmake-utils_src_install |
4283 |
+ |
4284 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
4285 |
+ if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then |
4286 |
+ rm "${ED%/}/usr/include/mysql/server/private/config.h" || die |
4287 |
+ fi |
4288 |
+ |
4289 |
+ # Make sure the vars are correctly initialized |
4290 |
+ mysql_init_vars |
4291 |
+ |
4292 |
+ # Convenience links |
4293 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
4294 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
4295 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
4296 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
4297 |
+ |
4298 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
4299 |
+ if [[ -d "${ED%/}/usr/data" ]] ; then |
4300 |
+ rm -Rf "${ED%/}/usr/data" || die |
4301 |
+ fi |
4302 |
+ |
4303 |
+ # Unless they explicitly specific USE=test, then do not install the |
4304 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
4305 |
+ # validation of your database configuration after tuning it. |
4306 |
+ if ! use test ; then |
4307 |
+ rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" |
4308 |
+ fi |
4309 |
+ |
4310 |
+ # Configuration stuff |
4311 |
+ einfo "Building default configuration ..." |
4312 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
4313 |
+ [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf |
4314 |
+ local mycnf_src="my.cnf-5.5" |
4315 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
4316 |
+ "${FILESDIR%/}/${mycnf_src}" \ |
4317 |
+ > "${TMPDIR%/}/my.cnf.ok" || die |
4318 |
+ use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok" |
4319 |
+ if use latin1 ; then |
4320 |
+ sed -i \ |
4321 |
+ -e "/character-set/s|utf8|latin1|g" \ |
4322 |
+ "${TMPDIR%/}/my.cnf.ok" || die |
4323 |
+ fi |
4324 |
+ eprefixify "${TMPDIR%/}/my.cnf.ok" |
4325 |
+ newins "${TMPDIR}/my.cnf.ok" my.cnf |
4326 |
+ |
4327 |
+ if use server ; then |
4328 |
+ einfo "Including support files and sample configurations" |
4329 |
+ docinto "support-files" |
4330 |
+ local script |
4331 |
+ for script in \ |
4332 |
+ "${S%/}"/support-files/magic |
4333 |
+ do |
4334 |
+ [[ -f "$script" ]] && dodoc "${script}" |
4335 |
+ done |
4336 |
+ |
4337 |
+ docinto "scripts" |
4338 |
+ for script in "${S%/}"/scripts/mysql* ; do |
4339 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
4340 |
+ done |
4341 |
+ # Manually install supporting files that conflict with other packages |
4342 |
+ # but are needed for galera and initial installation |
4343 |
+ exeinto /usr/libexec/mariadb |
4344 |
+ doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" |
4345 |
+ fi |
4346 |
+ |
4347 |
+ #Remove mytop if perl is not selected |
4348 |
+ [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop" |
4349 |
+} |
4350 |
+ |
4351 |
+# Official test instructions: |
4352 |
+# USE='extraengine perl server' \ |
4353 |
+# FEATURES='test userpriv -usersandbox' \ |
4354 |
+# ebuild mariadb-X.X.XX.ebuild \ |
4355 |
+# digest clean package |
4356 |
+src_test() { |
4357 |
+ |
4358 |
+ _disable_test() { |
4359 |
+ local rawtestname reason |
4360 |
+ rawtestname="${1}" ; shift |
4361 |
+ reason="${@}" |
4362 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
4363 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
4364 |
+ } |
4365 |
+ |
4366 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
4367 |
+ local retstatus_unit |
4368 |
+ local retstatus_tests |
4369 |
+ |
4370 |
+ if ! use server ; then |
4371 |
+ einfo "Skipping server tests due to minimal build." |
4372 |
+ return 0 |
4373 |
+ fi |
4374 |
+ |
4375 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
4376 |
+ # localhost. Also causes weird failures. |
4377 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
4378 |
+ |
4379 |
+ if [[ $UID -eq 0 ]]; then |
4380 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
4381 |
+ fi |
4382 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
4383 |
+ |
4384 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
4385 |
+ |
4386 |
+ # Run CTest (test-units) |
4387 |
+ cmake-utils_src_test |
4388 |
+ retstatus_unit=$? |
4389 |
+ |
4390 |
+ # Ensure that parallel runs don't die |
4391 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
4392 |
+ # Enable parallel testing, auto will try to detect number of cores |
4393 |
+ # You may set this by hand. |
4394 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
4395 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
4396 |
+ |
4397 |
+ # create directories because mysqladmin might run out of order |
4398 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
4399 |
+ |
4400 |
+ # Run mysql tests |
4401 |
+ pushd "${TESTDIR}" > /dev/null || die |
4402 |
+ |
4403 |
+ touch "${T}/disabled.def" |
4404 |
+ # These are failing in MariaDB 5.5 for now and are believed to be |
4405 |
+ # false positives: |
4406 |
+ # |
4407 |
+ # main.information_schema, binlog.binlog_statement_insert_delayed, |
4408 |
+ # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql, |
4409 |
+ # funcs_1.is_columns_mysql |
4410 |
+ # fails due to USE=-latin1 / utf8 default |
4411 |
+ # |
4412 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock: |
4413 |
+ # segfaults at random under Portage only, suspect resource limits. |
4414 |
+ # |
4415 |
+ # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam |
4416 |
+ # fails due to bad cleanup of previous tests when run in parallel |
4417 |
+ # The tool is deprecated anyway |
4418 |
+ # Bug 532288 |
4419 |
+ |
4420 |
+ local t |
4421 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
4422 |
+ binlog.binlog_statement_insert_delayed main.information_schema \ |
4423 |
+ main.mysqld--help \ |
4424 |
+ archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \ |
4425 |
+ funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do |
4426 |
+ _disable_test "$t" "False positives in Gentoo" |
4427 |
+ done |
4428 |
+ |
4429 |
+ if ! use client-libs ; then |
4430 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
4431 |
+ fi |
4432 |
+ |
4433 |
+ # run mysql-test tests |
4434 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
4435 |
+ retstatus_tests=$? |
4436 |
+ |
4437 |
+ popd > /dev/null || die |
4438 |
+ |
4439 |
+ # Cleanup is important for these testcases. |
4440 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
4441 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
4442 |
+ |
4443 |
+ local failures="" |
4444 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
4445 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
4446 |
+ |
4447 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
4448 |
+ einfo "Tests successfully completed" |
4449 |
+} |
4450 |
+ |
4451 |
+mysql_init_vars() { |
4452 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
4453 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
4454 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
4455 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
4456 |
+ |
4457 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
4458 |
+ MY_DATADIR="" |
4459 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
4460 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
4461 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
4462 |
+ | tail -n1` |
4463 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
4464 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
4465 |
+ | sed -e 's/.*=\s*//' \ |
4466 |
+ | tail -n1` |
4467 |
+ fi |
4468 |
+ fi |
4469 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
4470 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
4471 |
+ einfo "Using default MY_DATADIR" |
4472 |
+ fi |
4473 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
4474 |
+ |
4475 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
4476 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
4477 |
+ # If you get this and you're wondering about it, see bug #207636 |
4478 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
4479 |
+ elog "A new one will not be created." |
4480 |
+ PREVIOUS_DATADIR="yes" |
4481 |
+ else |
4482 |
+ PREVIOUS_DATADIR="no" |
4483 |
+ fi |
4484 |
+ export PREVIOUS_DATADIR |
4485 |
+ fi |
4486 |
+ else |
4487 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
4488 |
+ local new_MY_DATADIR |
4489 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
4490 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
4491 |
+ | tail -n1` |
4492 |
+ |
4493 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
4494 |
+ ewarn "MySQL MY_DATADIR has changed" |
4495 |
+ ewarn "from ${MY_DATADIR}" |
4496 |
+ ewarn "to ${new_MY_DATADIR}" |
4497 |
+ MY_DATADIR="${new_MY_DATADIR}" |
4498 |
+ fi |
4499 |
+ fi |
4500 |
+ fi |
4501 |
+ |
4502 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
4503 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
4504 |
+ export MY_DATADIR |
4505 |
+} |
4506 |
+ |
4507 |
+pkg_config() { |
4508 |
+ _getoptval() { |
4509 |
+ local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults |
4510 |
+ local section="$1" |
4511 |
+ local flag="--${2}=" |
4512 |
+ local extra_options="${3}" |
4513 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
4514 |
+ } |
4515 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
4516 |
+ local old_HOME="${HOME}" |
4517 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
4518 |
+ export HOME=${EPREFIX}/root |
4519 |
+ |
4520 |
+ # Make sure the vars are correctly initialized |
4521 |
+ mysql_init_vars |
4522 |
+ |
4523 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
4524 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
4525 |
+ die "Minimal builds do NOT include the MySQL server" |
4526 |
+ fi |
4527 |
+ |
4528 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
4529 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
4530 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
4531 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
4532 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
4533 |
+ |
4534 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
4535 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
4536 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
4537 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
4538 |
+ else |
4539 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
4540 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
4541 |
+ || die "Moving MY_DATADIR failed" |
4542 |
+ fi |
4543 |
+ else |
4544 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
4545 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
4546 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
4547 |
+ else |
4548 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
4549 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
4550 |
+ fi |
4551 |
+ fi |
4552 |
+ fi |
4553 |
+ |
4554 |
+ local pwd1="a" |
4555 |
+ local pwd2="b" |
4556 |
+ local maxtry=15 |
4557 |
+ |
4558 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
4559 |
+ local tmp_mysqld_password_source= |
4560 |
+ |
4561 |
+ for tmp_mysqld_password_source in mysql client; do |
4562 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
4563 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
4564 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
4565 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
4566 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
4567 |
+ MYSQL_ROOT_PASSWORD= |
4568 |
+ continue |
4569 |
+ fi |
4570 |
+ |
4571 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
4572 |
+ break |
4573 |
+ fi |
4574 |
+ done |
4575 |
+ |
4576 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
4577 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
4578 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
4579 |
+ fi |
4580 |
+ |
4581 |
+ unset tmp_mysqld_password_source |
4582 |
+ fi |
4583 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n 1)" |
4584 |
+ # These are dir+prefix |
4585 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n 1)" |
4586 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
4587 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n 1)" |
4588 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
4589 |
+ |
4590 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
4591 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
4592 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
4593 |
+ fi |
4594 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
4595 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
4596 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
4597 |
+ fi |
4598 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
4599 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
4600 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
4601 |
+ fi |
4602 |
+ |
4603 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
4604 |
+ ewarn "You have already a MySQL database in place." |
4605 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
4606 |
+ ewarn "Please rename or delete it if you wish to replace it." |
4607 |
+ die "MySQL database already exists!" |
4608 |
+ fi |
4609 |
+ |
4610 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
4611 |
+ # localhost. Also causes weird failures. |
4612 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
4613 |
+ |
4614 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
4615 |
+ |
4616 |
+ einfo "Please provide a password for the mysql 'root' user now" |
4617 |
+ einfo "or through the ${HOME}/.my.cnf file." |
4618 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
4619 |
+ read -rsp " >" pwd1 ; echo |
4620 |
+ |
4621 |
+ einfo "Retype the password" |
4622 |
+ read -rsp " >" pwd2 ; echo |
4623 |
+ |
4624 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
4625 |
+ die "Passwords are not the same" |
4626 |
+ fi |
4627 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
4628 |
+ unset pwd1 pwd2 |
4629 |
+ fi |
4630 |
+ |
4631 |
+ local options |
4632 |
+ local sqltmp="$(emktemp)" |
4633 |
+ |
4634 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
4635 |
+ # see https://bugs.mysql.com/bug.php?id=31312 |
4636 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
4637 |
+ |
4638 |
+ # Figure out which options we need to disable to do the setup |
4639 |
+ local helpfile="${TMPDIR}/mysqld-help" |
4640 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
4641 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
4642 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
4643 |
+ log-slave-updates \ |
4644 |
+ ; do |
4645 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
4646 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
4647 |
+ done |
4648 |
+ |
4649 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
4650 |
+ |
4651 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
4652 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
4653 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
4654 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
4655 |
+ fi |
4656 |
+ |
4657 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
4658 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
4659 |
+ fi |
4660 |
+ |
4661 |
+ pushd "${TMPDIR}" &>/dev/null || die |
4662 |
+ |
4663 |
+ # Filling timezones, see |
4664 |
+ # https://dev.mysql.com/doc/mysql/en/time-zone-support.html |
4665 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
4666 |
+ |
4667 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
4668 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
4669 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
4670 |
+ einfo "Command: ${cmd[*]}" |
4671 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
4672 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
4673 |
+ if [ $? -ne 0 ]; then |
4674 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
4675 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
4676 |
+ fi |
4677 |
+ popd &>/dev/null || die |
4678 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
4679 |
+ || die "MySQL databases not installed" |
4680 |
+ |
4681 |
+ use prefix || options="${options} --user=mysql" |
4682 |
+ |
4683 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
4684 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
4685 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
4686 |
+ ${options} \ |
4687 |
+ --log-warnings=0 \ |
4688 |
+ --basedir=${EROOT}/usr \ |
4689 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
4690 |
+ --max_allowed_packet=8M \ |
4691 |
+ --net_buffer_length=16K \ |
4692 |
+ --socket=${socket} \ |
4693 |
+ --pid-file=${pidfile} \ |
4694 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
4695 |
+ #einfo "About to start mysqld: ${mysqld}" |
4696 |
+ ebegin "Starting mysqld" |
4697 |
+ einfo "Command ${mysqld}" |
4698 |
+ ${mysqld} & |
4699 |
+ rc=$? |
4700 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
4701 |
+ maxtry=$((${maxtry}-1)) |
4702 |
+ echo -n "." |
4703 |
+ sleep 1 |
4704 |
+ done |
4705 |
+ eend $rc |
4706 |
+ |
4707 |
+ if ! [[ -S "${socket}" ]]; then |
4708 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
4709 |
+ fi |
4710 |
+ |
4711 |
+ ebegin "Setting root password" |
4712 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
4713 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
4714 |
+ "${EROOT}/usr/bin/mysql" \ |
4715 |
+ "--socket=${socket}" \ |
4716 |
+ -hlocalhost \ |
4717 |
+ -e "${sql}" |
4718 |
+ eend $? |
4719 |
+ |
4720 |
+ if [[ -n "${sqltmp}" ]] ; then |
4721 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
4722 |
+ "${EROOT}/usr/bin/mysql" \ |
4723 |
+ "--socket=${socket}" \ |
4724 |
+ -hlocalhost \ |
4725 |
+ -uroot \ |
4726 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
4727 |
+ mysql < "${sqltmp}" |
4728 |
+ rc=$? |
4729 |
+ eend $? |
4730 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
4731 |
+ fi |
4732 |
+ |
4733 |
+ # Stop the server and cleanup |
4734 |
+ einfo "Stopping the server ..." |
4735 |
+ kill $(< "${pidfile}" ) |
4736 |
+ rm -f "${sqltmp}" |
4737 |
+ wait %1 |
4738 |
+ einfo "Done" |
4739 |
+} |