# $Id: Portfile 36515 2008-05-05 04:56:36Z ryandesign@macports.org $ PortSystem 1.0 name mysql5 version 5.0.51a set branch [join [lrange [split ${version} .] 0 1] .] homepage http://www.mysql.com/ categories databases platforms darwin maintainers ryandesign distname mysql-${version} use_parallel_build yes description \ Multithreaded SQL database server long_description \ MySQL is an open-source, multi-threaded SQL database \ with a command syntax very similar to mSQL. master_sites \ http://mysql.mirrors.pair.com/Downloads/MySQL-${branch}/ \ http://mysql.he.net/Downloads/MySQL-${branch}/ \ http://mysql.orst.edu/Downloads/MySQL-${branch} \ http://mysql.oss.eznetsols.org/Downloads/MySQL-${branch}/ \ http://mirrors.sunsite.dk/mysql/Downloads/MySQL-${branch}/ \ http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${branch}/ \ http://ftp.plusline.de/mysql/Downloads/MySQL-${branch}/ checksums \ md5 a83dbdbb91267daf73d2297a9c283dd1 \ sha1 adc83bcae6d04fccd6360dc3aa37c64aaa479a3d \ rmd160 869754150ea42f2fbad36f77eb9a0e7bb6e3892b depends_lib \ port:zlib \ port:openssl set major_version [strsed ${version} {s/\..*$//}] set mysql mysql${major_version} set dbdir ${prefix}/var/db/${mysql} set sysconfdir ${prefix}/etc/${mysql} set mysqluser mysql configure.args \ --mandir=${prefix}/share/man \ --infodir=${prefix}/share/info \ --localstatedir=${dbdir} \ --libdir=${prefix}/lib/${mysql} \ --bindir=${prefix}/lib/${mysql}/bin \ --includedir=${prefix}/include/${mysql} \ --datadir=${prefix}/share/${mysql} \ --sysconfdir=${sysconfdir} \ --with-zlib-dir=${prefix} \ --with-openssl=${prefix} \ --with-extra-charsets=complex \ --with-federated-storage-engine \ --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \ --with-mysqld-user=${mysqluser} \ --without-bench \ --enable-thread-safe-client variant server { # Create a startupitem to start/stop the server startupitem.create yes startupitem.start "${prefix}/share/${mysql}/mysql/mysql.server start" startupitem.stop "${prefix}/share/${mysql}/mysql/mysql.server stop" } pre-destroot { # Some directories we must have in all cases xinstall -m 755 -d ${destroot}${sysconfdir} destroot.keepdirs-append ${destroot}${sysconfdir} # Setup only for server if { [variant_isset server] } { addgroup ${mysqluser} set gid [existsgroup ${mysqluser}] adduser ${mysqluser} gid=${gid} realname=MySQL\ Server # Some directories we must have only if we're running as a server xinstall -m 755 -o root -d ${destroot}${prefix}/var/run xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \ ${destroot}${dbdir} \ ${destroot}${prefix}/var/run/${mysql} destroot.keepdirs-append \ ${destroot}${dbdir} \ ${destroot}${prefix}/var/run/${mysql} } } post-destroot { delete ${destroot}${prefix}/mysql-test # Fix paths in manpages and sample configuration files foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] { reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage} } foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] { reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile} } # Symlink mysql binaries into bin directory, with ${major_version} appended to the name foreach f [glob -tails -directory ${destroot}${prefix}/lib/${mysql}/bin my*] { ln -sf ../lib/${mysql}/bin/${f} ${destroot}${prefix}/bin/${f}${major_version} } } post-install { if { [variant_isset server] } { ui_msg "******************************************************" ui_msg "* In order to setup the database, you might want to run" ui_msg "* sudo -u ${mysqluser} mysql_install_db5" ui_msg "* if this is a new install" ui_msg "******************************************************" } } livecheck.check regex livecheck.url http://dev.mysql.com/ livecheck.regex >GA (${major_version}\\.\[0-9.\]+)<