Magellan Linux

Contents of /smage/trunk/core/mysql/mysql-5.5.38-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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