wok-next annotate mysql/receipt @ rev 20671

qemu, qemu-light: define prefix
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri May 11 14:51:17 2018 +0300 (2018-05-11)
parents 9278a60d6895
children c9a7a7b42a86
rev   line source
al@19741 1 # SliTaz package receipt v2.
pascal@1140 2
pascal@1140 3 PACKAGE="mysql"
al@20443 4 VERSION="5.5.59"
al@19741 5 CATEGORY="database"
al@19741 6 SHORT_DESC="SQL database system"
pascal@1140 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15001 8 LICENSE="GPL2"
al@19693 9 WEB_SITE="https://www.mysql.com/"
al@19741 10 #CROSS="bug: can not run test programm"
pascal@1140 11
al@19693 12 TARBALL="$PACKAGE-$VERSION.tar.gz"
al@19693 13 WGET_URL="ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-${VERSION%.*}/$TARBALL"
al@19693 14
al@20443 15 BUILD_DEPENDS="cmake zlib-dev ncurses-dev readline-dev libunistring-dev \
al@20443 16 libaio-dev"
al@20443 17 SPLIT="libmysqlclient mysql-client mysql-test mysql-dev mysql"
erjo@12033 18
al@20443 19 compile_rules() {
al@19741 20 mkdir build; cd build
al@19741 21
slaxemulator@13187 22 # CFLAGS/CXXFLAGS as suggested upstream
slaxemulator@13187 23 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \
al@20443 24 CXXFLAGS="-fPIC ${CXXFLAGS} -std=gnu++98 -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \
al@19741 25 cmake .. \
slaxemulator@13187 26 -DCMAKE_BUILD_TYPE=Release \
slaxemulator@13187 27 -DCMAKE_INSTALL_PREFIX=/usr \
slaxemulator@13187 28 -DSYSCONFDIR=/etc/mysql \
slaxemulator@13187 29 -DMYSQL_DATADIR=/var/lib/mysql \
slaxemulator@13187 30 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
slaxemulator@13187 31 -DDEFAULT_CHARSET=utf8 \
slaxemulator@13187 32 -DDEFAULT_COLLATION=utf8_general_ci \
slaxemulator@13187 33 -DENABLED_LOCAL_INFILE=ON \
slaxemulator@13187 34 -DINSTALL_INFODIR=share/mysql/docs \
slaxemulator@13187 35 -DINSTALL_MANDIR=share/man \
slaxemulator@13187 36 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
slaxemulator@13187 37 -DINSTALL_SCRIPTDIR=bin \
slaxemulator@13187 38 -DINSTALL_INCLUDEDIR=include/mysql \
slaxemulator@13187 39 -DINSTALL_DOCREADMEDIR=share/mysql \
slaxemulator@13187 40 -DINSTALL_SUPPORTFILESDIR=share/mysql \
slaxemulator@13187 41 -DINSTALL_MYSQLSHAREDIR=share/mysql \
slaxemulator@13187 42 -DINSTALL_DOCDIR=share/mysql/docs \
slaxemulator@13187 43 -DINSTALL_SHAREDIR=share/mysql \
slaxemulator@13187 44 -DWITH_READLINE=ON \
slaxemulator@13187 45 -DWITH_ZLIB=system \
al@20443 46 -DWITH_SSL=bundled \
slaxemulator@13187 47 -DWITH_LIBWRAP=OFF \
slaxemulator@13187 48 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
slaxemulator@13187 49 -DWITH_EXTRA_CHARSETS=complex \
slaxemulator@13187 50 -DWITH_EMBEDDED_SERVER=ON \
slaxemulator@13187 51 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
slaxemulator@13187 52 -DWITH_PARTITION_STORAGE_ENGINE=1 \
slaxemulator@13187 53 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
slaxemulator@13187 54 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \
slaxemulator@13187 55 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \
pascal@15265 56 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 &&
al@20443 57 make && make DESTDIR=$DESTDIR install || return 1
al@19741 58
al@19741 59 # fix paths
al@19741 60 mv $install/usr/mysql-test $install/usr/share/mysql-test
al@19741 61 mv $install/usr/sql-bench $install/usr/share/sql-bench
al@19741 62
al@19741 63 # Configuration file
al@20443 64 mkdir -p $install/etc
al@20443 65 cp -a $stuff/etc/init.d $install/etc
al@20443 66 cp -a $stuff/etc/mysql $install/etc
al@20443 67 chown -R root:root $install/etc
pascal@1140 68 }
pascal@1140 69
al@20443 70 genpkg_rules() {
al@19741 71 case $PACKAGE in
al@19741 72 libmysqlclient)
al@19741 73 copy libmysqlclient*so*
al@19741 74 CAT="database|client libraries"
al@20443 75 DEPENDS="zlib"
al@19741 76 ;;
al@19741 77 mysql-client)
al@20443 78 # client binaries (plus /usr/bin/mysql), see $src/build/client
al@20443 79 copy /bin/mysql mysql_plugin mysql_upgrade mysqladmin mysqlbinlog \
al@20443 80 mysqlcheck mysqldump mysqlimport mysqlshow mysqlslap mysqltest
al@19741 81 CAT="database|client files"
al@19741 82 PROVIDE="mysql_or_postgresql"
al@20443 83 DEPENDS="libmysqlclient ncurses zlib"
al@19741 84 ;;
al@19741 85 mysql-test)
al@19741 86 copy mysql-test/ sql-bench/ db.opt
al@19741 87 CAT="development|tests and benchmarks"
al@19741 88 DEPENDS="mysql perl"
al@19741 89 ;;
al@19741 90 *-dev)
al@19741 91 copy @dev mysql_config
al@19741 92 rm -r $fs/usr/share/mysql-test
al@19741 93 ;;
al@20443 94 mysql)
al@20443 95 copy @std @rm
al@20443 96 DEPENDS="libmysqlclient libaio mysql-client slitaz-base-files \
al@20443 97 ncurses zlib"
al@20443 98 CONFIG_FILES="/etc/mysql"
al@20443 99 DATABASE_FILES="/var/lib/mysql"
al@20443 100 TAZPANEL_DAEMON="man|edit::/etc/mysql/my.cnf|options|web::$WEB_SITE"
al@20443 101 ;;
al@19741 102 esac
pascal@1140 103 }
pascal@1140 104
al@20443 105 pre_install_mysql() {
al@19741 106 # Cleanup old files
al@19741 107 rm -f "$1/usr/libexec/mysql"*
al@19741 108 # Move old config
al@19741 109 [ -f "$1/etc/my.cnf" ] && mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf"
al@19741 110 }
al@19693 111
al@20443 112 post_install_mysql() {
al@19741 113 chmod 600 "$1/etc/mysql/my.cnf"
al@19741 114
al@19741 115 local user=mysql group=mysql
al@19693 116
pascal@18730 117 if ! grep -q $user "$1/etc/passwd"; then
al@19693 118 action "Adding user/group $user..."
pascal@18730 119 chroot "$1/" addgroup -S $group
pascal@18730 120 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
erjo@7889 121 status
erjo@7889 122 fi
slaxemulator@13187 123 # adduser mysql if needed
al@19741 124 if ! grep -q $user "$1/etc/passwd"; then
al@19741 125 action "Adding MySQL Daemon user..."
pascal@18730 126 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \
al@19741 127 -g "MySQL Daemon user" -u 27 -H -D -S -G $group $user
slaxemulator@13187 128 status
slaxemulator@13187 129 fi
al@19741 130 #chroot "$1/" /bin/chown $user.$group $(cat "$1/$INSTALLED/$PACKAGE/files.list")
al@19741 131 mkdir -p "$1/var/lib/mysql"
al@19741 132 chroot "$1/" /bin/chown -R $user.$group /var/lib/mysql
al@19741 133 chroot "$1/" mysql_install_db --user=$user --basedir=/usr
al@19741 134
al@19693 135 [ -n "$quiet" ] || cat <<EOF
pascal@1147 136
al@20443 137 .----------------------------------------------.
al@20443 138 | To start mysql server you can run: |
al@20443 139 | /etc/init.d/mysql start |
al@20443 140 | |
al@20443 141 | Or add mysql to RUN_DAEMONS in /etc/rcS.conf |
al@20443 142 '----------------------------------------------'
pascal@1147 143 EOF
pascal@1140 144 }
pascal@1140 145
al@20443 146 post_remove_mysql() {
slaxemulator@13187 147 echo "Removing user/group mysql"
slaxemulator@13187 148 chroot "$1/" deluser mysql
pascal@1140 149 }
al@19741 150
al@20443 151 post_install_mysql_test() {
al@19741 152 chmod 2777 "$1/usr/share/mysql-test"
al@19741 153 chmod 2777 "$1/usr/share/sql-bench"
al@19741 154 }