# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 # $Id: Portfile 92949 2012-05-11 18:14:56Z ryandesign@macports.org $ PortSystem 1.0 name mysql55 set name_mysql ${name} version 5.5.23 categories databases platforms darwin license GPL-2 maintainers pixilla openmaintainer if {$subport == $name} { PortGroup archcheck 1.0 PortGroup cmake 1.0 PortGroup select 1.0 set branch [join [lrange [split ${version} .] 0 1] .] license GPL-2 description Multithreaded SQL database server long_description MySQL is an open-source, multi-threaded SQL database with a command \ syntax very similar to mSQL. homepage http://www.mysql.com/ master_sites \ http://mysql.he.net/Downloads/MySQL-${branch}/ \ http://mirrors.sunsite.dk/mysql/Downloads/MySQL-${branch}/ \ http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${branch}/ \ http://mirror.facebook.net/mysql/Downloads/MySQL-${branch}/ \ http://ftp.plusline.de/mysql/Downloads/MySQL-${branch}/ # This mirror has a bad distfile for version 5.5.23 # http://mysql.mirrors.pair.com/Downloads/MySQL-${branch}/ \ distname mysql-${version} use_parallel_build yes patch.pre_args -p1 patchfiles patch-cmake-install_layout.cmake.diff checksums rmd160 1c5b086be0b8f5e1f3128c160e1e4814f68dac95 \ sha256 20a6303e281ac7875997c6c5e34b1129a02d1fb3f886b8ccb2c7b958cd67746a depends_lib-append port:zlib \ port:readline \ port:cmake depends_run port:mysql_select select.group mysql select.file ${filespath}/${name} archcheck.files lib/libz.dylib \ lib/libreadline.dylib post-patch { reinplace "s|@NAME@|${name}|g" ${worksrcpath}/cmake/install_layout.cmake reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/cmake/install_layout.cmake } configure.args-delete \ -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib configure.args-append \ -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name} \ -DINSTALL_LAYOUT=MACPORTS \ -DSYSCONFDIR:PATH=${prefix}/etc/${name} \ -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name}/mysqld.sock \ -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name} \ -DFEATURE_SET:STRING=community \ -DDEFAULT_CHARSET:STRING=utf8 \ -DDEFAULT_COLLATION:STRING=utf8_general_ci \ -DWITH_EMBEDDED_SERVER:BOOL=OFF \ -DWITH_READLINE:BOOL=ON \ -DWITH_ZLIB:STRING=system \ -DWITH_UNIT_TESTS:BOOL=OFF \ -DENABLE_GCOV:BOOL=OFF \ -DENABLE_DTRACE:BOOL=OFF post-build { set dirs ${worksrcpath} foreach dir ${dirs} { reinplace -E {s|-arch [a-z0-9_]+||g} \ ${dir}/scripts/mysql_config \ ${dir}/scripts/mysqlbug } } pre-destroot { xinstall -m 755 -d ${destroot}${prefix}/etc/${name} destroot.keepdirs-append ${destroot}${prefix}/etc/${name} } post-destroot { # proc portdestroot::destroot_finish fails to find and compress our man pages # so borrow the compress command and run on our files now. set manpath "${destroot}${prefix}/share/man" set gzip [findBinary gzip ${portutil::autoconf::gzip_path}] foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name}/man\[1-9\]/*] { # Fix paths in manpages reinplace "s|/etc/|${prefix}/etc/${name}/|g" ${manpage} # Compress all manpages with gzip system "$gzip -9vf ${manpage}" } foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name}/support-files/my-*.cnf] { # Fix paths in sample configuration files reinplace "s|/etc/my.cnf|${prefix}/etc/${name}/my.cnf|g" ${samp_conffile} } } post-install { if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}-server.plist]} { ui_msg "The ${name} client has been installed." ui_msg "To install the ${name} server, install the ${name}-server port." } } variant openssl description {Enable OpenSSL support} { license-append OpenSSL SSLeay depends_lib-append port:openssl configure.args-append -DWITH_SSL:STRING=ON archcheck.files-append lib/libssl.dylib } livecheck.type regex livecheck.version [lindex [split ${version} -] 0] livecheck.url http://dev.mysql.com/ livecheck.regex "(${branch}(\.\[0-9.\]+)?)\[^<\]*" } subport ${name_mysql}-server { revision 1 license BSD description Run ${name_mysql} as server long_description ${description} supported_archs noarch distfiles depends_run port:${name_mysql} if {"darwin" == ${os.platform} && ${os.major} > 8} { set mysqluser _mysql } else { set mysqluser mysql } add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server startupitem.create yes startupitem.executable ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser} use_configure no build {} destroot { xinstall -m 755 -o root -d ${destroot}${prefix}/var/run xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \ ${destroot}${prefix}/etc/${name_mysql} \ ${destroot}${prefix}/var/db/${name_mysql} \ ${destroot}${prefix}/var/log/${name_mysql} \ ${destroot}${prefix}/var/run/${name_mysql} destroot.keepdirs-append \ ${destroot}${prefix}/var/db/${name_mysql} \ ${destroot}${prefix}/var/log/${name_mysql} \ ${destroot}${prefix}/var/run/${name_mysql} set fp [open "${destroot}${prefix}/etc/${name_mysql}/macports-default.cnf" "w"] puts $fp "# WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!" puts $fp "# Make your changes to ${prefix}/etc/${name_mysql}/my.cnf" puts $fp "# YOU HAVE BEEN WARNED!" puts $fp "" puts $fp "# MacPorts default options" puts $fp "\[mysqld\]" puts $fp "# skip-networking so multple mysql server ports can be loaded" puts $fp "# without each competing for port 3306." puts $fp "# One can always put the servers on different ports and" puts $fp "# remove or comment this option." puts $fp "skip-networking" close $fp } post-activate { if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} { set fp [open "${prefix}/etc/${name_mysql}/my.cnf" "w"] puts $fp "# Use default MacPorts settings" puts $fp "!include ${prefix}/etc/${name_mysql}/macports-default.cnf" close $fp } } notes " If this is a new install you might want to run: \$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/scripts/mysql_install_db " livecheck.type none }