wok annotate mysql/receipt @ rev 25430

Up os-prober (1.81)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 19 06:26:39 2022 +0000 (2022-08-19)
parents 544e47246b33
children df63c4ce07f8
rev   line source
pascal@1140 1 # SliTaz package receipt.
pascal@1140 2
pascal@1140 3 PACKAGE="mysql"
slaxemulator@13187 4 VERSION="5.5.27"
pankso@4171 5 CATEGORY="office"
pascal@1140 6 SHORT_DESC="SQL database system."
pascal@1140 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15001 8 LICENSE="GPL2"
pascal@1140 9 TARBALL="$PACKAGE-$VERSION.tar.gz"
pascal@20669 10 WEB_SITE="https://www.mysql.com/"
pascal@17869 11 WGET_URL="ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-${VERSION%.*}/$TARBALL"
pascal@14772 12 CONFIG_FILES="/etc/mysql"
pascal@2347 13 DATABASE_FILES="/var/lib/mysql"
pascal@14772 14 TAZPANEL_DAEMON="man|edit::/etc/mysql/my.cnf|options|web::$WEB_SITE"
pankso@10379 15 CROSS="bug: can not run test programm"
pascal@1140 16
erjo@12033 17 DEPENDS="busybox libmysqlclient mysql-client zlib slitaz-base-files \
slaxemulator@13187 18 gcc-lib-base openssl readline"
slaxemulator@13187 19 BUILD_DEPENDS="cmake openssl-dev zlib-dev ncurses-dev readline-dev"
erjo@12033 20
pascal@24540 21 # What is the latest version available today?
pascal@24540 22 current_version()
pascal@24540 23 {
pascal@24540 24 wget -O - https://github.com/mysql/mysql-server/tags 2>/dev/null | \
pascal@24614 25 sed '/mysql-[0-9]/!d;/archive.*tar/!d;s|.*/[a-z-]*\(.*\).tar.*|\1|;q'
pascal@24540 26 }
pascal@24540 27
pascal@1140 28 # Rules to configure and make the package.
pascal@1140 29 compile_rules()
pascal@1140 30 {
slaxemulator@13187 31 mkdir -p $WOK/$PACKAGE/source/build
slaxemulator@13187 32 cd $WOK/$PACKAGE/source/build
slaxemulator@13187 33 # CFLAGS/CXXFLAGS as suggested upstream
slaxemulator@13187 34 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
slaxemulator@13187 35 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \
slaxemulator@13187 36 cmake ../$PACKAGE-$VERSION \
slaxemulator@13187 37 -DCMAKE_BUILD_TYPE=Release \
slaxemulator@13187 38 -DCMAKE_INSTALL_PREFIX=/usr \
slaxemulator@13187 39 -DSYSCONFDIR=/etc/mysql \
slaxemulator@13187 40 -DMYSQL_DATADIR=/var/lib/mysql \
slaxemulator@13187 41 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
slaxemulator@13187 42 -DDEFAULT_CHARSET=utf8 \
slaxemulator@13187 43 -DDEFAULT_COLLATION=utf8_general_ci \
slaxemulator@13187 44 -DENABLED_LOCAL_INFILE=ON \
slaxemulator@13187 45 -DINSTALL_INFODIR=share/mysql/docs \
slaxemulator@13187 46 -DINSTALL_MANDIR=share/man \
slaxemulator@13187 47 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
slaxemulator@13187 48 -DINSTALL_SCRIPTDIR=bin \
slaxemulator@13187 49 -DINSTALL_INCLUDEDIR=include/mysql \
slaxemulator@13187 50 -DINSTALL_DOCREADMEDIR=share/mysql \
slaxemulator@13187 51 -DINSTALL_SUPPORTFILESDIR=share/mysql \
slaxemulator@13187 52 -DINSTALL_MYSQLSHAREDIR=share/mysql \
slaxemulator@13187 53 -DINSTALL_DOCDIR=share/mysql/docs \
slaxemulator@13187 54 -DINSTALL_SHAREDIR=share/mysql \
slaxemulator@13187 55 -DWITH_READLINE=ON \
slaxemulator@13187 56 -DWITH_ZLIB=system \
slaxemulator@13187 57 -DWITH_SSL=system \
slaxemulator@13187 58 -DWITH_LIBWRAP=OFF \
slaxemulator@13187 59 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
slaxemulator@13187 60 -DWITH_EXTRA_CHARSETS=complex \
slaxemulator@13187 61 -DWITH_EMBEDDED_SERVER=ON \
slaxemulator@13187 62 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
slaxemulator@13187 63 -DWITH_PARTITION_STORAGE_ENGINE=1 \
slaxemulator@13187 64 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
slaxemulator@13187 65 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
slaxemulator@13187 66 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
pascal@15265 67 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 &&
slaxemulator@13187 68 make && make DESTDIR=$DESTDIR install
pascal@1140 69 }
pascal@1140 70
pascal@1140 71 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1140 72 genpkg_rules()
pascal@1140 73 {
pankso@3359 74 mkdir -p \
pankso@3359 75 $fs/usr/share \
pankso@3359 76 $fs/usr/lib/mysql/plugin \
pankso@3359 77 $fs/etc/mysql \
pankso@3359 78 $fs/etc/mysql.d \
pascal@16640 79 $fs/var/lib/mysql
pankso@4171 80
erjo@12033 81 cp -a $install/usr/bin $fs/usr
erjo@12033 82 cp -a $install/usr/lib/mysql/plugin/*.so* $fs/usr/lib/mysql/plugin
erjo@12033 83 cp -a $install/usr/share/mysql $fs/usr/share
pankso@4171 84
pankso@3359 85 # Configuration file
erjo@12033 86 cp -a $stuff/etc/init.d $fs/etc
slaxemulator@13187 87 cp -a $stuff/etc/mysql $fs/etc
pankso@3359 88 grep -q "bind-address" $fs/etc/mysql/my.cnf || sed -i \
pankso@3359 89 's/^\[mysqld\]/[mysqld]\nbind-address\t= 127.0.0.1/' \
pankso@3359 90 $fs/etc/mysql/my.cnf
pankso@4171 91
pankso@3359 92 # Permissions
pankso@3359 93 chmod 600 $fs/etc/mysql/my.cnf
pankso@4171 94
slaxemulator@9701 95 cat $stuff/*.files-list | while read file; do
pascal@1140 96 [ -f $fs$file ] && rm -f $fs$file
pascal@1140 97 done
pankso@4171 98
pascal@1140 99 }
pascal@1140 100
pascal@1140 101 # Pre and post install commands for Tazpkg.
pascal@1140 102 post_install()
pascal@1140 103 {
erjo@12033 104
erjo@12033 105 local user
erjo@12033 106 local group
erjo@12033 107
erjo@12033 108 user=mysql
erjo@12033 109 group=mysql
erjo@12033 110
pascal@18730 111 if ! grep -q $user "$1/etc/passwd"; then
pascal@20319 112 echo
erjo@12033 113 echo -n "Adding user/group $user..."
pascal@18730 114 chroot "$1/" addgroup -S $group
pascal@18730 115 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
erjo@7889 116 status
erjo@7889 117 fi
slaxemulator@13187 118 # adduser mysql if needed
pascal@18730 119 if ! grep -q ${user} "$1/etc/passwd"; then
pascal@20319 120 echo
slaxemulator@13187 121 echo -n "Adding user MySQL..."
pascal@18730 122 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
slaxemulator@13187 123 -g "MySQL Daemon user" -u 27 -H -D -S -G ${group} ${user}
slaxemulator@13187 124 status
slaxemulator@13187 125 fi
pascal@18732 126 #chroot "$1/" /bin/chown ${user}.${group} $(cat "$1/$INSTALLED/$PACKAGE/files.list")
pascal@16681 127 chroot "$1/" /bin/chown -R ${user}.${group} /var/lib/mysql
slaxemulator@13187 128 chroot "$1/" mysql_install_db --user=${user} --basedir=/usr
pascal@1147 129 cat <<EOF
pascal@1147 130 ----
pascal@1147 131 To start $PACKAGE server you can run :
pascal@1147 132
pascal@1147 133 /etc/init.d/$PACKAGE start
pascal@1147 134
pascal@1147 135 Or add $PACKAGE to RUN_DAEMONS in /etc/rcS.conf
pascal@1147 136 ----
pascal@1147 137 EOF
pascal@1140 138 }
pascal@1140 139
pankso@3359 140 pre_install()
pankso@3359 141 {
pankso@3359 142 # Cleanup old files
pascal@18730 143 rm -f "$1/usr/libexec/mysql"*
pankso@3359 144 # Mv config
pascal@19766 145 [ -f "$1/etc/my.cnf" ] &&
pascal@19766 146 mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" || true
pankso@3359 147 }
pankso@3359 148
pascal@1140 149 post_remove()
pascal@1140 150 {
slaxemulator@13187 151 echo "Removing user/group mysql"
slaxemulator@13187 152 chroot "$1/" deluser mysql
pascal@1140 153 }