Contents of /trunk/extras/mysql/mysql-5.5.47-r1.smage2
Parent Directory
|
Revision Log
Revision 27283 -
(show annotations)
(download)
Tue Dec 8 14:11:42 2015 UTC (8 years, 9 months ago) by niro
File size: 8207 byte(s)
Tue Dec 8 14:11:42 2015 UTC (8 years, 9 months ago) by niro
File size: 8207 byte(s)
auto added: ver bump to 5.5.47-r1
1 | # $Id$ |
2 | |
3 | PNAME="mysql" |
4 | PVER="5.5.47" |
5 | PBUILD="r1" |
6 | |
7 | SPLIT_PACKAGES="mysql-libs mysql-clients mysql" |
8 | |
9 | PCAT="dev-db" |
10 | HOMEPAGE="http://www.mysql.com/" |
11 | |
12 | COMMON_DEPEND=">= sys-libs/zlib-1.2 |
13 | >= sys-libs/libstdc++-5.3 |
14 | >= sys-libs/ncurses-6.0 |
15 | >= dev-libs/openssl-1.0.2 |
16 | >= sys-apps/tcp-wrappers-7" |
17 | |
18 | SDEPEND="${COMMON_DEPEND} |
19 | >= virtual/sed" |
20 | |
21 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
22 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
23 | |
24 | # support variable pname in postinstall |
25 | myPNAME="${PNAME}" |
26 | SPECIAL_VARS="myPNAME" |
27 | |
28 | sminclude mtools cmake systemd |
29 | |
30 | TMP_REV=1.2 |
31 | |
32 | SRC_URI=( |
33 | ftp://ftp.mysql.com/pub/${PNAME}/src/${SRCFILE} |
34 | http://ftp.gwdg.de/pub/misc/${PNAME}/Downloads/MySQL-${PVER%.*}/${SRCFILE} |
35 | mirror://${PNAME}/${SRCFILE} |
36 | mirror://${PNAME}/mysql.tmpfile-${TMP_REV} |
37 | mirror://${PNAME}/mysqld.service |
38 | mirror://${PNAME}/mysqld.socket |
39 | mirror://${PNAME}/${PNAME}-5.5.19-cnf-defaults.patch |
40 | ) |
41 | |
42 | UP2DATE="updatecmd http://dev.mysql.com/ | grep GA | sed 's:.*\]\([0-9].*\)\ GA.*:\1:;q'" |
43 | |
44 | split_info_mysql-libs() |
45 | { |
46 | DESCRIPTION="MySQL client libraries" |
47 | DEPEND="${COMMON_DEPEND}" |
48 | PROVIDE="virtual/mysql-libs" |
49 | } |
50 | |
51 | split_info_mysql-clients() |
52 | { |
53 | DESCRIPTION="MySQL client utilities." |
54 | DEPEND="== dev-db/mysql-libs-${PVER}" |
55 | PROVIDE="virtual/mysql-clients" |
56 | } |
57 | |
58 | split_info_mysql() |
59 | { |
60 | DESCRIPTION="MySQL is a SQL (Structured Query Language) database server." |
61 | DEPEND="== dev-db/mysql-clients-${PVER}" |
62 | PROVIDE="virtual/mysql" |
63 | } |
64 | |
65 | pkg_setup() |
66 | { |
67 | # warn about /proc in chroot environments |
68 | [[ ! -d /proc/sys ]] && die "Please make sure /proc is mounted in chroot-environments." |
69 | |
70 | preinstall_mysql |
71 | } |
72 | |
73 | src_prepare() |
74 | { |
75 | munpack ${SRCFILE} || die |
76 | cd ${SRCDIR} |
77 | |
78 | # apply our configuration |
79 | mpatch ${PNAME}-5.5.19-cnf-defaults.patch || die |
80 | |
81 | # fix broken install logic: |
82 | # always defaults to ./bin/my_print_default, using STANDARTLAYOUT |
83 | # see srcdir/cmake/install_layout.cmake and srcdir/scripts/CMakeLists.txt |
84 | sed -i 's:SET(prefix "."):SET(prefix "${CMAKE_INSTALL_PREFIX}"):' scripts/CMakeLists.txt || die |
85 | } |
86 | |
87 | src_compile() |
88 | { |
89 | cd ${SRCDIR} |
90 | |
91 | # fixes some issues |
92 | export CFLAGS="${CFLAGS} -fno-exceptions -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" |
93 | export CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti -fno-implicit-templates -fno-strict-aliasing -DBIG_JOINS=1 " |
94 | |
95 | # fix PIC issues |
96 | export CFLAGS="${CFLAGS} -fPIC" |
97 | export CXXFLAGS="${CXXFLAGS} -fPIC" |
98 | |
99 | cmake_configure \ |
100 | -DWITH_COMMENT="Magellan MySQL ${PVER}-${PBUILD}" \ |
101 | $(cmake_install BINDIR bin) \ |
102 | $(cmake_install SBINDIR sbin) \ |
103 | $(cmake_install DOCDIR share/doc/${PNAME}) \ |
104 | $(cmake_install DOCREADMEDIR share/doc/${PNAME}) \ |
105 | $(cmake_install INCLUDEDIR include/${PNAME}) \ |
106 | $(cmake_install INFODIR share/info) \ |
107 | $(cmake_install LIBDIR $(mlibdir)/${PNAME}) \ |
108 | $(cmake_install MANDIR share/man) \ |
109 | $(cmake_install MYSQLDATADIR /var/lib/${PNAME}) \ |
110 | $(cmake_install MYSQLSHAREDIR share/${PNAME}) \ |
111 | $(cmake_install MYSQLTESTDIR share/${PNAME}/mysql-test) \ |
112 | $(cmake_install PLUGINDIR $(mlibdir)/${PNAME}/plugin) \ |
113 | $(cmake_install SCRIPTDIR bin) \ |
114 | $(cmake_install SQLBENCHDIR share/${PNAME}) \ |
115 | $(cmake_install SUPPORTFILESDIR /usr/share/${PNAME}) \ |
116 | $(cmake_opt SYSCONFDIR /etc/${PNAME}) \ |
117 | $(cmake_opt MYSQL_USER mysql) \ |
118 | $(cmake_opt MYSQL_UNIX_ADDR /run/${PNAME}d/mysqld.sock) \ |
119 | $(cmake_opt ENABLED_LOCAL_INFILE ON) \ |
120 | $(cmake_opt EXTRA_CHARSETS all) \ |
121 | $(cmake_opt DEFAULT_CHARSET utf8) \ |
122 | $(cmake_opt DEFAULT_COLLATION utf8_general_ci) \ |
123 | $(cmake_without READLINE) \ |
124 | $(cmake_with ZLIB system) \ |
125 | $(cmake_with SSL system) \ |
126 | $(cmake_with LIBWRAP) \ |
127 | $(cmake_with EMBEDDED_SERVER) \ |
128 | $(cmake_with INNOBASE_STORAGE_ENGINE) \ |
129 | $(cmake_with PARTITION_STORAGE_ENGINE) \ |
130 | $(cmake_without EXAMPLE_STORAGE_ENGINE) \ |
131 | $(cmake_without ARCHIVE_STORAGE_ENGINE) \ |
132 | $(cmake_without BLACKHOLE_STORAGE_ENGINE) \ |
133 | $(cmake_without FEDERATED_STORAGE_ENGINE) \ |
134 | $(cmake_without UNIT_TESTS) \ |
135 | || die |
136 | |
137 | mmake || die |
138 | } |
139 | |
140 | src_install_mysql-libs() |
141 | { |
142 | cd ${SRCDIR} |
143 | |
144 | # install only includes and clients libraries |
145 | local i |
146 | for i in include libmysql libmysqld libservices |
147 | do |
148 | mmake -C ${i} DESTDIR=${BINDIR} install || die |
149 | done |
150 | |
151 | # symlink client libs to libdir |
152 | pushd ${BINDIR}/usr/$(mlibdir) || die |
153 | for i in mysql/libmysqlclient{,_r}.so* |
154 | do |
155 | mlink ${i} /usr/$(mlibdir) || die |
156 | done |
157 | popd |
158 | |
159 | # mysql-config |
160 | minstallexec scripts/mysql_config || die |
161 | |
162 | # man-pages |
163 | for i in mysql_config mysql_client_test_embedded mysqltest_embedded |
164 | do |
165 | minstallman man/${i}.1 || die |
166 | done |
167 | } |
168 | |
169 | src_install_mysql-clients() |
170 | { |
171 | cd ${SRCDIR} |
172 | mmake -C client DESTDIR=${BINDIR} install || die |
173 | |
174 | # some common symlinks |
175 | for i in mysqlanalyze mysqlrepair mysqloptimize |
176 | do |
177 | mlink mysqlcheck /usr/bin/${i} || die |
178 | done |
179 | |
180 | # man-pages |
181 | local i |
182 | for i in mysql mysqladmin mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap |
183 | do |
184 | minstallman man/${i}.1 || die |
185 | done |
186 | |
187 | # provided by mysql |
188 | mdelete /usr/bin/mysql_upgrade || die |
189 | mdelete /usr/bin/mysqlbinlog || die |
190 | mdelete /usr/bin/mysqltest || die |
191 | } |
192 | |
193 | src_install_mysql() |
194 | { |
195 | cd ${SRCDIR} |
196 | mmake DESTDIR=${BINDIR} install || die |
197 | |
198 | # remove all unneeded stuff |
199 | local i |
200 | # dirs |
201 | for i in sql-bench mysql-test |
202 | do |
203 | if [[ -d ${BINDIR}/usr/share/${PNAME}/${i} ]] |
204 | then |
205 | mdelete -r /usr/share/${PNAME}/${i} || die |
206 | fi |
207 | done |
208 | if [[ -d ${BINDIR}/usr/data ]] |
209 | then |
210 | mdelete -r /usr/data || die |
211 | fi |
212 | # files |
213 | for i in share/${PNAME}/mysql-log-rotate \ |
214 | share/${PNAME}/mysql.server* \ |
215 | share/${PNAME}/binary-configure* \ |
216 | share/${PNAME}/my-*.cnf \ |
217 | share/${PNAME}/mi_test_all* \ |
218 | bin/comp_err \ |
219 | share/man/man1/mysql-test-run.pl.1 |
220 | do |
221 | if [[ -f ${BINDIR}/usr/${i} ]] |
222 | then |
223 | mdelete /usr/${i} || die |
224 | fi |
225 | done |
226 | |
227 | # provided by mysql-libs |
228 | mdelete /usr/bin/mysql_config || die |
229 | mdelete /usr/bin/mysql_client_test_embedded || die |
230 | mdelete /usr/bin/mysqltest_embedded || die |
231 | mdelete /usr/$(mlibdir)/${PNAME}/libmysql\* || die |
232 | mdelete -r /usr/include/ || die |
233 | mdelete /usr/share/man/man1/mysql_config.1 || die |
234 | mdelete /usr/share/man/man1/mysql_client_test_embedded.1 || die |
235 | mdelete /usr/share/man/man1/mysqltest_embedded.1 || die |
236 | |
237 | # provided by mysql-clients |
238 | mdelete /usr/bin/mysql || die |
239 | mdelete /usr/bin/mysqladmin || die |
240 | mdelete /usr/bin/mysqlcheck || die |
241 | mdelete /usr/bin/mysqldump || die |
242 | mdelete /usr/bin/mysqlimport || die |
243 | mdelete /usr/bin/mysqlshow || die |
244 | mdelete /usr/bin/mysqlslap || die |
245 | mdelete /usr/share/man/man1/mysql.1 || die |
246 | mdelete /usr/share/man/man1/mysqladmin.1 || die |
247 | mdelete /usr/share/man/man1/mysqlcheck.1 || die |
248 | mdelete /usr/share/man/man1/mysqldump.1 || die |
249 | mdelete /usr/share/man/man1/mysqlimport.1 || die |
250 | mdelete /usr/share/man/man1/mysqlshow.1 || die |
251 | mdelete /usr/share/man/man1/mysqlslap.1 || die |
252 | |
253 | # needed directories |
254 | mkeepdir /var/lib/${PNAME} || die |
255 | mchown mysql:mysql /var/lib/${PNAME} || die |
256 | mchmod 0750 /var/lib/${PNAME} || die |
257 | |
258 | mkeepdir /run/${PNAME}d || die |
259 | mchown mysql:mysql /run/${PNAME}d || die |
260 | |
261 | mkeepdir /var/log/${PNAME} || die |
262 | mchown mysql:mysql /var/log/${PNAME} || die |
263 | |
264 | minstalldocs ChangeLog COPYING EXCEPTIONS-CLIENT README || die |
265 | minstalldocs support-files/my-*.cnf support-files/magic || die |
266 | minstalldocs support-files/ndb-config-2-node.ini || die |
267 | |
268 | # install a default my.cnf |
269 | minstalldir /etc/${PNAME} || die |
270 | minstallfile support-files/my-medium.cnf /etc/${PNAME}/my.cnf || die |
271 | |
272 | # systemd specific |
273 | minstalltmp mysql.tmpfile-${TMP_REV} mysql.conf || die |
274 | minstallunit mysqld.service mysqld.service || die |
275 | minstallunit mysqld.socket || die |
276 | } |
277 | |
278 | preinstall_mysql() |
279 | { |
280 | # adding mysql user |
281 | mgroupadd -o "-g 60" mysql |
282 | museradd -o "-u 60 -g mysql -d /dev/null -s /bin/false" mysql |
283 | } |
284 | |
285 | postinstall_mysql() |
286 | { |
287 | # create a database if none exists |
288 | if [[ ! -d /var/lib/${myPNAME}/mysql ]] |
289 | then |
290 | echo "Creating the mysql database ..." |
291 | mysql_install_db --user=mysql |
292 | chown -R mysql:mysql /var/lib/${myPNAME} |
293 | chmod 0750 /var/lib/${myPNAME} |
294 | |
295 | echo |
296 | echo "Warning: The administrator password is empty!" |
297 | echo "Please make sure to set one with following command:" |
298 | echo " mysqladmin -u root password <new-password>" |
299 | echo |
300 | fi |
301 | |
302 | # start the daemon - systemd |
303 | mstartunit mysqld.socket |
304 | mstartunit mysqld.service |
305 | } |
306 | |
307 | postremove_mysql() |
308 | { |
309 | if [ ! -f /usr/sbin/mysqld ] |
310 | then |
311 | # systemd |
312 | mstopunit mysqld.service |
313 | mstopunit mysqld.socket |
314 | fi |
315 | } |