wok-next annotate mysql/receipt @ rev 19861
Up tazlito
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Sep 08 14:25:24 2017 +0300 (2017-09-08) |
parents | 4048d48a47c1 |
children | 0e7893ac206d |
rev | line source |
---|---|
al@19741 | 1 # SliTaz package receipt v2. |
pascal@1140 | 2 |
pascal@1140 | 3 PACKAGE="mysql" |
al@19741 | 4 VERSION="5.5.56" |
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 |
slaxemulator@13187 | 15 BUILD_DEPENDS="cmake openssl-dev zlib-dev ncurses-dev readline-dev" |
al@19741 | 16 SPLIT="libmysqlclient mysql-client mysql-test mysql-dev" |
erjo@12033 | 17 |
pascal@1140 | 18 # Rules to configure and make the package. |
pascal@1140 | 19 compile_rules() |
pascal@1140 | 20 { |
al@19741 | 21 mkdir build; cd build |
al@19741 | 22 |
slaxemulator@13187 | 23 # CFLAGS/CXXFLAGS as suggested upstream |
slaxemulator@13187 | 24 CFLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer" \ |
slaxemulator@13187 | 25 CXXFLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -DBIG_JOINS=1 -felide-constructors -fno-rtti" \ |
al@19741 | 26 cmake .. \ |
slaxemulator@13187 | 27 -DCMAKE_BUILD_TYPE=Release \ |
slaxemulator@13187 | 28 -DCMAKE_INSTALL_PREFIX=/usr \ |
slaxemulator@13187 | 29 -DSYSCONFDIR=/etc/mysql \ |
slaxemulator@13187 | 30 -DMYSQL_DATADIR=/var/lib/mysql \ |
slaxemulator@13187 | 31 -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \ |
slaxemulator@13187 | 32 -DDEFAULT_CHARSET=utf8 \ |
slaxemulator@13187 | 33 -DDEFAULT_COLLATION=utf8_general_ci \ |
slaxemulator@13187 | 34 -DENABLED_LOCAL_INFILE=ON \ |
slaxemulator@13187 | 35 -DINSTALL_INFODIR=share/mysql/docs \ |
slaxemulator@13187 | 36 -DINSTALL_MANDIR=share/man \ |
slaxemulator@13187 | 37 -DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \ |
slaxemulator@13187 | 38 -DINSTALL_SCRIPTDIR=bin \ |
slaxemulator@13187 | 39 -DINSTALL_INCLUDEDIR=include/mysql \ |
slaxemulator@13187 | 40 -DINSTALL_DOCREADMEDIR=share/mysql \ |
slaxemulator@13187 | 41 -DINSTALL_SUPPORTFILESDIR=share/mysql \ |
slaxemulator@13187 | 42 -DINSTALL_MYSQLSHAREDIR=share/mysql \ |
slaxemulator@13187 | 43 -DINSTALL_DOCDIR=share/mysql/docs \ |
slaxemulator@13187 | 44 -DINSTALL_SHAREDIR=share/mysql \ |
slaxemulator@13187 | 45 -DWITH_READLINE=ON \ |
slaxemulator@13187 | 46 -DWITH_ZLIB=system \ |
slaxemulator@13187 | 47 -DWITH_SSL=system \ |
slaxemulator@13187 | 48 -DWITH_LIBWRAP=OFF \ |
slaxemulator@13187 | 49 -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \ |
slaxemulator@13187 | 50 -DWITH_EXTRA_CHARSETS=complex \ |
slaxemulator@13187 | 51 -DWITH_EMBEDDED_SERVER=ON \ |
slaxemulator@13187 | 52 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 53 -DWITH_PARTITION_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 54 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 55 -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \ |
slaxemulator@13187 | 56 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \ |
pascal@15265 | 57 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 && |
slaxemulator@13187 | 58 make && make DESTDIR=$DESTDIR install |
al@19741 | 59 |
al@19741 | 60 # fix paths |
al@19741 | 61 mv $install/usr/mysql-test $install/usr/share/mysql-test |
al@19741 | 62 mv $install/usr/sql-bench $install/usr/share/sql-bench |
al@19741 | 63 |
al@19741 | 64 # Configuration file |
al@19741 | 65 mkdir -p $install/etc |
al@19741 | 66 cp -a $stuff/etc/init.d $install/etc |
al@19741 | 67 cp -a $stuff/etc/mysql $install/etc |
al@19741 | 68 chown -R root:root $install/etc |
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 { |
al@19741 | 74 # client binaries (plus /usr/bin/mysql), see $src/build/client |
al@19741 | 75 client="mysql_plugin mysql_upgrade mysqladmin mysqlbinlog mysqlcheck \ |
al@19741 | 76 mysqldump mysqlimport mysqlshow mysqlslap mysqltest" |
pankso@4171 | 77 |
al@19741 | 78 case $PACKAGE in |
al@19741 | 79 mysql) |
al@19741 | 80 copy etc/ bin/ plugin/ /usr/share/mysql/ |
al@19741 | 81 for i in $client mysql mysql_config; do |
al@19741 | 82 rm $fs/usr/bin/$i |
al@19741 | 83 done |
al@19741 | 84 find $fs -name '*.m4' -delete |
al@19741 | 85 DEPENDS="libmysqlclient mysql-client slitaz-base-files \ |
al@19741 | 86 libcrypto libssl ncurses zlib" |
al@19741 | 87 CONFIG_FILES="/etc/mysql" |
al@19741 | 88 DATABASE_FILES="/var/lib/mysql" |
al@19741 | 89 TAZPANEL_DAEMON="man|edit::/etc/mysql/my.cnf|options|web::$WEB_SITE" |
al@19741 | 90 ;; |
al@19741 | 91 libmysqlclient) |
al@19741 | 92 copy libmysqlclient*so* |
al@19741 | 93 CAT="database|client libraries" |
al@19741 | 94 DEPENDS="libcrypto libssl zlib" |
al@19741 | 95 ;; |
al@19741 | 96 mysql-client) |
al@19741 | 97 copy /bin/mysql $client |
al@19741 | 98 CAT="database|client files" |
al@19741 | 99 PROVIDE="mysql_or_postgresql" |
al@19741 | 100 DEPENDS="libmysqlclient libcrypto libssl ncurses zlib" |
al@19741 | 101 ;; |
al@19741 | 102 mysql-test) |
al@19741 | 103 copy mysql-test/ sql-bench/ db.opt |
al@19741 | 104 CAT="development|tests and benchmarks" |
al@19741 | 105 DEPENDS="mysql perl" |
al@19741 | 106 ;; |
al@19741 | 107 *-dev) |
al@19741 | 108 copy @dev mysql_config |
al@19741 | 109 rm -r $fs/usr/share/mysql-test |
al@19741 | 110 ;; |
al@19741 | 111 esac |
pascal@1140 | 112 } |
pascal@1140 | 113 |
pascal@1140 | 114 # Pre and post install commands for Tazpkg. |
al@19741 | 115 pre_install_mysql() |
pascal@1140 | 116 { |
al@19741 | 117 # Cleanup old files |
al@19741 | 118 rm -f "$1/usr/libexec/mysql"* |
al@19741 | 119 # Move old config |
al@19741 | 120 [ -f "$1/etc/my.cnf" ] && mv -f "$1/etc/my.cnf" "$1/etc/mysql/my.cnf" |
al@19741 | 121 } |
al@19693 | 122 |
al@19741 | 123 post_install_mysql() |
al@19741 | 124 { |
al@19741 | 125 chmod 600 "$1/etc/mysql/my.cnf" |
al@19741 | 126 |
al@19741 | 127 local user=mysql group=mysql |
al@19693 | 128 |
pascal@18730 | 129 if ! grep -q $user "$1/etc/passwd"; then |
al@19693 | 130 action "Adding user/group $user..." |
pascal@18730 | 131 chroot "$1/" addgroup -S $group |
pascal@18730 | 132 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user |
erjo@7889 | 133 status |
erjo@7889 | 134 fi |
slaxemulator@13187 | 135 # adduser mysql if needed |
al@19741 | 136 if ! grep -q $user "$1/etc/passwd"; then |
al@19741 | 137 action "Adding MySQL Daemon user..." |
pascal@18730 | 138 chroot "$1/" /bin/adduser -s /bin/false -h /dev/null \ |
al@19741 | 139 -g "MySQL Daemon user" -u 27 -H -D -S -G $group $user |
slaxemulator@13187 | 140 status |
slaxemulator@13187 | 141 fi |
al@19741 | 142 #chroot "$1/" /bin/chown $user.$group $(cat "$1/$INSTALLED/$PACKAGE/files.list") |
al@19741 | 143 mkdir -p "$1/var/lib/mysql" |
al@19741 | 144 chroot "$1/" /bin/chown -R $user.$group /var/lib/mysql |
al@19741 | 145 chroot "$1/" mysql_install_db --user=$user --basedir=/usr |
al@19741 | 146 |
al@19693 | 147 [ -n "$quiet" ] || cat <<EOF |
pascal@1147 | 148 ---- |
al@19741 | 149 To start mysql server you can run: |
pascal@1147 | 150 |
al@19741 | 151 /etc/init.d/mysql start |
pascal@1147 | 152 |
al@19741 | 153 Or add mysql to RUN_DAEMONS in /etc/rcS.conf |
pascal@1147 | 154 ---- |
pascal@1147 | 155 EOF |
pascal@1140 | 156 } |
pascal@1140 | 157 |
al@19741 | 158 post_remove_mysql() |
pascal@1140 | 159 { |
slaxemulator@13187 | 160 echo "Removing user/group mysql" |
slaxemulator@13187 | 161 chroot "$1/" deluser mysql |
pascal@1140 | 162 } |
al@19741 | 163 |
al@19741 | 164 post_install_mysql_test() |
al@19741 | 165 { |
al@19741 | 166 chmod 2777 "$1/usr/share/mysql-test" |
al@19741 | 167 chmod 2777 "$1/usr/share/sql-bench" |
al@19741 | 168 } |