diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-01 14:16:00 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-01 14:22:07 +0000 |
commit | 975befa3e304631a57dc469805d83bf86ac82d10 (patch) | |
tree | c0ada4324aae0fcc2ac1682eed734ecd2e1778c8 /main/mysql | |
parent | 77aff19e6d50d5443d646733229b5e149308a129 (diff) | |
download | aports-975befa3e304631a57dc469805d83bf86ac82d10.tar.bz2 aports-975befa3e304631a57dc469805d83bf86ac82d10.tar.xz |
main/mysql: upgrade to 5.5.10, again
* Create mysql-common subpackage for common files
* Fix dynamic linking for client apps
* Fix init.d script - let user create db with 'setup'
* Use my-medium.cnf example config as default config
Diffstat (limited to 'main/mysql')
-rw-r--r-- | main/mysql/0001-prefer-dynamic-library.patch | 72 | ||||
-rw-r--r-- | main/mysql/APKBUILD | 184 | ||||
-rw-r--r-- | main/mysql/mysql.initd | 63 | ||||
-rw-r--r-- | main/mysql/mysql.mycnf | 49 |
4 files changed, 250 insertions, 118 deletions
diff --git a/main/mysql/0001-prefer-dynamic-library.patch b/main/mysql/0001-prefer-dynamic-library.patch new file mode 100644 index 000000000..f2ff4da62 --- /dev/null +++ b/main/mysql/0001-prefer-dynamic-library.patch @@ -0,0 +1,72 @@ +From 7c79a4adc72407b7265bc1508f6950d505ab1a17 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Fri, 1 Apr 2011 12:58:59 +0000 +Subject: [PATCH] prefer dynamic library + +we link to the dynamic library *and* the static so we get all used +symbols in the client apps. + +Linking to dynamic will make mysql client 300k instead of 3M +--- + client/CMakeLists.txt | 20 ++++++++++---------- + 1 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt +index 80c5bbd..21c6a58 100644 +--- a/client/CMakeLists.txt ++++ b/client/CMakeLists.txt +@@ -28,41 +28,41 @@ INCLUDE_DIRECTORIES( + ADD_DEFINITIONS(${READLINE_DEFINES}) + ADD_DEFINITIONS(${SSL_DEFINES}) + MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc) +-TARGET_LINK_LIBRARIES(mysql mysqlclient) ++TARGET_LINK_LIBRARIES(mysql libmysql mysqlclient) + IF(UNIX) + TARGET_LINK_LIBRARIES(mysql ${READLINE_LIBRARY}) + ENDIF(UNIX) + + MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) + SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") +-TARGET_LINK_LIBRARIES(mysqltest mysqlclient regex) ++TARGET_LINK_LIBRARIES(mysqltest libmysql mysqlclient regex) + + + MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) +-TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient) ++TARGET_LINK_LIBRARIES(mysqlcheck libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) +-TARGET_LINK_LIBRARIES(mysqldump mysqlclient) ++TARGET_LINK_LIBRARIES(mysqldump libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) +-TARGET_LINK_LIBRARIES(mysqlimport mysqlclient) ++TARGET_LINK_LIBRARIES(mysqlimport libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c) +-TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient) ++TARGET_LINK_LIBRARIES(mysql_upgrade libmysql mysqlclient) + ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) + + MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c) +-TARGET_LINK_LIBRARIES(mysqlshow mysqlclient) ++TARGET_LINK_LIBRARIES(mysqlshow libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc) +-TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient) ++TARGET_LINK_LIBRARIES(mysqlbinlog libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc) +-TARGET_LINK_LIBRARIES(mysqladmin mysqlclient) ++TARGET_LINK_LIBRARIES(mysqladmin libmysql mysqlclient) + + MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) + SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") +-TARGET_LINK_LIBRARIES(mysqlslap mysqlclient) ++TARGET_LINK_LIBRARIES(mysqlslap libmysql mysqlclient) + + # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". + IF(WIN32) +-- +1.7.4.2 + diff --git a/main/mysql/APKBUILD b/main/mysql/APKBUILD index b77e322c3..518225a2b 100644 --- a/main/mysql/APKBUILD +++ b/main/mysql/APKBUILD @@ -1,82 +1,165 @@ # Contributor: Carlo Landmeter <clandmeter@gmail.com> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=mysql -pkgver=5.1.56 -pkgrel=0 +pkgver=5.5.10 +pkgrel=1 pkgdesc="A fast SQL database server" url="http://www.mysql.com/" pkgusers="mysql" pkggroups="mysql" arch="all" license='GPL' -depends= -makedepends="libtool readline-dev openssl-dev ncurses-dev zlib-dev" -source="http://ftp.sunet.se/pub/unix/databases/relational/mysql/Downloads/MySQL-5.1/mysql-$pkgver.tar.gz +depends="mysql-common" +makedepends="libtool readline-dev openssl-dev ncurses-dev zlib-dev cmake bison perl libaio-dev" +source="ftp://mirror.csclub.uwaterloo.ca/mysql/Downloads/MySQL-5.5/$pkgname-$pkgver.tar.gz + 0001-prefer-dynamic-library.patch $pkgname.initd - $pkgname.mycnf " -subpackages="$pkgname-doc $pkgname-dev $pkgname-test libmysqlclient $pkgname-client" +subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-test:mytest + $pkgname-common $pkgname-client $pkgname-bench" _builddir="$srcdir/$pkgname-$pkgver" prepare() { - cd $_builddir - sed -i -e 's/-lnsl //g' configure.in - sed -i -e 's/-lnsl //g' configure + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done } build() { - cd $_builddir - ./configure --prefix=/usr --libexecdir=/usr/sbin \ - --localstatedir=/var/lib/mysql \ - --disable-assembler \ - --with-pthread \ - --without-libwrap \ - --without-pstack \ - --without-docs \ - --without-embedded-server \ - --with-ssl \ - --without-debug \ - --with-unix-socket-path=/var/run/mysqld/mysqld.sock \ - --with-plugins=partition,archive,blackhole,csv,federated,heap,innobase,innodb_plugin,ndbcluster \ - --mandir=/usr/share/man \ + cd "$_builddir" + cmake . -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DDEFAULT_CHARSET=utf8 \ + -DDEFAULT_COLLATION=utf8_general_ci \ + -DENABLED_LOCAL_INFILE=ON \ + -DINSTALL_DOCDIR=share/doc/mysql \ + -DINSTALL_DOCREADMEDIR=share/doc/mysql \ + -DINSTALL_INCLUDEDIR=include/mysql \ + -DINSTALL_INFODIR=share/info \ + -DINSTALL_LAYOUT=RPM \ + -DINSTALL_MANDIR=share/man \ + -DINSTALL_MYSQLDATADIR="/var/lib/mysql" \ + -DINSTALL_MYSQLSHAREDIR=share/mysql \ + -DINSTALL_MYSQLTESTDIR=share/mysql-test \ + -DINSTALL_PLUGINDIR=lib/mysql/plugin \ + -DINSTALL_SCRIPTDIR=bin \ + -DINSTALL_SHAREDIR=share/mysql \ + -DINSTALL_SQLBENCHDIR=share \ + -DINSTALL_SUPPORTFILESDIR=share/mysql \ + -DMYSQL_DATADIR="/var/lib/mysql" \ + -DMYSQL_UNIX_ADDR="/var/run/mysqld/mysqld.sock" \ + -DSYSCONFDIR=/etc/mysql \ + -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 \ + -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 \ + -DWITHOUT_EMBEDDED_SERVER=ON \ + -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ + -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 \ + -DWITH_EXTRA_CHARSETS=complex \ + -DWITH_INNOBASE_STORAGE_ENGINE=1 \ + -DWITH_PARTITION_STORAGE_ENGINE=1 \ + -DWITH_READLINE=ON \ + -DWITH_SSL=system \ + -DWITH_ZLIB=system \ || return 1 make || return 1 } +# -DWITH_LIBWRAP=ON \ package() { - cd $_builddir - make -j1 DESTDIR="$pkgdir/" install || return 1 - install -Dm 755 "$startdir"/$pkgname.initd $pkgdir/etc/init.d/$pkgname \ - || return 1 - install -Dm 644 "$startdir"/$pkgname.mycnf $pkgdir/etc/mysql/my.cnf \ - || return 1 - install -dDo mysql $pkgdir/var/log/mysql || return 1 - install -dDo mysql $pkgdir/var/run/mysqld || return 1 + cd "$_builddir" + make DESTDIR="$pkgdir/" install || return 1 + + install -Dm 755 "$startdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname || return 1 + + # use small example config as default, which has tcp disabled + install -D "$pkgdir"/usr/share/mysql/my-medium.cnf \ + "$pkgdir"/etc/mysql/my.cnf || return 1 + + install -dDo mysql "$pkgdir"/var/log/mysql || return 1 + install -dDo mysql "$pkgdir"/var/run/mysqld || return 1 + + # libmysqlclient_r is no more. Upstream tries to replace it with + # symlinks but that really doesn't work (wrong soname in particular). + # We'll keep just the devel libmysqlclient_r.so link, so that + # rebuilding without any source change is enough to get rid of + # dependency on libmysqlclient_r. + rm -f "$pkgdir"/usr/lib/libmysqlclient_r.so* + ln -s libmysqlclient.so "$pkgdir"/usr/lib/libmysqlclient_r.so + + # mysql-test includes one executable that doesn't belong under + # /usr/share, so move it and provide a symlink + mv "$pkgdir"/usr/share/mysql-test/lib/My/SafeProcess/my_safe_process \ + "$pkgdir"/usr/bin + ln -s ../../../../../bin/my_safe_process \ + "$pkgdir"/usr/share/mysql-test/lib/My/SafeProcess/my_safe_process + } -libmysqlclient() { +libs() { pkgdesc="MySQL client library" # some files moved + replaces="mysql libmysqlclient" + depends="mysql-common" + mkdir -p "$subpkgdir"/usr/lib \ + "$subpkgdir"/usr/share/mysql \ + || return 1 + mv "$pkgdir"/usr/lib/libmysqlclient.so* \ + "$subpkgdir"/usr/lib/ || return 1 +} + +common() { + pkgdesc="MySQL common files for both server and client" replaces="mysql" - mkdir -p "$subpkgdir"/usr/lib/mysql || return 1 - mv "$pkgdir"/usr/lib/mysql/libmysqlclient.so* \ - "$pkgdir"/usr/lib/mysql/libmysqlclient_r.so* \ - "$subpkgdir"/usr/lib/mysql || return 1 - # make symlinks - cd "$subpkgdir"/usr/lib || return 1 - for i in mysql/*; do - ln -s "$i" "${i##*/}" || return 1 - done + mkdir -p "$subpkgdir"/usr/share/mysql \ + mv "$pkgdir"/etc "$subpkgdir"/ || return 1 + mv "$pkgdir"/usr/share/mysql/english \ + "$pkgdir"/usr/share/mysql/czech \ + "$pkgdir"/usr/share/mysql/danish \ + "$pkgdir"/usr/share/mysql/dutch \ + "$pkgdir"/usr/share/mysql/estonian \ + "$pkgdir"/usr/share/mysql/french \ + "$pkgdir"/usr/share/mysql/german \ + "$pkgdir"/usr/share/mysql/greek \ + "$pkgdir"/usr/share/mysql/hungarian \ + "$pkgdir"/usr/share/mysql/italian \ + "$pkgdir"/usr/share/mysql/japanese \ + "$pkgdir"/usr/share/mysql/korean \ + "$pkgdir"/usr/share/mysql/norwegian \ + "$pkgdir"/usr/share/mysql/norwegian-ny \ + "$pkgdir"/usr/share/mysql/polish \ + "$pkgdir"/usr/share/mysql/portuguese \ + "$pkgdir"/usr/share/mysql/romanian \ + "$pkgdir"/usr/share/mysql/russian \ + "$pkgdir"/usr/share/mysql/serbian \ + "$pkgdir"/usr/share/mysql/slovak \ + "$pkgdir"/usr/share/mysql/spanish \ + "$pkgdir"/usr/share/mysql/swedish \ + "$pkgdir"/usr/share/mysql/ukrainian \ + "$pkgdir"/usr/share/mysql/charsets \ + "$subpkgdir"/usr/share/mysql/ \ + || return 1 } -test() { +mytest() { + pkgdesc="The test suite distributed with MySQL" mkdir -p "$subpkgdir"/usr || return 1 - mv "$pkgdir"/usr/mysql-test "$subpkgdir"/usr/ || return 1 + mv "$pkgdir"/usr/share/mysql-test \ + "$subpkgdir"/usr/share/ \ + || return 1 + mv "$pkgdir"/usr/bin/mysql_client_test \ + "$pkgdir"/usr/bin/my_safe_process \ + "$pkgdir"/usr/bin/ \ + || return 1 } client() { pkgdesc="client for the MySQL database" + depends="mysql-common" install="" local bins="myisam_ftdump mysql mysqlaccess mysqladmin mysqlbug mysqlcheck mysql_client_test mysqldump mysqldumpslow mysql_find_rows @@ -89,6 +172,13 @@ client() { done } -md5sums="15161d67f4830aad3a8a89e083749d49 mysql-5.1.56.tar.gz -25d08b02bff6aa379dc45859b7a3f28a mysql.initd -15a7e3ddd6a40bf5a1eb3a8c69d9c34c mysql.mycnf" +bench() { + pkgdesc="MySQL benchmark scripts and data" + replaces="mysql" + mkdir -p "$subpkgdir"/usr/share/ + mv "$pkgdir"/usr/share/sql-bench "$subpkgdir"/usr/share/ +} + +md5sums="ee604aff531ff85abeb10cf332c1355a mysql-5.5.10.tar.gz +4e07e045a3abcb457c9c148dfd929ed6 0001-prefer-dynamic-library.patch +d46df8ab94cb5686862ff90c0a6bf707 mysql.initd" diff --git a/main/mysql/mysql.initd b/main/mysql/mysql.initd index c55b76121..698067d49 100644 --- a/main/mysql/mysql.initd +++ b/main/mysql/mysql.initd @@ -1,39 +1,58 @@ #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql.init,v 1.7 2004/07/14 21:41:15 agriffis Exp $ + +opts="${opts} setup" +pidfile=/var/run/mysqld/mysqld.pid depend() { - need net - after firewall - use dns + need net + after firewall + use dns +} + +setup() { + ebegin "Creating a new MySQL database" + mysql_install_db --user=mysql --rpm + eend $? } checkconfig() { - if [ ! -f /etc/mysql/my.cnf ] ; then - eerror "No /etc/mysql/my.cnf file exists!" - fi + if [ ! -f /etc/mysql/my.cnf ] ; then + eerror "No /etc/mysql/my.cnf file exists!" + fi - dir=`my_print_defaults -c /etc/mysql/my.cnf mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"` + dir=`my_print_defaults mysqld | grep -- --datadir | sed -e "s|^.*=\(.*\)|\1|"` - if [ ! -d $dir/mysql ] ; then - eerror "You dont appear to have the mysql database installed yet." - eerror "Please run /usr/bin/mysql_install_db --user=mysql to have this done..." - return 1 - fi + dir=${dir:-/var/lib/mysql} + [ -d ${dir}/mysql ] && return 0 + + if [ -z "$AUTO_SETUP" ] ; then + eerror "Database not found in $dir" + eerror "You can run '/etc/init.d/mysql setup' to setup a new database." + return 1 + fi + setup } start() { - checkconfig || return 1 - ebegin "Starting mysqld" - /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf >/dev/null 2>&1 & - eend $? + checkconfig || return 1 + ebegin "Starting mysqld" + start-stop-daemon --pidfile $pidfile \ + --start \ + --background \ + --stdout /dev/null \ + --stderr /dev/null \ + --wait 500 \ + -- \ + /usr/bin/mysqld_safe --pid-file=$pidfile + eend $? } stop () { - ebegin "Stopping mysqld" - start-stop-daemon --stop --quiet \ - --pidfile=/var/run/mysqld/mysqld.pid --retry 20 - eend $? + ebegin "Stopping mysqld" + start-stop-daemon --stop --quiet \ + --pidfile $pidfile --retry 20 + eend $? } - diff --git a/main/mysql/mysql.mycnf b/main/mysql/mysql.mycnf deleted file mode 100644 index 6df0334ef..000000000 --- a/main/mysql/mysql.mycnf +++ /dev/null @@ -1,49 +0,0 @@ -# The following values assume you have at least 32M RAM! - -[client] -#password = my_password -port = 3306 -socket = /var/run/mysqld/mysqld.sock - -[safe_mysqld] -err-log = /var/log/mysql/mysql.err - -[mysqld] -# this disabled mysqld from listing on any interface. -# Use localhost to connect to socket -# If you need networking comment out the following line -skip-networking - -# If innodb is needed commend next line -# if not leave this to increase performance -skip-innodb - -innodb_file_per_table -user = mysql -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -port = 3306 - -# Only enable this if you really need it -# eats resources. -#log = /var/log/mysql/mysql.log - -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -language = /usr/share/mysql/english -skip-locking -set-variable = key_buffer=16M -set-variable = max_allowed_packet=1M -set-variable = thread_stack=128K - -[mysqldump] -quick -set-variable = max_allowed_packet=1M - -[mysql] -#no-auto-rehash # faster start of mysql but no tab completition - -[isamchk] -set-variable = key_buffer=16M - |