# $Id: Portfile 46399 2009-02-04 05:14:44Z ryandesign@macports.org $ PortSystem 1.0 name mysql5-devel version 5.1.30 revision 2 set branch [join [lrange [split ${version} .] 0 1] .] homepage http://www.mysql.com/ categories databases platforms darwin maintainers jwa ryandesign distname mysql-${version} dist_subdir mysql5 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://dev.mysql.com/get/Downloads/MySQL-${branch}/ \ 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}/ \ http://www.innodb.com/download/innodb_plugin/:plugin checksums \ ${distname}${extract.suffix} \ md5 b658e58887a74dce65224ae0fc8ee06a \ sha1 10f8828818254c06357b28f0b1fa6196dfbecbe8 \ rmd160 ff3504161cf200f9bca57d7799e1efa1cf203807 depends_lib \ port:zlib \ port:openssl set major_version [strsed ${version} {s/\..*$//}] set mysql mysql${major_version} set libdir ${prefix}/lib/${mysql} set bindir ${libdir}/bin set dbdir ${prefix}/var/db/${mysql} set sysconfdir ${prefix}/etc/${mysql} set mysqluser mysql patchfiles \ patch-mysql_secure_installation.sh.diff post-patch { reinplace s%@BINDIR@%${bindir}%g ${worksrcpath}/scripts/mysql_secure_installation.sh } configure.args \ --mandir=${prefix}/share/man \ --infodir=${prefix}/share/info \ --localstatedir=${dbdir} \ --libdir=${libdir} \ --bindir=${bindir} \ --includedir=${prefix}/include/${mysql} \ --datadir=${prefix}/share/${mysql} \ --sysconfdir=${sysconfdir} \ --with-zlib-dir=${prefix} \ --with-ssl=${prefix} \ --with-extra-charsets=complex \ --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \ --with-mysqld-user=${mysqluser} \ --without-docs \ --without-bench \ --with-partition \ --with-plugins=all \ --enable-thread-safe-client # the following is in store for future # --program-suffix=5 post-configure { reinplace "s;openssl_includes = -I;openssl_includes_includes = -I${prefix}/include/openssl;" ${worksrcpath}/tests/Makefile } platform darwin 6 { pre-fetch { return -code error "no support for systems prior to 10.3" } } platform darwin 8 { configure.cppflags-append -I${worksrcpath}/include } variant embedded_server description "Build libmysqld embedded server" { configure.cflags-append -fPIC configure.cxxflags-append -fPIC configure.args-append --with-embedded-server \ --with-pic } variant server description {add a startup item} { # 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" } set plugin_version 1.0.2 set plugin_distname innodb_plugin-${plugin_version} set plugin_distfile ${plugin_distname}${extract.suffix} set plugin_worksrcdir ${plugin_distname} set plugin_worksrcpath ${workpath}/${plugin_worksrcdir} set innobase_dir storage/innobase variant innodb_plugin description "Install the InnoDB plugin Early Adopter release ${plugin_version}" { distfiles-append ${plugin_distfile}:plugin checksums-append \ ${plugin_distfile} \ md5 6528c6cabd71b0714f38bbe648b1019c \ sha1 99cf457b489fe844a625aede8174c1cc708ed323 \ rmd160 a2076329d906bda9a489e9c411002544cf7a2b5c post-extract { delete ${worksrcpath}/${innobase_dir} move ${plugin_worksrcpath} ${worksrcpath}/${innobase_dir} } } # the directories ${prefix}/sql-bench ${prefix}/mysql-test destroot.violate_mtree yes 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}${bindir} my*] { ln -sf ${bindir}/${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 "(5\\.1\\.\[0-9\.\]+)"