1 |
commit: b798f9d94a2815372040ffff148151750edb879c |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 9 01:18:21 2018 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 9 01:18:21 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b798f9d9 |
7 |
|
8 |
dev-db/mariadb: Version bump for 10.3.8 |
9 |
|
10 |
Package-Manager: Portage-2.3.41, Repoman-2.3.9 |
11 |
|
12 |
dev-db/mariadb/Manifest | 1 + |
13 |
dev-db/mariadb/mariadb-10.3.8.ebuild | 960 +++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 961 insertions(+) |
15 |
|
16 |
diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest |
17 |
index a922815d264..04feea790e3 100644 |
18 |
--- a/dev-db/mariadb/Manifest |
19 |
+++ b/dev-db/mariadb/Manifest |
20 |
@@ -8,6 +8,7 @@ DIST mariadb-10.1.34.tar.gz 65298561 BLAKE2B 3f3af7b8bad68a08f69befd3f3e7bd88b8c |
21 |
DIST mariadb-10.2.15.tar.gz 73329750 BLAKE2B e588f54d1b8807df1a57b87831294c70a7d21ed73bba96487a091338ee94855c2b796c939057546b9437b2caf96600ef6f7e111557249adaa9e18795a5a35ade SHA512 7702af8787973b15784dc8a89f9d56765725a420e2e68f1924b67c88c134c7d83d3249dddd16707fa9e5f05ed747f813f16feefbb477e999a6698b1dcfb5a88f |
22 |
DIST mariadb-10.3.6.tar.gz 71064269 BLAKE2B 681150a26de95cc276276a9b8d0b2c6e4a842dac80f20c2e8b0caeec5823cb956feffb494d18b1f2832e220c392c437424813de7720fb83a5d5c1fca71a4aef9 SHA512 cf146752be5857e702a3c88f42c7b6be3117bd92ac304eb217f902c1ffe478dc3043d3cf6a9a9305b51babb3bafc2612a8e4f5dfa7731cfa53634014d86438d1 |
23 |
DIST mariadb-10.3.7.tar.gz 71816160 BLAKE2B 213cfe2999b48c088e08e8289a6243d79b91e465fce51850a253a121896f69df03f935940f25ac290e15e29f97b3a16f75711044b8986f6ec3841ef8beafa0b4 SHA512 b1b3ad9ddc45bdfd3d03888ba160f9991b23187341deac402d5dc4b735511e29767a5dc64ca557bea9bf3d3b413b941ef2e1f5fa30be056dfaec4542a43895f1 |
24 |
+DIST mariadb-10.3.8.tar.gz 72152953 BLAKE2B 4742be1d533c7958b61efd430411a1e7390faffc25ceccc09c736647fb263dc3797064725335abf17f9362c7a92293ea5fc72bc2ddd70636f83c25e35c4c83aa SHA512 e1b61900a06fa57992a2f8516771f5fb98799ed5a4bbe74f858c0fe87b907cc6b600942d6fe97b6064cb39b610a7213cb3bc9634a336f9ebffe11dfe67746422 |
25 |
DIST mariadb-5.5.60.tar.gz 45822878 BLAKE2B 150a2d7108db2db18d66b56d961b05f8746f744e9453e341fde21f93bd846a3091a44c5df3baed6774d0ad12b8dc806b9bfdd177b4149f5be9d37af2a298f807 SHA512 eacf6ec57d46b00701b5038a67745174060d592b0e425466149c9a1b6dc1ac0659a36e57e82bf7e9f7865d8eac3dd50d0737630bd6220002d168b5b574437e4c |
26 |
DIST mysql-extras-20160721-1526Z.tar.bz2 301788 BLAKE2B 23ef75d0122e9e18382f708a86c61624e0437fad593b7f02ccb2b3939d710404e18e3b70617ed400e5f6947d3a92d2867a5f7d98bf61597442e99989f60ca4f7 SHA512 c7450039780e4e2684c932ba7c291c1de25dd1a64e4c6e88aa13b790768b4100955f36ae4a3bf983569ea23b43be02da6dad3d5985c1163ec9e8aa91f0efd85d |
27 |
DIST mysql-extras-20170926-1321Z.tar.bz2 312466 BLAKE2B 3e3e19a905961570cea9c1eb14dec3780da80409e996b1aeddb08625da875f5d08798a862cb1b80566b0d8be0d9ec2aab0a390ca90f991203c9871538b11f00a SHA512 556e782ccc40d8cffb2fde8c46038c90023440c07785ec667f898afdb8c802faeb4dbfe8b3918a1e563b46d1dc8c0de1172f7843ce08ee1ded435b344f8f0cf5 |
28 |
|
29 |
diff --git a/dev-db/mariadb/mariadb-10.3.8.ebuild b/dev-db/mariadb/mariadb-10.3.8.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..b1c9bd25b6d |
32 |
--- /dev/null |
33 |
+++ b/dev-db/mariadb/mariadb-10.3.8.ebuild |
34 |
@@ -0,0 +1,960 @@ |
35 |
+# Copyright 1999-2018 Gentoo Foundation |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI="6" |
39 |
+MY_EXTRAS_VER="20180529-0042Z" |
40 |
+SUBSLOT="18" |
41 |
+ |
42 |
+JAVA_PKG_OPT_USE="jdbc" |
43 |
+ |
44 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
45 |
+ |
46 |
+inherit eutils systemd flag-o-matic prefix toolchain-funcs \ |
47 |
+ java-pkg-opt-2 user cmake-utils multilib-build |
48 |
+ |
49 |
+SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz " |
50 |
+ |
51 |
+# Gentoo patches to MySQL |
52 |
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then |
53 |
+ SRC_URI="${SRC_URI} |
54 |
+ mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
55 |
+ https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
56 |
+ https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
57 |
+ https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2 |
58 |
+ https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2" |
59 |
+fi |
60 |
+ |
61 |
+HOMEPAGE="http://mariadb.org/" |
62 |
+DESCRIPTION="An enhanced, drop-in replacement for MySQL" |
63 |
+LICENSE="GPL-2 LGPL-2.1+" |
64 |
+SLOT="0/${SUBSLOT:-0}" |
65 |
+IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 |
66 |
+ innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga |
67 |
+ numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx |
68 |
+ sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc |
69 |
+ test tokudb xml yassl" |
70 |
+ |
71 |
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests |
72 |
+RESTRICT="!bindist? ( bindist ) libressl? ( test )" |
73 |
+ |
74 |
+REQUIRED_USE="jdbc? ( extraengine server !static ) |
75 |
+ server? ( tokudb? ( jemalloc !tcmalloc ) ) |
76 |
+ ?? ( tcmalloc jemalloc ) |
77 |
+ static? ( yassl !pam )" |
78 |
+ |
79 |
+# REMEMBER: also update eclass/mysql*.eclass before committing! |
80 |
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" |
81 |
+ |
82 |
+# Shorten the path because the socket path length must be shorter than 107 chars |
83 |
+# and we will run a mysql server during test phase |
84 |
+S="${WORKDIR}/mysql" |
85 |
+ |
86 |
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then |
87 |
+ inherit git-r3 |
88 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git" |
89 |
+ EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras" |
90 |
+ EGIT_CLONE_TYPE=shallow |
91 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras" |
92 |
+else |
93 |
+ MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}" |
94 |
+fi |
95 |
+ |
96 |
+PATCHES=( |
97 |
+ "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch |
98 |
+ "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.16-without-clientlibs-tools.patch |
99 |
+ "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch |
100 |
+ "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch |
101 |
+ "${MY_PATCH_DIR}"/20035_all_mariadb-10.3-atomic-detection.patch |
102 |
+) |
103 |
+ |
104 |
+# Be warned, *DEPEND are version-dependant |
105 |
+# These are used for both runtime and compiletime |
106 |
+# MULTILIB_USEDEP only set for libraries used by the client library |
107 |
+COMMON_DEPEND=" |
108 |
+ kernel_linux? ( |
109 |
+ sys-process/procps:0= |
110 |
+ dev-libs/libaio:0= |
111 |
+ ) |
112 |
+ >=sys-apps/sed-4 |
113 |
+ >=sys-apps/texinfo-4.7-r1 |
114 |
+ jemalloc? ( dev-libs/jemalloc:0= ) |
115 |
+ tcmalloc? ( dev-util/google-perftools:0= ) |
116 |
+ systemtap? ( >=dev-util/systemtap-1.3:0= ) |
117 |
+ >=sys-libs/zlib-1.2.3:0= |
118 |
+ kerberos? ( virtual/krb5 ) |
119 |
+ yassl? ( net-libs/gnutls:0= ) |
120 |
+ !yassl? ( |
121 |
+ !libressl? ( >=dev-libs/openssl-1.0.0:0= ) |
122 |
+ libressl? ( dev-libs/libressl:0= ) |
123 |
+ ) |
124 |
+ sys-libs/ncurses:0= |
125 |
+ !bindist? ( |
126 |
+ sys-libs/binutils-libs:0= |
127 |
+ >=sys-libs/readline-4.1:0= |
128 |
+ ) |
129 |
+ server? ( |
130 |
+ backup? ( app-arch/libarchive:0= ) |
131 |
+ cracklib? ( sys-libs/cracklib:0= ) |
132 |
+ extraengine? ( |
133 |
+ odbc? ( dev-db/unixODBC:0= ) |
134 |
+ xml? ( dev-libs/libxml2:2= ) |
135 |
+ ) |
136 |
+ innodb-lz4? ( app-arch/lz4 ) |
137 |
+ innodb-lzo? ( dev-libs/lzo ) |
138 |
+ innodb-snappy? ( app-arch/snappy ) |
139 |
+ mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) |
140 |
+ numa? ( sys-process/numactl ) |
141 |
+ oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) |
142 |
+ pam? ( virtual/pam:0= ) |
143 |
+ systemd? ( sys-apps/systemd:= ) |
144 |
+ tokudb? ( app-arch/snappy ) |
145 |
+ ) |
146 |
+ >=dev-libs/libpcre-8.41-r1:3= |
147 |
+ dev-db/mariadb-connector-c[${MULTILIB_USEDEP},static-libs?] dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] |
148 |
+" |
149 |
+DEPEND="virtual/yacc |
150 |
+ static? ( sys-libs/ncurses[static-libs] ) |
151 |
+ || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) |
152 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) ) |
153 |
+ ${COMMON_DEPEND}" |
154 |
+RDEPEND="selinux? ( sec-policy/selinux-mysql ) |
155 |
+ !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster |
156 |
+ server? ( !prefix? ( dev-db/mysql-init-scripts ) ) |
157 |
+ !<virtual/mysql-5.6-r11 |
158 |
+ ${COMMON_DEPEND} |
159 |
+ server? ( galera? ( |
160 |
+ sys-apps/iproute2 |
161 |
+ =sys-cluster/galera-25* |
162 |
+ sst-rsync? ( sys-process/lsof ) |
163 |
+ sst-mariabackup? ( net-misc/socat[ssl] ) |
164 |
+ sst-xtrabackup? ( net-misc/socat[ssl] ) |
165 |
+ ) ) |
166 |
+ perl? ( !dev-db/mytop |
167 |
+ virtual/perl-Getopt-Long |
168 |
+ dev-perl/TermReadKey |
169 |
+ virtual/perl-Term-ANSIColor |
170 |
+ virtual/perl-Time-HiRes ) |
171 |
+ server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) ) |
172 |
+" |
173 |
+# For other stuff to bring us in |
174 |
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL |
175 |
+# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed |
176 |
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) |
177 |
+ server? ( ~virtual/mysql-5.6[static=] |
178 |
+ galera? ( sst-xtrabackup? ( || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )" |
179 |
+ |
180 |
+pkg_setup() { |
181 |
+ if [[ ${MERGE_TYPE} != binary ]] ; then |
182 |
+ local GCC_MAJOR_SET=$(gcc-major-version) |
183 |
+ local GCC_MINOR_SET=$(gcc-minor-version) |
184 |
+ if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
185 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
186 |
+ eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
187 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
188 |
+ die |
189 |
+ fi |
190 |
+ # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on |
191 |
+ # non x86{,_64} arches |
192 |
+ if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
193 |
+ ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
194 |
+ eerror "${PN} needs to be built with gcc-4.7 or later." |
195 |
+ eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
196 |
+ die |
197 |
+ fi |
198 |
+ fi |
199 |
+ java-pkg-opt-2_pkg_setup |
200 |
+ if has test ${FEATURES} && \ |
201 |
+ use server && ! has userpriv ${FEATURES} ; then |
202 |
+ eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
203 |
+ fi |
204 |
+ |
205 |
+ # This should come after all of the die statements |
206 |
+ enewgroup mysql 60 || die "problem adding 'mysql' group" |
207 |
+ enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user" |
208 |
+} |
209 |
+ |
210 |
+pkg_preinst() { |
211 |
+ java-pkg-opt-2_pkg_preinst |
212 |
+ |
213 |
+ # Here we need to see if the implementation switched client libraries |
214 |
+ # We check if this is a new instance of the package and a client library already exists |
215 |
+ local SHOW_ABI_MESSAGE libpath |
216 |
+ if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then |
217 |
+ libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so") |
218 |
+ elog "Due to ABI changes when switching between different client libraries," |
219 |
+ elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." |
220 |
+ elog "Please run: revdep-rebuild --library ${libpath}" |
221 |
+ ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" |
222 |
+ fi |
223 |
+} |
224 |
+ |
225 |
+pkg_postinst() { |
226 |
+ # Make sure the vars are correctly initialized |
227 |
+ mysql_init_vars |
228 |
+ |
229 |
+ # Create log directory securely if it does not exist |
230 |
+ [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}" |
231 |
+ |
232 |
+ if use server ; then |
233 |
+ if use pam; then |
234 |
+ einfo |
235 |
+ elog "This install includes the PAM authentication plugin." |
236 |
+ elog "To activate and configure the PAM plugin, please read:" |
237 |
+ elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" |
238 |
+ einfo |
239 |
+ fi |
240 |
+ |
241 |
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then |
242 |
+ einfo |
243 |
+ elog "You might want to run:" |
244 |
+ elog "\"emerge --config =${CATEGORY}/${PF}\"" |
245 |
+ elog "if this is a new install." |
246 |
+ elog |
247 |
+ elog "If you are switching server implentations, you should run the" |
248 |
+ elog "mysql_upgrade tool." |
249 |
+ einfo |
250 |
+ else |
251 |
+ einfo |
252 |
+ elog "If you are upgrading major versions, you should run the" |
253 |
+ elog "mysql_upgrade tool." |
254 |
+ einfo |
255 |
+ fi |
256 |
+ |
257 |
+ if use galera ; then |
258 |
+ einfo |
259 |
+ elog "Be sure to edit the my.cnf file to activate your cluster settings." |
260 |
+ elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
261 |
+ elog "The first time the cluster is activated, you should add" |
262 |
+ elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." |
263 |
+ elog "This option should then be removed for subsequent starts." |
264 |
+ einfo |
265 |
+ fi |
266 |
+ fi |
267 |
+ |
268 |
+ # Note about configuration change |
269 |
+ einfo |
270 |
+ elog "This version of mariadb reorganizes the configuration from a single my.cnf" |
271 |
+ elog "to several files in /etc/mysql/${PN}.d." |
272 |
+ elog "Please backup any changes you made to /etc/mysql/my.cnf" |
273 |
+ elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." |
274 |
+ elog "You may have as many files as needed and they are read alphabetically." |
275 |
+ elog "Be sure the options have the appropitate section headers, i.e. [mysqld]." |
276 |
+ einfo |
277 |
+} |
278 |
+ |
279 |
+src_unpack() { |
280 |
+ |
281 |
+ # Initialize the proper variables first |
282 |
+ mysql_init_vars |
283 |
+ |
284 |
+ unpack ${A} |
285 |
+ # Grab the patches |
286 |
+ [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack |
287 |
+ |
288 |
+ mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die |
289 |
+} |
290 |
+ |
291 |
+src_prepare() { |
292 |
+ _disable_plugin() { |
293 |
+ echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die |
294 |
+ } |
295 |
+ _disable_engine() { |
296 |
+ echo > "${S%/}/storage/${1}/CMakeLists.txt" || die |
297 |
+ } |
298 |
+ |
299 |
+ java-pkg-opt-2_src_prepare |
300 |
+ if use tcmalloc; then |
301 |
+ echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" |
302 |
+ fi |
303 |
+ |
304 |
+ # Don't build bundled xz-utils for tokudb |
305 |
+ echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die |
306 |
+ sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die |
307 |
+ sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die |
308 |
+ |
309 |
+ local plugin |
310 |
+ local server_plugins=( handler_socket auth_socket feedback metadata_lock_info |
311 |
+ locale_info qc_info server_audit sql_errlog ) |
312 |
+ local test_plugins=( audit_null auth_examples daemon_example fulltext |
313 |
+ debug_key_management example_key_management versioning ) |
314 |
+ if ! use server; then # These plugins are for the server |
315 |
+ for plugin in "${server_plugins[@]}" ; do |
316 |
+ _disable_plugin "${plugin}" |
317 |
+ done |
318 |
+ fi |
319 |
+ |
320 |
+ if ! use test; then # These plugins are only used during testing |
321 |
+ for plugin in "${test_plugins[@]}" ; do |
322 |
+ _disable_plugin "${plugin}" |
323 |
+ done |
324 |
+ _disable_engine test_sql_discovery |
325 |
+ fi |
326 |
+ |
327 |
+ _disable_engine example |
328 |
+ |
329 |
+ if ! use oqgraph ; then # avoids extra library checks |
330 |
+ _disable_engine oqgraph |
331 |
+ fi |
332 |
+ |
333 |
+ if use mroonga ; then |
334 |
+ # Remove the bundled groonga |
335 |
+ # There is no CMake flag, it simply checks for existance |
336 |
+ rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
337 |
+ else |
338 |
+ _disable_engine mroonga |
339 |
+ fi |
340 |
+ |
341 |
+ cmake-utils_src_prepare |
342 |
+} |
343 |
+ |
344 |
+src_configure(){ |
345 |
+ # bug 508724 mariadb cannot use ld.gold |
346 |
+ tc-ld-disable-gold |
347 |
+ # Bug #114895, bug #110149 |
348 |
+ filter-flags "-O" "-O[01]" |
349 |
+ |
350 |
+ append-cxxflags -felide-constructors |
351 |
+ |
352 |
+ # bug #283926, with GCC4.4, this is required to get correct behavior. |
353 |
+ append-flags -fno-strict-aliasing |
354 |
+ |
355 |
+ CMAKE_BUILD_TYPE="RelWithDebInfo" |
356 |
+ |
357 |
+ # debug hack wrt #497532 |
358 |
+ mycmakeargs=( |
359 |
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
360 |
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" |
361 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" |
362 |
+ -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" |
363 |
+ -DSYSCONFDIR="${EPREFIX}/etc/mysql" |
364 |
+ -DINSTALL_BINDIR=bin |
365 |
+ -DINSTALL_DOCDIR=share/doc/${PF} |
366 |
+ -DINSTALL_DOCREADMEDIR=share/doc/${PF} |
367 |
+ -DINSTALL_INCLUDEDIR=include/mysql |
368 |
+ -DINSTALL_INFODIR=share/info |
369 |
+ -DINSTALL_LIBDIR=$(get_libdir) |
370 |
+ -DINSTALL_MANDIR=share/man |
371 |
+ -DINSTALL_MYSQLSHAREDIR=share/mariadb |
372 |
+ -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin |
373 |
+ -DINSTALL_SCRIPTDIR=share/mariadb/scripts |
374 |
+ -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" |
375 |
+ -DINSTALL_SBINDIR=sbin |
376 |
+ -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" |
377 |
+ -DWITH_COMMENT="Gentoo Linux ${PF}" |
378 |
+ -DWITH_UNIT_TESTS=$(usex test ON OFF) |
379 |
+ -DWITH_LIBEDIT=0 |
380 |
+ -DWITH_ZLIB=system |
381 |
+ -DWITHOUT_LIBWRAP=1 |
382 |
+ -DENABLED_LOCAL_INFILE=1 |
383 |
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
384 |
+ -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" |
385 |
+ -DWITH_DEFAULT_COMPILER_OPTIONS=0 |
386 |
+ -DWITH_DEFAULT_FEATURE_SET=0 |
387 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
388 |
+ # The build forces this to be defined when cross-compiling. We pass it |
389 |
+ # all the time for simplicity and to make sure it is actually correct. |
390 |
+ -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) |
391 |
+ -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" |
392 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
393 |
+ -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) |
394 |
+ -DCONC_WITH_EXTERNAL_ZLIB=YES |
395 |
+ -DWITH_EXTERNAL_ZLIB=YES |
396 |
+ -DSUFFIX_INSTALL_DIR="" |
397 |
+ -DWITH_UNITTEST=OFF |
398 |
+ -DWITHOUT_CLIENTLIBS=YES |
399 |
+ -DCLIENT_PLUGIN_DIALOG=OFF |
400 |
+ -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF |
401 |
+ -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC |
402 |
+ ) |
403 |
+ if use test ; then |
404 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) |
405 |
+ else |
406 |
+ mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) |
407 |
+ fi |
408 |
+ |
409 |
+ if ! use yassl ; then |
410 |
+ mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) |
411 |
+ else |
412 |
+ mycmakeargs+=( -DWITH_SSL=bundled ) |
413 |
+ fi |
414 |
+ |
415 |
+ # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION |
416 |
+ mycmakeargs+=( |
417 |
+ -DWITH_READLINE=$(usex bindist 1 0) |
418 |
+ -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) |
419 |
+ -DENABLE_DTRACE=$(usex systemtap) |
420 |
+ ) |
421 |
+ |
422 |
+ if use server ; then |
423 |
+ |
424 |
+ # Federated{,X} must be treated special otherwise they will not be built as plugins |
425 |
+ if ! use extraengine ; then |
426 |
+ mycmakeargs+=( |
427 |
+ -DPLUGIN_FEDERATED=NO |
428 |
+ -DPLUGIN_FEDERATEDX=NO ) |
429 |
+ fi |
430 |
+ |
431 |
+ mycmakeargs+=( |
432 |
+ -DWITH_JEMALLOC=$(usex jemalloc system) |
433 |
+ -DWITH_PCRE=system |
434 |
+ -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) |
435 |
+ -DPLUGIN_SPHINX=$(usex sphinx YES NO) |
436 |
+ -DPLUGIN_TOKUDB=$(usex tokudb YES NO) |
437 |
+ -DPLUGIN_AUTH_PAM=$(usex pam YES NO) |
438 |
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) |
439 |
+ -DPLUGIN_CASSANDRA=NO |
440 |
+ -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) |
441 |
+ -DPLUGIN_SPIDER=$(usex extraengine YES NO) |
442 |
+ -DPLUGIN_CONNECT=$(usex extraengine YES NO) |
443 |
+ -DCONNECT_WITH_MYSQL=1 |
444 |
+ -DCONNECT_WITH_LIBXML2=$(usex xml) |
445 |
+ -DCONNECT_WITH_ODBC=$(usex odbc) |
446 |
+ -DCONNECT_WITH_JDBC=$(usex jdbc) |
447 |
+ # Build failure and autodep wrt bug 639144 |
448 |
+ -DCONNECT_WITH_MONGO=OFF |
449 |
+ -DWITH_WSREP=$(usex galera) |
450 |
+ -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) |
451 |
+ -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) |
452 |
+ -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) |
453 |
+ -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) |
454 |
+ -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) |
455 |
+ -DWITH_MARIABACKUP=$(usex backup ON OFF) |
456 |
+ -DWITH_LIBARCHIVE=$(usex backup ON OFF) |
457 |
+ -DINSTALL_SQLBENCHDIR="" |
458 |
+ -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) |
459 |
+ # systemd is only linked to for server notification |
460 |
+ -DWITH_SYSTEMD=$(usex systemd yes no) |
461 |
+ -DWITH_NUMA=$(usex numa ON OFF) |
462 |
+ ) |
463 |
+ |
464 |
+ # Workaround for MDEV-14524 |
465 |
+ use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) |
466 |
+ |
467 |
+ if use test ; then |
468 |
+ # This is needed for the new client lib which tests a real, open server |
469 |
+ mycmakeargs+=( -DSKIP_TESTS=ON ) |
470 |
+ fi |
471 |
+ |
472 |
+ if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then |
473 |
+ ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
474 |
+ ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
475 |
+ ewarn "You MUST file bugs without these variables set." |
476 |
+ |
477 |
+ mycmakeargs+=( |
478 |
+ -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
479 |
+ -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
480 |
+ ) |
481 |
+ |
482 |
+ elif ! use latin1 ; then |
483 |
+ mycmakeargs+=( |
484 |
+ -DDEFAULT_CHARSET=utf8 |
485 |
+ -DDEFAULT_COLLATION=utf8_general_ci |
486 |
+ ) |
487 |
+ else |
488 |
+ mycmakeargs+=( |
489 |
+ -DDEFAULT_CHARSET=latin1 |
490 |
+ -DDEFAULT_COLLATION=latin1_swedish_ci |
491 |
+ ) |
492 |
+ fi |
493 |
+ mycmakeargs+=( |
494 |
+ -DEXTRA_CHARSETS=all |
495 |
+ -DMYSQL_USER=mysql |
496 |
+ -DDISABLE_SHARED=$(usex static YES NO) |
497 |
+ -DWITH_DEBUG=$(usex debug) |
498 |
+ -DWITH_EMBEDDED_SERVER=OFF |
499 |
+ -DWITH_PROFILING=$(usex profiling) |
500 |
+ ) |
501 |
+ |
502 |
+ if use static; then |
503 |
+ mycmakeargs+=( -DWITH_PIC=1 ) |
504 |
+ fi |
505 |
+ |
506 |
+ if use jemalloc || use tcmalloc ; then |
507 |
+ mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) |
508 |
+ fi |
509 |
+ |
510 |
+ # Storage engines |
511 |
+ mycmakeargs+=( |
512 |
+ -DWITH_ARCHIVE_STORAGE_ENGINE=1 |
513 |
+ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
514 |
+ -DWITH_CSV_STORAGE_ENGINE=1 |
515 |
+ -DWITH_HEAP_STORAGE_ENGINE=1 |
516 |
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 |
517 |
+ -DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
518 |
+ -DWITH_MYISAM_STORAGE_ENGINE=1 |
519 |
+ -DWITH_PARTITION_STORAGE_ENGINE=1 |
520 |
+ ) |
521 |
+ |
522 |
+ else |
523 |
+ mycmakeargs+=( |
524 |
+ -DWITHOUT_SERVER=1 |
525 |
+ -DWITH_EMBEDDED_SERVER=OFF |
526 |
+ -DEXTRA_CHARSETS=none |
527 |
+ -DINSTALL_SQLBENCHDIR= |
528 |
+ -DWITH_SYSTEMD=no |
529 |
+ ) |
530 |
+ fi |
531 |
+ |
532 |
+ cmake-utils_src_configure |
533 |
+} |
534 |
+ |
535 |
+src_compile() { |
536 |
+ cmake-utils_src_compile |
537 |
+} |
538 |
+ |
539 |
+src_install() { |
540 |
+ cmake-utils_src_install |
541 |
+ |
542 |
+ # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used |
543 |
+ if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then |
544 |
+ rm "${ED}/usr/include/mysql/server/private/config.h" || die |
545 |
+ fi |
546 |
+ |
547 |
+ # Make sure the vars are correctly initialized |
548 |
+ mysql_init_vars |
549 |
+ |
550 |
+ # Convenience links |
551 |
+ einfo "Making Convenience links for mysqlcheck multi-call binary" |
552 |
+ dosym "mysqlcheck" "/usr/bin/mysqlanalyze" |
553 |
+ dosym "mysqlcheck" "/usr/bin/mysqlrepair" |
554 |
+ dosym "mysqlcheck" "/usr/bin/mysqloptimize" |
555 |
+ |
556 |
+ # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
557 |
+ if [[ -d "${ED}/usr/data" ]] ; then |
558 |
+ rm -Rf "${ED}/usr/data" || die |
559 |
+ fi |
560 |
+ |
561 |
+ # Unless they explicitly specific USE=test, then do not install the |
562 |
+ # testsuite. It DOES have a use to be installed, esp. when you want to do a |
563 |
+ # validation of your database configuration after tuning it. |
564 |
+ if ! use test ; then |
565 |
+ rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" |
566 |
+ fi |
567 |
+ |
568 |
+ # Configuration stuff |
569 |
+ einfo "Building default configuration ..." |
570 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
571 |
+ [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf |
572 |
+ cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die |
573 |
+ eprefixify "${TMPDIR}/my.cnf" |
574 |
+ doins "${TMPDIR}/my.cnf" |
575 |
+ insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" |
576 |
+ cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die |
577 |
+ eprefixify "${TMPDIR}/50-distro-client.cnf" |
578 |
+ doins "${TMPDIR}/50-distro-client.cnf" |
579 |
+ |
580 |
+ if use server ; then |
581 |
+ mycnf_src="my.cnf.distro-server" |
582 |
+ sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
583 |
+ "${FILESDIR}/${mycnf_src}" \ |
584 |
+ > "${TMPDIR}/my.cnf.ok" || die |
585 |
+ if use prefix ; then |
586 |
+ sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ |
587 |
+ "${TMPDIR}/my.cnf.ok" || die |
588 |
+ fi |
589 |
+ if use latin1 ; then |
590 |
+ sed -i \ |
591 |
+ -e "/character-set/s|utf8|latin1|g" \ |
592 |
+ "${TMPDIR}/my.cnf.ok" || die |
593 |
+ fi |
594 |
+ eprefixify "${TMPDIR}/my.cnf.ok" |
595 |
+ newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf |
596 |
+ |
597 |
+ einfo "Including support files and sample configurations" |
598 |
+ docinto "support-files" |
599 |
+ local script |
600 |
+ for script in \ |
601 |
+ "${S}"/support-files/magic |
602 |
+ do |
603 |
+ [[ -f "$script" ]] && dodoc "${script}" |
604 |
+ done |
605 |
+ |
606 |
+ docinto "scripts" |
607 |
+ for script in "${S}"/scripts/mysql* ; do |
608 |
+ [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" |
609 |
+ done |
610 |
+ fi |
611 |
+ |
612 |
+ #Remove mytop if perl is not selected |
613 |
+ [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop" |
614 |
+} |
615 |
+ |
616 |
+# Official test instructions: |
617 |
+# USE='extraengine perl server' \ |
618 |
+# FEATURES='test userpriv -usersandbox' \ |
619 |
+# ebuild mariadb-X.X.XX.ebuild \ |
620 |
+# digest clean package |
621 |
+src_test() { |
622 |
+ |
623 |
+ _disable_test() { |
624 |
+ local rawtestname reason |
625 |
+ rawtestname="${1}" ; shift |
626 |
+ reason="${@}" |
627 |
+ ewarn "test '${rawtestname}' disabled: '${reason}'" |
628 |
+ echo ${rawtestname} : ${reason} >> "${T}/disabled.def" |
629 |
+ } |
630 |
+ |
631 |
+ local TESTDIR="${BUILD_DIR}/mysql-test" |
632 |
+ local retstatus_unit |
633 |
+ local retstatus_tests |
634 |
+ |
635 |
+ if ! use server ; then |
636 |
+ einfo "Skipping server tests due to minimal build." |
637 |
+ return 0 |
638 |
+ fi |
639 |
+ |
640 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
641 |
+ # localhost. Also causes weird failures. |
642 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
643 |
+ |
644 |
+ if [[ $UID -eq 0 ]]; then |
645 |
+ die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
646 |
+ fi |
647 |
+ has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox" |
648 |
+ |
649 |
+ einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
650 |
+ |
651 |
+ # Run CTest (test-units) |
652 |
+ cmake-utils_src_test |
653 |
+ retstatus_unit=$? |
654 |
+ |
655 |
+ # Ensure that parallel runs don't die |
656 |
+ export MTR_BUILD_THREAD="$((${RANDOM} % 100))" |
657 |
+ # Enable parallel testing, auto will try to detect number of cores |
658 |
+ # You may set this by hand. |
659 |
+ # The default maximum is 8 unless MTR_MAX_PARALLEL is increased |
660 |
+ export MTR_PARALLEL="${MTR_PARALLEL:-auto}" |
661 |
+ |
662 |
+ # create directories because mysqladmin might run out of order |
663 |
+ mkdir -p "${T}"/var-tests{,/log} || die |
664 |
+ |
665 |
+ # Run mysql tests |
666 |
+ pushd "${TESTDIR}" > /dev/null || die |
667 |
+ |
668 |
+ touch "${T}/disabled.def" |
669 |
+ # These are failing in MariaDB 10.0 for now and are believed to be |
670 |
+ # false positives: |
671 |
+ # |
672 |
+ # main.mysql_client_test, main.mysql_client_test_nonblock |
673 |
+ # main.mysql_client_test_comp: |
674 |
+ # segfaults at random under Portage only, suspect resource limits. |
675 |
+ |
676 |
+ local t |
677 |
+ for t in plugins.cracklib_password_check plugins.two_password_validations ; do |
678 |
+ _disable_test "$t" "False positive due to varying policies" |
679 |
+ done |
680 |
+ |
681 |
+ for t in main.mysql_client_test main.mysql_client_test_nonblock \ |
682 |
+ main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do |
683 |
+ _disable_test "$t" "False positives in Gentoo" |
684 |
+ done |
685 |
+ |
686 |
+ _disable_test main.plugin_auth "Needs client libraries built" |
687 |
+ |
688 |
+ # run mysql-test tests |
689 |
+ perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" |
690 |
+ retstatus_tests=$? |
691 |
+ |
692 |
+ popd > /dev/null || die |
693 |
+ |
694 |
+ # Cleanup is important for these testcases. |
695 |
+ pkill -9 -f "${S}/ndb" 2>/dev/null |
696 |
+ pkill -9 -f "${S}/sql" 2>/dev/null |
697 |
+ |
698 |
+ local failures="" |
699 |
+ [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" |
700 |
+ [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" |
701 |
+ |
702 |
+ [[ -z "$failures" ]] || die "Test failures: $failures" |
703 |
+ einfo "Tests successfully completed" |
704 |
+} |
705 |
+ |
706 |
+mysql_init_vars() { |
707 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} |
708 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
709 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
710 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
711 |
+ |
712 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
713 |
+ MY_DATADIR="" |
714 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
715 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
716 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
717 |
+ | tail -n1` |
718 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
719 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
720 |
+ | sed -e 's/.*=\s*//' \ |
721 |
+ | tail -n1` |
722 |
+ fi |
723 |
+ fi |
724 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
725 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
726 |
+ einfo "Using default MY_DATADIR" |
727 |
+ fi |
728 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
729 |
+ |
730 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
731 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
732 |
+ # If you get this and you're wondering about it, see bug #207636 |
733 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
734 |
+ elog "A new one will not be created." |
735 |
+ PREVIOUS_DATADIR="yes" |
736 |
+ else |
737 |
+ PREVIOUS_DATADIR="no" |
738 |
+ fi |
739 |
+ export PREVIOUS_DATADIR |
740 |
+ fi |
741 |
+ else |
742 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
743 |
+ local new_MY_DATADIR |
744 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
745 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
746 |
+ | tail -n1` |
747 |
+ |
748 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
749 |
+ ewarn "MySQL MY_DATADIR has changed" |
750 |
+ ewarn "from ${MY_DATADIR}" |
751 |
+ ewarn "to ${new_MY_DATADIR}" |
752 |
+ MY_DATADIR="${new_MY_DATADIR}" |
753 |
+ fi |
754 |
+ fi |
755 |
+ fi |
756 |
+ |
757 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
758 |
+ export MY_LOCALSTATEDIR MY_LOGDIR |
759 |
+ export MY_DATADIR |
760 |
+} |
761 |
+ |
762 |
+pkg_config() { |
763 |
+ _getoptval() { |
764 |
+ local mypd="${EROOT}"/usr/bin/my_print_defaults |
765 |
+ local section="$1" |
766 |
+ local flag="--${2}=" |
767 |
+ local extra_options="${3}" |
768 |
+ "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp" |
769 |
+ } |
770 |
+ local old_MY_DATADIR="${MY_DATADIR}" |
771 |
+ local old_HOME="${HOME}" |
772 |
+ # my_print_defaults needs to read stuff in $HOME/.my.cnf |
773 |
+ export HOME=${EPREFIX}/root |
774 |
+ |
775 |
+ # Make sure the vars are correctly initialized |
776 |
+ mysql_init_vars |
777 |
+ |
778 |
+ [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR" |
779 |
+ if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then |
780 |
+ die "Minimal builds do NOT include the MySQL server" |
781 |
+ fi |
782 |
+ |
783 |
+ if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then |
784 |
+ local MY_DATADIR_s="${ROOT}/${MY_DATADIR}" |
785 |
+ MY_DATADIR_s="${MY_DATADIR_s%%/}" |
786 |
+ local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}" |
787 |
+ old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}" |
788 |
+ |
789 |
+ if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then |
790 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
791 |
+ ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist" |
792 |
+ ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}" |
793 |
+ else |
794 |
+ elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}" |
795 |
+ mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \ |
796 |
+ || die "Moving MY_DATADIR failed" |
797 |
+ fi |
798 |
+ else |
799 |
+ ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist" |
800 |
+ if [[ -d "${MY_DATADIR_s}" ]]; then |
801 |
+ ewarn "Attempting to use ${MY_DATADIR_s}" |
802 |
+ else |
803 |
+ eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist" |
804 |
+ die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}" |
805 |
+ fi |
806 |
+ fi |
807 |
+ fi |
808 |
+ |
809 |
+ local pwd1="a" |
810 |
+ local pwd2="b" |
811 |
+ local maxtry=15 |
812 |
+ |
813 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
814 |
+ local tmp_mysqld_password_source= |
815 |
+ |
816 |
+ for tmp_mysqld_password_source in mysql client; do |
817 |
+ einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." |
818 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" |
819 |
+ if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then |
820 |
+ if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then |
821 |
+ ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" |
822 |
+ MYSQL_ROOT_PASSWORD= |
823 |
+ continue |
824 |
+ fi |
825 |
+ |
826 |
+ einfo "Found password in '${tmp_mysqld_password_source}' section!" |
827 |
+ break |
828 |
+ fi |
829 |
+ done |
830 |
+ |
831 |
+ # Sometimes --show is required to display passwords in some implementations of my_print_defaults |
832 |
+ if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then |
833 |
+ MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" |
834 |
+ fi |
835 |
+ |
836 |
+ unset tmp_mysqld_password_source |
837 |
+ fi |
838 |
+ MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)" |
839 |
+ # These are dir+prefix |
840 |
+ MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)" |
841 |
+ MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} |
842 |
+ MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)" |
843 |
+ MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} |
844 |
+ |
845 |
+ if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then |
846 |
+ einfo "Creating MySQL tmpdir $MYSQL_TMPDIR" |
847 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR" |
848 |
+ fi |
849 |
+ if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then |
850 |
+ einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN" |
851 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN" |
852 |
+ fi |
853 |
+ if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then |
854 |
+ einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG" |
855 |
+ install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG" |
856 |
+ fi |
857 |
+ |
858 |
+ if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then |
859 |
+ ewarn "You have already a MySQL database in place." |
860 |
+ ewarn "(${ROOT}/${MY_DATADIR}/*)" |
861 |
+ ewarn "Please rename or delete it if you wish to replace it." |
862 |
+ die "MySQL database already exists!" |
863 |
+ fi |
864 |
+ |
865 |
+ # Bug #213475 - MySQL _will_ object strenously if your machine is named |
866 |
+ # localhost. Also causes weird failures. |
867 |
+ [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" |
868 |
+ |
869 |
+ if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then |
870 |
+ |
871 |
+ einfo "Please provide a password for the mysql 'root' user now" |
872 |
+ einfo "or through the ${HOME}/.my.cnf file." |
873 |
+ ewarn "Avoid [\"'\\_%] characters in the password" |
874 |
+ read -rsp " >" pwd1 ; echo |
875 |
+ |
876 |
+ einfo "Retype the password" |
877 |
+ read -rsp " >" pwd2 ; echo |
878 |
+ |
879 |
+ if [[ "x$pwd1" != "x$pwd2" ]] ; then |
880 |
+ die "Passwords are not the same" |
881 |
+ fi |
882 |
+ MYSQL_ROOT_PASSWORD="${pwd1}" |
883 |
+ unset pwd1 pwd2 |
884 |
+ fi |
885 |
+ |
886 |
+ local options |
887 |
+ local sqltmp="$(emktemp)" |
888 |
+ |
889 |
+ # Fix bug 446200. Don't reference host my.cnf, needs to come first, |
890 |
+ # see http://bugs.mysql.com/bug.php?id=31312 |
891 |
+ use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'" |
892 |
+ |
893 |
+ # Figure out which options we need to disable to do the setup |
894 |
+ local helpfile="${TMPDIR}/mysqld-help" |
895 |
+ "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null |
896 |
+ for opt in grant-tables host-cache name-resolve networking slave-start \ |
897 |
+ federated ssl log-bin relay-log slow-query-log external-locking \ |
898 |
+ log-slave-updates \ |
899 |
+ ; do |
900 |
+ optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" |
901 |
+ egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" |
902 |
+ done |
903 |
+ |
904 |
+ einfo "Creating the mysql database and setting proper permissions on it ..." |
905 |
+ |
906 |
+ # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it |
907 |
+ PID_DIR="${EROOT}/var/run/mysqld" |
908 |
+ if [[ ! -d "${PID_DIR}" ]]; then |
909 |
+ install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory" |
910 |
+ fi |
911 |
+ |
912 |
+ if [[ ! -d "${MY_DATADIR}" ]]; then |
913 |
+ install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory" |
914 |
+ fi |
915 |
+ |
916 |
+ pushd "${TMPDIR}" &>/dev/null || die |
917 |
+ |
918 |
+ # Filling timezones, see |
919 |
+ # http://dev.mysql.com/doc/mysql/en/time-zone-support.html |
920 |
+ "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null |
921 |
+ |
922 |
+ local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" ) |
923 |
+ [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" ) |
924 |
+ cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ) |
925 |
+ einfo "Command: ${cmd[*]}" |
926 |
+ su -s /bin/sh -c "${cmd[*]}" mysql \ |
927 |
+ >"${TMPDIR}"/mysql_install_db.log 2>&1 |
928 |
+ if [ $? -ne 0 ]; then |
929 |
+ grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2 |
930 |
+ die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log" |
931 |
+ fi |
932 |
+ popd &>/dev/null || die |
933 |
+ [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \ |
934 |
+ || die "MySQL databases not installed" |
935 |
+ |
936 |
+ use prefix || options="${options} --user=mysql" |
937 |
+ |
938 |
+ local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock" |
939 |
+ local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid" |
940 |
+ local mysqld="${EROOT}/usr/sbin/mysqld \ |
941 |
+ ${options} \ |
942 |
+ --log-warnings=0 \ |
943 |
+ --basedir=${EROOT}/usr \ |
944 |
+ --datadir=${ROOT}/${MY_DATADIR} \ |
945 |
+ --max_allowed_packet=8M \ |
946 |
+ --net_buffer_length=16K \ |
947 |
+ --socket=${socket} \ |
948 |
+ --pid-file=${pidfile} |
949 |
+ --tmpdir=${ROOT}/${MYSQL_TMPDIR}" |
950 |
+ #einfo "About to start mysqld: ${mysqld}" |
951 |
+ ebegin "Starting mysqld" |
952 |
+ einfo "Command ${mysqld}" |
953 |
+ ${mysqld} & |
954 |
+ rc=$? |
955 |
+ while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do |
956 |
+ maxtry=$((${maxtry}-1)) |
957 |
+ echo -n "." |
958 |
+ sleep 1 |
959 |
+ done |
960 |
+ eend $rc |
961 |
+ |
962 |
+ if ! [[ -S "${socket}" ]]; then |
963 |
+ die "Completely failed to start up mysqld with: ${mysqld}" |
964 |
+ fi |
965 |
+ |
966 |
+ ebegin "Setting root password" |
967 |
+ # Do this from memory, as we don't want clear text passwords in temp files |
968 |
+ local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES" |
969 |
+ "${EROOT}/usr/bin/mysql" \ |
970 |
+ "--socket=${socket}" \ |
971 |
+ -hlocalhost \ |
972 |
+ -e "${sql}" |
973 |
+ eend $? |
974 |
+ |
975 |
+ if [[ -n "${sqltmp}" ]] ; then |
976 |
+ ebegin "Loading \"zoneinfo\", this step may require a few seconds" |
977 |
+ "${EROOT}/usr/bin/mysql" \ |
978 |
+ "--socket=${socket}" \ |
979 |
+ -hlocalhost \ |
980 |
+ -uroot \ |
981 |
+ --password="${MYSQL_ROOT_PASSWORD}" \ |
982 |
+ mysql < "${sqltmp}" |
983 |
+ rc=$? |
984 |
+ eend $? |
985 |
+ [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!" |
986 |
+ fi |
987 |
+ |
988 |
+ # Stop the server and cleanup |
989 |
+ einfo "Stopping the server ..." |
990 |
+ kill $(< "${pidfile}" ) |
991 |
+ rm -f "${sqltmp}" |
992 |
+ wait %1 |
993 |
+ einfo "Done" |
994 |
+} |