wok view mysql/receipt @ rev 25506

memtest, pack: cleanup
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 09 16:28:01 2023 +0000 (21 months ago)
parents bc2b9d9bed6f
children
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="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"
21 # What is the latest version available today?
22 current_version()
23 {
24 wget -O - https://github.com/mysql/mysql-server/tags 2>/dev/null | \
25 sed '/mysql-[0-9]/!d;/archive.*tar/!d;s|.*/[a-z-]*\(.*\).tar.*|\1|;q'
26 }
28 # Rules to configure and make the package.
29 compile_rules()
30 {
31 mkdir -p $WOK/$PACKAGE/source/build
32 cd $WOK/$PACKAGE/source/build
33 # CFLAGS/CXXFLAGS as suggested upstream
34 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
35 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \
36 cmake ../$PACKAGE-$VERSION \
37 -DCMAKE_BUILD_TYPE=Release \
38 -DCMAKE_INSTALL_PREFIX=/usr \
39 -DSYSCONFDIR=/etc/mysql \
40 -DMYSQL_DATADIR=/var/lib/mysql \
41 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
42 -DDEFAULT_CHARSET=utf8 \
43 -DDEFAULT_COLLATION=utf8_general_ci \
44 -DENABLED_LOCAL_INFILE=ON \
45 -DINSTALL_INFODIR=share/mysql/docs \
46 -DINSTALL_MANDIR=share/man \
47 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
48 -DINSTALL_SCRIPTDIR=bin \
49 -DINSTALL_INCLUDEDIR=include/mysql \
50 -DINSTALL_DOCREADMEDIR=share/mysql \
51 -DINSTALL_SUPPORTFILESDIR=share/mysql \
52 -DINSTALL_MYSQLSHAREDIR=share/mysql \
53 -DINSTALL_DOCDIR=share/mysql/docs \
54 -DINSTALL_SHAREDIR=share/mysql \
55 -DWITH_READLINE=ON \
56 -DWITH_ZLIB=system \
57 -DWITH_SSL=system \
58 -DWITH_LIBWRAP=OFF \
59 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
60 -DWITH_EXTRA_CHARSETS=complex \
61 -DWITH_EMBEDDED_SERVER=ON \
62 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
63 -DWITH_PARTITION_STORAGE_ENGINE=1 \
64 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
65 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
66 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
67 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 &&
68 make && make DESTDIR=$DESTDIR install
69 }
71 # Rules to gen a SliTaz package suitable for Tazpkg.
72 genpkg_rules()
73 {
74 mkdir -p \
75 $fs/usr/share \
76 $fs/usr/lib/mysql/plugin \
77 $fs/etc/mysql \
78 $fs/etc/mysql.d \
79 $fs/var/lib/mysql
81 cp -a $install/usr/bin $fs/usr
82 cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
83 cp -a $install/usr/share/mysql $fs/usr/share
85 # Configuration file
86 cp -a $stuff/etc/init.d $fs/etc
87 cp -a $stuff/etc/mysql $fs/etc
88 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
89 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
90 $fs/etc/mysql/my.cnf
92 # Permissions
93 chmod 600 $fs/etc/mysql/my.cnf
95 cat $stuff/*.files-list | while read file; do
96 [ -f $fs$file ] && rm -f $fs$file
97 done
99 }
101 # Pre and post install commands for Tazpkg.
102 post_install()
103 {
105 local user
106 local group
108 user=mysql
109 group=mysql
111 if ! grep -q $user "$1/etc/passwd"; then
112 echo
113 echo -n "Adding user/group $user..."
114 chroot "$1/" addgroup -S $group
115 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
116 status
117 fi
118 # adduser mysql if needed
119 if ! grep -q ${user} "$1/etc/passwd"; then
120 echo
121 echo -n "Adding user MySQL..."
122 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
123 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user}
124 status
125 fi
126 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list")
127 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql
128 chroot "$1/" mysql_install_db --user=${user} --basedir=/usr
129 cat <<EOF
130 ----
131 To start $PACKAGE server you can run :
133 /etc/init.d/$PACKAGE start
135 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
136 ----
137 EOF
138 }
140 pre_install()
141 {
142 # Cleanup old files
143 rm -f "$1/usr/libexec/mysql"*
144 # Mv config
145 [ -f "$1/etc/my.cnf" ] &&
146 mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" || true
147 }
149 post_remove()
150 {
151 echo "Removing user/group mysql"
152 chroot "$1/" deluser mysql
153 }