wok-current view mysql/receipt @ rev 19651

Up cookutils (869)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Jan 23 11:18:30 2017 +0200 (2017-01-23)
parents 9e01bc6321ea
children bf261b0db903
line source
1 # SliTaz package receipt.
3 PACKAGE="mysql"
4 VERSION="5.5.27"
5 CATEGORY="office"
6 SHORT_DESC="SQL database system."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.mysql.com/"
11 WGET_URL="ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-${VERSION%.*}/$TARBALL"
12 CONFIG_FILES="/etc/mysql"
13 DATABASE_FILES="/var/lib/mysql"
14 TAZPANEL_DAEMON="man|edit::/etc/mysql/my.cnf|options|web::$WEB_SITE"
15 CROSS="bug: can not run test programm"
17 DEPENDS="busybox libmysqlclient mysql-client zlib slitaz-base-files \
18 gcc-lib-base openssl readline"
19 BUILD_DEPENDS="cmake openssl-dev zlib-dev ncurses-dev readline-dev"
21 # Rules to configure and make the package.
22 compile_rules()
23 {
24 mkdir -p $WOK/$PACKAGE/source/build
25 cd $WOK/$PACKAGE/source/build
26 # CFLAGS/CXXFLAGS as suggested upstream
27 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
28 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \
29 cmake ../$PACKAGE-$VERSION \
30 -DCMAKE_BUILD_TYPE=Release \
31 -DCMAKE_INSTALL_PREFIX=/usr \
32 -DSYSCONFDIR=/etc/mysql \
33 -DMYSQL_DATADIR=/var/lib/mysql \
34 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
35 -DDEFAULT_CHARSET=utf8 \
36 -DDEFAULT_COLLATION=utf8_general_ci \
37 -DENABLED_LOCAL_INFILE=ON \
38 -DINSTALL_INFODIR=share/mysql/docs \
39 -DINSTALL_MANDIR=share/man \
40 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
41 -DINSTALL_SCRIPTDIR=bin \
42 -DINSTALL_INCLUDEDIR=include/mysql \
43 -DINSTALL_DOCREADMEDIR=share/mysql \
44 -DINSTALL_SUPPORTFILESDIR=share/mysql \
45 -DINSTALL_MYSQLSHAREDIR=share/mysql \
46 -DINSTALL_DOCDIR=share/mysql/docs \
47 -DINSTALL_SHAREDIR=share/mysql \
48 -DWITH_READLINE=ON \
49 -DWITH_ZLIB=system \
50 -DWITH_SSL=system \
51 -DWITH_LIBWRAP=OFF \
52 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
53 -DWITH_EXTRA_CHARSETS=complex \
54 -DWITH_EMBEDDED_SERVER=ON \
55 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
56 -DWITH_PARTITION_STORAGE_ENGINE=1 \
57 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
58 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
59 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
60 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 &&
61 make && make DESTDIR=$DESTDIR install
62 }
64 # Rules to gen a SliTaz package suitable for Tazpkg.
65 genpkg_rules()
66 {
67 mkdir -p \
68 $fs/usr/share \
69 $fs/usr/lib/mysql/plugin \
70 $fs/etc/mysql \
71 $fs/etc/mysql.d \
72 $fs/var/lib/mysql
74 cp -a $install/usr/bin $fs/usr
75 cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
76 cp -a $install/usr/share/mysql $fs/usr/share
78 # Configuration file
79 cp -a $stuff/etc/init.d $fs/etc
80 cp -a $stuff/etc/mysql $fs/etc
81 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
82 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
83 $fs/etc/mysql/my.cnf
85 # Permissions
86 chmod 600 $fs/etc/mysql/my.cnf
88 cat $stuff/*.files-list | while read file; do
89 [ -f $fs$file ] && rm -f $fs$file
90 done
92 }
94 # Pre and post install commands for Tazpkg.
95 post_install()
96 {
98 local user
99 local group
101 user=mysql
102 group=mysql
104 if ! grep -q $user "$1/etc/passwd"; then
105 echo -n "Adding user/group $user..."
106 chroot "$1/" addgroup -S $group
107 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
108 status
109 fi
110 # adduser mysql if needed
111 if ! grep -q ${user} "$1/etc/passwd"; then
112 echo -n "Adding user MySQL..."
113 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
114 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user}
115 status
116 fi
117 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list")
118 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql
119 chroot "$1/" mysql_install_db --user=${user} --basedir=/usr
120 cat <<EOF
121 ----
122 To start $PACKAGE server you can run :
124 /etc/init.d/$PACKAGE start
126 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
127 ----
128 EOF
129 }
131 pre_install()
132 {
133 # Cleanup old files
134 rm -f "$1/usr/libexec/mysql"*
135 # Mv config
136 [ -f "$1/etc/my.cnf" ] && mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf"
137 }
139 post_remove()
140 {
141 echo "Removing user/group mysql"
142 chroot "$1/" deluser mysql
143 }