# -*- 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 117144 2014-02-17 18:05:45Z pixilla@macports.org $ PortSystem 1.0 name mysql55 set name_mysql ${name} version 5.5.36 # Set revision_client and revision_server to 0 if you bump version. set revision_client 0 set revision_server 0 set version_branch [join [lrange [split ${version} .] 0 1] .] categories databases platforms darwin license GPL-2 maintainers pixilla openmaintainer homepage http://www.mysql.com/ if {${subport} eq ${name}} { PortGroup archcheck 1.0 PortGroup cmake 1.0 PortGroup select 1.0 revision ${revision_client} license GPL-2 description Multithreaded SQL database server long_description MySQL is an open-source, multi-threaded SQL database. master_sites mysql:MySQL-${version_branch} distname mysql-${version} use_parallel_build yes patch.pre_args -p1 patchfiles patch-cmake-install_layout.cmake.diff checksums rmd160 7651338751545a30652836d9c7bb0d3102592180 \ sha256 30f2cde5bf854cf1ef74ecd1ae2f6e5e9ec7d11eb5b50643e1aa91c911c75897 depends_lib-append port:zlib port:tcp_wrappers depends_run-append port:mysql_select select.group mysql select.file ${filespath}/${name_mysql} archcheck.files lib/libz.dylib lib/libwrap.dylib post-extract { file mkdir ${worksrcpath}/build_macports/macports copy ${filespath}/macports-default.cnf \ ${filespath}/my.cnf \ ${worksrcpath}/build_macports/macports/ } post-patch { reinplace "s|@NAME@|${name_mysql}|g" \ ${worksrcpath}/cmake/install_layout.cmake reinplace "s|@NAME@|${name_mysql}|g" \ ${worksrcpath}/build_macports/macports/macports-default.cnf \ ${worksrcpath}/build_macports/macports/my.cnf reinplace "s|@PREFIX@|${prefix}|g" \ ${worksrcpath}/build_macports/macports/macports-default.cnf \ ${worksrcpath}/build_macports/macports/my.cnf } configure.cmd cmake .. configure.dir ${worksrcpath}/build_macports build.dir ${worksrcpath}/build_macports configure.args-delete \ -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib configure.args-append \ -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \ -DINSTALL_LAYOUT:STRING=MACPORTS \ -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \ -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \ -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \ -DDEFAULT_CHARSET:STRING=utf8 \ -DDEFAULT_COLLATION:STRING=utf8_general_ci \ -DWITH_EMBEDDED_SERVER:BOOL=ON \ -DWITH_ZLIB:STRING=system \ -DWITH_UNIT_TESTS:BOOL=ON \ -DENABLE_GCOV:BOOL=OFF \ -DENABLE_DTRACE:BOOL=OFF \ -DWITH_READLINE:BOOL=ON \ -DWITH_LIBEDIT:BOOL=OFF \ -DWITH_LIBWRAP:BOOL=ON \ -DWITH_SSL:STRING=no post-build { set dirs ${worksrcpath}/build_macports foreach dir ${dirs} { reinplace -E {s|-arch [a-z0-9_]+||g} \ ${dir}/scripts/mysql_config \ ${dir}/scripts/mysqlbug } } 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_mysql}/man\[1-9\]/*] { # Fix paths in manpages reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage} # Compress all manpages with gzip system "$gzip -9vf ${manpage}" } foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] { # Fix paths in sample configuration files reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile} } xinstall -m 755 -o root -d \ ${destroot}${prefix}/etc/${name_mysql} copy ${worksrcpath}/build_macports/macports/macports-default.cnf \ ${destroot}${prefix}/etc/${name_mysql}/ xinstall -m 755 -o root -d \ ${destroot}${prefix}/share/${name_mysql}/support-files/macports copy ${worksrcpath}/build_macports/macports/my.cnf \ ${destroot}${prefix}/share/${name_mysql}/support-files/macports/ } post-install { if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} { ui_msg "The ${name_mysql} client has been installed." ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port." } } pre-activate { # The macports-default.cnf is installed by ${name_mysql}. # Early versions of ${name_mysql}-server installed macports-default.cnf so for a # reasonable period we need to deactivate older versions of the ${name_mysql}-server. if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf] && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}] && [vercmp [lindex $vers 1] 5.5.25] < 0 } { registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1] } } post-activate { if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} { copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \ ${prefix}/etc/${name_mysql}/ } } variant openssl description {Enable OpenSSL support} { depends_lib-append port:openssl configure.args-delete -DWITH_SSL:STRING=no configure.args-append -DWITH_SSL:STRING=system archcheck.files-append lib/libssl.dylib } variant system_readline description {Use system readline instead of bundled readline} { # Add readline support. # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy # of readline but use the system's (i.e. MacPorts') copy of readline" depends_lib-append port:readline configure.args-delete -DWITH_READLINE:BOOL=ON configure.args-append -DWITH_READLINE:BOOL=OFF archcheck.files-append lib/libreadline.dylib } notes " On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one will be created which loads ${prefix}/etc/${name_mysql}/macports-default.cnf. If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf will be preserved (e.g., during port upgrades, deactivations or activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to customize your ${name_mysql} installation. Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf will be lost during port upgrades, deactivations or activations so you are advised to not make changes here. Currently ${prefix}/etc/${name_mysql}/macports-default.cnf contains only one directive; to disable networking. With disabled networking it is possible to install and have running all the MacPorts mysql ports simultaneously. " livecheck.type regex livecheck.url http://dev.mysql.com/downloads/mysql/${version_branch}.html livecheck.regex "

MySQL Community Server (${version_branch}(\.\[0-9.\]+)?)

" } subport ${name_mysql}-server { revision ${revision_server} license BSD description Run ${name_mysql} as server long_description ${description} supported_archs noarch distfiles depends_run port:${name_mysql} if {"darwin" eq ${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} } notes " If this is a new install you might want to run: \$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db " livecheck.type none }