wok view mysql/receipt @ rev 20319

Up tazlito (501)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun May 20 13:28:18 2018 +0200 (22 months ago)
parents bf261b0db903
children a78610b2eb47
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
106 echo -n "Adding user/group $user..."
107 chroot "$1/" addgroup -S $group
108 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
109 status
110 fi
111 # adduser mysql if needed
112 if ! grep -q ${user} "$1/etc/passwd"; then
113 echo
114 echo -n "Adding user MySQL..."
115 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
116 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user}
117 status
118 fi
119 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list")
120 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql
121 chroot "$1/" mysql_install_db --user=${user} --basedir=/usr
122 cat <<EOF
123 ----
124 To start $PACKAGE server you can run :
126 /etc/init.d/$PACKAGE start
128 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
129 ----
130 EOF
131 }
133 pre_install()
134 {
135 # Cleanup old files
136 rm -f "$1/usr/libexec/mysql"*
137 # Mv config
138 [ -f "$1/etc/my.cnf" ] &&
139 mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" || true
140 }
142 post_remove()
143 {
144 echo "Removing user/group mysql"
145 chroot "$1/" deluser mysql
146 }