1 |
commit: 0c9ea5fc3587dc211312913ab23bc3dfe4197d91 |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 29 02:55:33 2016 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 29 02:59:11 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c9ea5fc |
7 |
|
8 |
mysql-multilib-r1: Add EAPI 6 support |
9 |
|
10 |
eclass/mysql-multilib-r1.eclass | 144 +++++++++++++++++++++++++++++++--------- |
11 |
1 file changed, 113 insertions(+), 31 deletions(-) |
12 |
|
13 |
diff --git a/eclass/mysql-multilib-r1.eclass b/eclass/mysql-multilib-r1.eclass |
14 |
index 1512b21..65ebe85 100644 |
15 |
--- a/eclass/mysql-multilib-r1.eclass |
16 |
+++ b/eclass/mysql-multilib-r1.eclass |
17 |
@@ -38,15 +38,21 @@ MYSQL_EXTRAS="" |
18 |
# @DESCRIPTION: |
19 |
# An array of CMake arguments added to native and non-native |
20 |
|
21 |
-inherit eutils systemd flag-o-matic ${MYSQL_EXTRAS} mysql_fx versionator \ |
22 |
- multilib prefix toolchain-funcs user cmake-utils multilib-minimal |
23 |
+# Keeping eutils in EAPI=6 for emktemp in pkg_config |
24 |
+ |
25 |
+inherit eutils systemd flag-o-matic ${MYSQL_EXTRAS} versionator \ |
26 |
+ prefix toolchain-funcs user cmake-utils multilib-minimal |
27 |
+ |
28 |
+if [[ "${EAPI}x" == "5x" ]]; then |
29 |
+ inherit multilib mysql_fx |
30 |
+fi |
31 |
|
32 |
# |
33 |
# Supported EAPI versions and export functions |
34 |
# |
35 |
|
36 |
case "${EAPI:-0}" in |
37 |
- 5) ;; |
38 |
+ 5|6) ;; |
39 |
*) die "Unsupported EAPI: ${EAPI}" ;; |
40 |
esac |
41 |
|
42 |
@@ -82,19 +88,18 @@ if [[ -z ${MYSQL_PV_MAJOR} ]] ; then MYSQL_PV_MAJOR="$(get_version_component_ran |
43 |
# depend on this variable. |
44 |
# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803" |
45 |
# We also strip off upstream's trailing letter that they use to respin tarballs |
46 |
-MYSQL_VERSION_ID="" |
47 |
-tpv="${PV%[a-z]}" |
48 |
-tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" |
49 |
-for vatom in 0 1 2 3 ; do |
50 |
- # pad to length 2 |
51 |
- tpv[${vatom}]="00${tpv[${vatom}]}" |
52 |
- MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}" |
53 |
-done |
54 |
-# strip leading "0" (otherwise it's considered an octal number by BASH) |
55 |
-MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} |
56 |
- |
57 |
-# This eclass should only be used with at least mysql-5.5.35 |
58 |
-mysql_version_is_at_least "5.5.35" || die "This eclass should only be used with >=mysql-5.5.35" |
59 |
+if [[ "${EAPI}x" == "5x" ]]; then |
60 |
+ MYSQL_VERSION_ID="" |
61 |
+ tpv="${PV%[a-z]}" |
62 |
+ tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}" |
63 |
+ for vatom in 0 1 2 3 ; do |
64 |
+ # pad to length 2 |
65 |
+ tpv[${vatom}]="00${tpv[${vatom}]}" |
66 |
+ MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}" |
67 |
+ done |
68 |
+ # strip leading "0" (otherwise it's considered an octal number by BASH) |
69 |
+ MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"} |
70 |
+fi |
71 |
|
72 |
# Work out the default SERVER_URI correctly |
73 |
if [[ -z ${SERVER_URI} ]]; then |
74 |
@@ -223,7 +228,7 @@ mysql-multilib-r1_pkg_pretend() { |
75 |
if [[ ${MERGE_TYPE} != binary ]] ; then |
76 |
local GCC_MAJOR_SET=$(gcc-major-version) |
77 |
local GCC_MINOR_SET=$(gcc-minor-version) |
78 |
- if use_if_iuse tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
79 |
+ if in_iuse tokudb && use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ |
80 |
${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then |
81 |
eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." |
82 |
eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
83 |
@@ -285,14 +290,16 @@ mysql-multilib-r1_src_prepare() { |
84 |
if [[ ${MY_EXTRAS_VER} != none ]]; then |
85 |
|
86 |
# Apply the patches for this MySQL version |
87 |
- EPATCH_SUFFIX="patch" |
88 |
- mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
89 |
- # Clean out old items |
90 |
- rm -f "${EPATCH_SOURCE}"/* |
91 |
- # Now link in right patches |
92 |
- mysql_mv_patches |
93 |
- # And apply |
94 |
- epatch |
95 |
+ if [[ "${EAPI}x" == "5x" ]]; then |
96 |
+ EPATCH_SUFFIX="patch" |
97 |
+ mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
98 |
+ # Clean out old items |
99 |
+ rm -f "${EPATCH_SOURCE}"/* |
100 |
+ # Now link in right patches |
101 |
+ mysql_mv_patches |
102 |
+ # And apply |
103 |
+ epatch |
104 |
+ fi |
105 |
fi |
106 |
|
107 |
# last -fPIC fixup, per bug #305873 |
108 |
@@ -332,7 +339,11 @@ mysql-multilib-r1_src_prepare() { |
109 |
rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" |
110 |
fi |
111 |
|
112 |
- epatch_user |
113 |
+ if [[ "${EAPI}x" == "5x" ]] ; then |
114 |
+ epatch_user |
115 |
+ else |
116 |
+ default |
117 |
+ fi |
118 |
} |
119 |
|
120 |
# @FUNCTION: mysql-multilib-r1_src_configure |
121 |
@@ -342,7 +353,7 @@ mysql-multilib-r1_src_configure() { |
122 |
# Bug #114895, bug #110149 |
123 |
filter-flags "-O" "-O[01]" |
124 |
|
125 |
- append-cxxflags -felide-constructors -fno-rtti |
126 |
+ append-cxxflags -felide-constructors |
127 |
|
128 |
# bug #283926, with GCC4.4, this is required to get correct behavior. |
129 |
append-flags -fno-strict-aliasing |
130 |
@@ -388,7 +399,7 @@ multilib_src_configure() { |
131 |
-DINSTALL_UNIX_ADDRDIR=${EPREFIX}/var/run/mysqld/mysqld.sock |
132 |
-DWITH_DEFAULT_COMPILER_OPTIONS=0 |
133 |
-DWITH_DEFAULT_FEATURE_SET=0 |
134 |
- -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_unitdir)" |
135 |
+ -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" |
136 |
) |
137 |
|
138 |
if in_iuse systemd ; then |
139 |
@@ -680,7 +691,7 @@ mysql-multilib-r1_pkg_postinst() { |
140 |
fi |
141 |
done |
142 |
|
143 |
- if use_if_iuse pam ; then |
144 |
+ if in_iuse pam && use pam; then |
145 |
einfo |
146 |
elog "This install includes the PAM authentication plugin." |
147 |
elog "To activate and configure the PAM plugin, please read:" |
148 |
@@ -708,7 +719,7 @@ mysql-multilib-r1_pkg_postinst() { |
149 |
einfo |
150 |
fi |
151 |
|
152 |
- if use_if_iuse galera ; then |
153 |
+ if in_iuse galera && use galera ; then |
154 |
einfo |
155 |
elog "Be sure to edit the my.cnf file to activate your cluster settings." |
156 |
elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" |
157 |
@@ -1038,9 +1049,80 @@ mysql-multilib-r1_disable_test() { |
158 |
# and some check WITHOUT_. Also, this can easily extend to non-storage plugins. |
159 |
mysql-cmake_use_plugin() { |
160 |
[[ -z $2 ]] && die "mysql-cmake_use_plugin <USE flag> <flag name>" |
161 |
- if use_if_iuse $1 ; then |
162 |
+ if in_iuse $1 && use $1 ; then |
163 |
echo "-DWITH_$2=1 -DPLUGIN_$2=YES" |
164 |
else |
165 |
echo "-DWITHOUT_$2=1 -DWITH_$2=0 -DPLUGIN_$2=NO" |
166 |
fi |
167 |
} |
168 |
+ |
169 |
+# @FUNCTION: mysql_init_vars |
170 |
+# @DESCRIPTION: |
171 |
+# void mysql_init_vars() |
172 |
+# Initialize global variables |
173 |
+# 2005-11-19 <vivo@g.o> |
174 |
+if [[ "${EAPI}x" != "5x" ]]; then |
175 |
+ |
176 |
+mysql_init_vars() { |
177 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"} |
178 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} |
179 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} |
180 |
+ MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} |
181 |
+ MY_INCLUDEDIR=${MY_INCLUDEDIR="${EPREFIX}/usr/include/mysql"} |
182 |
+ MY_LIBDIR=${MY_LIBDIR="${EPREFIX}/usr/$(get_libdir)/mysql"} |
183 |
+ |
184 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
185 |
+ MY_DATADIR="" |
186 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
187 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
188 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
189 |
+ | tail -n1` |
190 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
191 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
192 |
+ | sed -e 's/.*=\s*//' \ |
193 |
+ | tail -n1` |
194 |
+ fi |
195 |
+ fi |
196 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
197 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
198 |
+ einfo "Using default MY_DATADIR" |
199 |
+ fi |
200 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
201 |
+ |
202 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
203 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
204 |
+ # If you get this and you're wondering about it, see bug #207636 |
205 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
206 |
+ elog "A new one will not be created." |
207 |
+ PREVIOUS_DATADIR="yes" |
208 |
+ else |
209 |
+ PREVIOUS_DATADIR="no" |
210 |
+ fi |
211 |
+ export PREVIOUS_DATADIR |
212 |
+ fi |
213 |
+ else |
214 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
215 |
+ local new_MY_DATADIR |
216 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
217 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
218 |
+ | tail -n1` |
219 |
+ |
220 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
221 |
+ ewarn "MySQL MY_DATADIR has changed" |
222 |
+ ewarn "from ${MY_DATADIR}" |
223 |
+ ewarn "to ${new_MY_DATADIR}" |
224 |
+ MY_DATADIR="${new_MY_DATADIR}" |
225 |
+ fi |
226 |
+ fi |
227 |
+ fi |
228 |
+ |
229 |
+ if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then |
230 |
+ MY_SOURCEDIR=${SERVER_URI##*/} |
231 |
+ MY_SOURCEDIR=${MY_SOURCEDIR%.tar*} |
232 |
+ fi |
233 |
+ |
234 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
235 |
+ export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR |
236 |
+ export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR |
237 |
+} |
238 |
+fi |