wok-current view mysql/receipt @ rev 25672
patch tazpkg, upgrade core pkgs first
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Sun Mar 03 17:58:42 2024 +0000 (5 months ago) |
parents | e7303f20381c |
children | bfd1d974e88e |
line source
1 # SliTaz package receipt.
3 PACKAGE="mysql"
4 VERSION="5.7.28"
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="https://www.mysql.com/"
11 WGET_URL="https://dev.mysql.com/get/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 \
20 libtirpc-dev"
22 # What is the latest version available today?
23 current_version()
24 {
25 wget -O - https://github.com/mysql/mysql-server/tags 2>/dev/null | \
26 sed '/mysql-[0-9]/!d;/archive.*tar/!d;s|.*/[a-z-]*\(.*\).tar.*|\1|;q'
27 }
29 # Rules to configure and make the package.
30 compile_rules()
31 {
32 mkdir -p $WOK/$PACKAGE/source/build
33 cd $WOK/$PACKAGE/source/build
34 # CFLAGS/CXXFLAGS as suggested upstream
35 # remove -fno-rtti with gcc6
36 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
37 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors" \
38 cmake ../$PACKAGE-$VERSION \
39 -DCMAKE_BUILD_TYPE=Release \
40 -DCMAKE_INSTALL_PREFIX=/usr \
41 -DSYSCONFDIR=/etc/mysql \
42 -DMYSQL_DATADIR=/var/lib/mysql \
43 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
44 -DDEFAULT_CHARSET=utf8 \
45 -DDEFAULT_COLLATION=utf8_general_ci \
46 -DENABLED_LOCAL_INFILE=ON \
47 -DINSTALL_INFODIR=share/mysql/docs \
48 -DINSTALL_MANDIR=share/man \
49 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
50 -DINSTALL_SCRIPTDIR=bin \
51 -DINSTALL_INCLUDEDIR=include/mysql \
52 -DINSTALL_DOCREADMEDIR=share/mysql \
53 -DINSTALL_SUPPORTFILESDIR=share/mysql \
54 -DINSTALL_MYSQLSHAREDIR=share/mysql \
55 -DINSTALL_DOCDIR=share/mysql/docs \
56 -DINSTALL_SHAREDIR=share/mysql \
57 -DWITH_READLINE=ON \
58 -DWITH_ZLIB=system \
59 -DWITH_SSL=system \
60 -DWITH_LIBWRAP=OFF \
61 -DDOWNLOAD_BOOST=1 \
62 -DWITH_BOOST=$src/boost-1.59.0 \
63 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
64 -DWITH_EXTRA_CHARSETS=complex \
65 -DWITH_EMBEDDED_SERVER=ON \
66 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
67 -DWITH_PARTITION_STORAGE_ENGINE=1 \
68 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
69 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
70 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
71 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 &&
72 make && make DESTDIR=$DESTDIR install
73 }
75 # Rules to gen a SliTaz package suitable for Tazpkg.
76 genpkg_rules()
77 {
78 mkdir -p \
79 $fs/usr/share \
80 $fs/usr/lib/mysql/plugin \
81 $fs/etc/mysql \
82 $fs/etc/mysql.d \
83 $fs/var/lib/mysql \
84 $fs/var/run/mysqld
86 cp -a $install/usr/bin $fs/usr
87 cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
88 cp -a $install/usr/share/mysql $fs/usr/share
90 # Configuration file
91 cp -a $stuff/etc/init.d $fs/etc
92 cp -a $stuff/etc/mysql $fs/etc
93 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
94 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
95 $fs/etc/mysql/my.cnf
97 # Permissions
98 chmod 600 $fs/etc/mysql/my.cnf
100 cat $stuff/*.files-list | while read file; do
101 [ -f $fs$file ] && rm -f $fs$file
102 done
104 }
106 # Pre and post install commands for Tazpkg.
107 post_install()
108 {
110 local user
111 local group
113 user=mysql
114 group=mysql
116 if ! grep -q $user "$1/etc/passwd"; then
117 echo
118 echo -n "Adding user/group $user..."
119 chroot "$1/" addgroup -S $group
120 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
121 status
122 fi
123 # adduser mysql if needed
124 if ! grep -q ${user} "$1/etc/passwd"; then
125 echo
126 echo -n "Adding user MySQL..."
127 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
128 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user}
129 status
130 fi
131 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list")
132 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql
133 chroot "$1/" /bin/chown -R ${user}.${group} /var/run/mysqld
134 chroot "$1/" mysqld --initialize --user=${user} --basedir=/usr
135 cat <<EOF
136 ----
137 To start $PACKAGE server you can run :
139 /etc/init.d/$PACKAGE start
141 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
142 ----
143 EOF
144 }
146 pre_install()
147 {
148 # Cleanup old files
149 rm -f "$1/usr/libexec/mysql"*
150 # Mv config
151 [ -f "$1/etc/my.cnf" ] &&
152 mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" || true
153 }
155 post_remove()
156 {
157 echo "Removing user/group mysql"
158 chroot "$1/" deluser mysql
159 }