source: trunk/dports/databases/mysql55/Portfile @ 117144

Last change on this file since 117144 was 117144, checked in by pixilla@…, 6 years ago

databases/mysql55:

  • Update to version 5.5.36.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.3 KB
RevLine 
[87459]1# -*- 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
2# $Id: Portfile 117144 2014-02-17 18:05:45Z pixilla@macports.org $
3
[90896]4PortSystem          1.0
[87459]5
[90896]6name                mysql55
[92370]7set name_mysql      ${name}
[117144]8version             5.5.36
[108938]9# Set revision_client and revision_server to 0 if you bump version.
[117144]10set revision_client 0
[94746]11set revision_server 0
[108938]12set version_branch  [join [lrange [split ${version} .] 0 1] .]
[90896]13categories          databases
14platforms           darwin
[92370]15license             GPL-2
[90896]16maintainers         pixilla openmaintainer
[97294]17homepage            http://www.mysql.com/
[87459]18
[108938]19if {${subport} eq ${name}} {
[87459]20
[90896]21    PortGroup           archcheck 1.0
22    PortGroup           cmake 1.0
23    PortGroup           select 1.0
[93231]24
[93312]25    revision            ${revision_client}
[90896]26    license             GPL-2
27    description         Multithreaded SQL database server
[107235]28    long_description    MySQL is an open-source, multi-threaded SQL database.
[93231]29
[111521]30    master_sites        mysql:MySQL-${version_branch}
[92591]31
[90896]32    distname            mysql-${version}
33    use_parallel_build  yes
[93231]34
[90896]35    patch.pre_args      -p1
[94746]36    patchfiles          patch-cmake-install_layout.cmake.diff
[93196]37
[117144]38    checksums           rmd160  7651338751545a30652836d9c7bb0d3102592180 \
39                        sha256  30f2cde5bf854cf1ef74ecd1ae2f6e5e9ec7d11eb5b50643e1aa91c911c75897
[93231]40
[100155]41    depends_lib-append  port:zlib port:tcp_wrappers
[94746]42    depends_run-append  port:mysql_select
[93231]43
[90896]44    select.group        mysql
[93521]45    select.file         ${filespath}/${name_mysql}
[93231]46
[100155]47    archcheck.files     lib/libz.dylib lib/libwrap.dylib
[93231]48
[94746]49    post-extract {
50        file mkdir ${worksrcpath}/build_macports/macports
51        copy ${filespath}/macports-default.cnf \
52            ${filespath}/my.cnf \
53            ${worksrcpath}/build_macports/macports/
54    }
55
[90896]56    post-patch {
[94746]57        reinplace "s|@NAME@|${name_mysql}|g" \
58            ${worksrcpath}/cmake/install_layout.cmake
59        reinplace "s|@NAME@|${name_mysql}|g" \
60            ${worksrcpath}/build_macports/macports/macports-default.cnf \
61            ${worksrcpath}/build_macports/macports/my.cnf
62        reinplace "s|@PREFIX@|${prefix}|g" \
63            ${worksrcpath}/build_macports/macports/macports-default.cnf \
64            ${worksrcpath}/build_macports/macports/my.cnf
[87459]65    }
[93231]66
[94746]67    configure.cmd       cmake ..
68    configure.dir       ${worksrcpath}/build_macports
69    build.dir           ${worksrcpath}/build_macports
70
[90896]71    configure.args-delete \
72                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
73    configure.args-append \
[93521]74                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
[93312]75                        -DINSTALL_LAYOUT:STRING=MACPORTS \
[93521]76                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
77                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
78                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
[90896]79                        -DDEFAULT_CHARSET:STRING=utf8 \
80                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
[100155]81                        -DWITH_EMBEDDED_SERVER:BOOL=ON \
[90896]82                        -DWITH_ZLIB:STRING=system \
[94746]83                        -DWITH_UNIT_TESTS:BOOL=ON \
[90896]84                        -DENABLE_GCOV:BOOL=OFF \
[93521]85                        -DENABLE_DTRACE:BOOL=OFF \
86                        -DWITH_READLINE:BOOL=ON \
87                        -DWITH_LIBEDIT:BOOL=OFF \
[94746]88                        -DWITH_LIBWRAP:BOOL=ON \
[100155]89                        -DWITH_SSL:STRING=no
[93231]90
[90896]91    post-build {
[94746]92        set dirs ${worksrcpath}/build_macports
[90896]93        foreach dir ${dirs} {
94            reinplace -E {s|-arch [a-z0-9_]+||g} \
95                ${dir}/scripts/mysql_config \
96                ${dir}/scripts/mysqlbug
[87967]97        }
98    }
[93231]99
[90896]100    post-destroot {
[90903]101        # proc portdestroot::destroot_finish fails to find and compress our man pages
102        # so borrow the compress command and run on our files now.
103        set manpath "${destroot}${prefix}/share/man"
104        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
[93521]105        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
[90903]106            # Fix paths in manpages
[93521]107            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
[90903]108            # Compress all manpages with gzip
109            system "$gzip -9vf ${manpage}"
[90896]110        }
[93521]111        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
[90903]112            # Fix paths in sample configuration files
[93521]113            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
[90896]114        }
[94746]115        xinstall -m 755 -o root -d \
116            ${destroot}${prefix}/etc/${name_mysql}
117        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
118            ${destroot}${prefix}/etc/${name_mysql}/
119        xinstall -m 755 -o root -d \
120            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
121        copy ${worksrcpath}/build_macports/macports/my.cnf \
122            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
[87459]123    }
[93231]124
[90896]125    post-install {
[93521]126        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
127            ui_msg "The ${name_mysql} client has been installed."
128            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
[90896]129        }
[87459]130    }
[93231]131
[94746]132    pre-activate {
[97294]133        # The macports-default.cnf is installed by ${name_mysql}.
134        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
135        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
[94746]136        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
137            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
138            && [vercmp [lindex $vers 1] 5.5.25] < 0 } {
[99736]139
140            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
[94746]141        }
142    }
143
144    post-activate {
145        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
146            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
147                ${prefix}/etc/${name_mysql}/
148        }
149    }
150
[90896]151    variant openssl description {Enable OpenSSL support} {
[93231]152
[90896]153        depends_lib-append      port:openssl
[94746]154        configure.args-delete   -DWITH_SSL:STRING=no
155        configure.args-append   -DWITH_SSL:STRING=system
[92370]156        archcheck.files-append  lib/libssl.dylib
[90896]157    }
[93231]158
[93312]159    variant system_readline description {Use system readline instead of bundled readline} {
160   
161        # Add readline support.
[93521]162        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
[93312]163        # of readline but use the system's (i.e. MacPorts') copy of readline"
164        depends_lib-append      port:readline
[93521]165        configure.args-delete   -DWITH_READLINE:BOOL=ON
166        configure.args-append   -DWITH_READLINE:BOOL=OFF
[93312]167        archcheck.files-append  lib/libreadline.dylib
168    }
169
[111521]170    notes "
171On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one
172will be created which loads
173${prefix}/etc/${name_mysql}/macports-default.cnf.
174
175If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not
176touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf
[111522]177will be preserved (e.g., during port upgrades, deactivations or
178activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to
179customize your ${name_mysql} installation.
[111521]180
181Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf
182will be lost during port upgrades, deactivations or activations so you
183are advised to not make changes here. Currently
184${prefix}/etc/${name_mysql}/macports-default.cnf contains only one
185directive; to disable networking. With disabled networking it is
186possible to install and have running all the MacPorts mysql ports
187simultaneously.
188"
189
[90896]190    livecheck.type          regex
[107235]191    livecheck.url           http://dev.mysql.com/downloads/mysql/${version_branch}.html
192    livecheck.regex         "<h1>MySQL Community Server (${version_branch}(\.\[0-9.\]+)?)</h1>"
[87459]193}
194
[92370]195subport ${name_mysql}-server {
196
[93312]197    revision            ${revision_server}
[92370]198    license             BSD
199    description         Run ${name_mysql} as server
200    long_description    ${description}
[93231]201
[92370]202    supported_archs     noarch
[90896]203    distfiles
[93231]204
[92370]205    depends_run         port:${name_mysql}
[93231]206
[108938]207    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
[90896]208        set mysqluser       _mysql
209    } else {
210        set mysqluser       mysql
[87459]211    }
[90896]212    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
[93231]213
[90896]214    startupitem.create      yes
[92370]215    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
[93231]216
[92370]217    use_configure       no
[93231]218
[90896]219    build {}
[93231]220
[90896]221    destroot {
[94746]222        xinstall -m 755 -o root -d \
223            ${destroot}${prefix}/var/run
[90896]224        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
[92370]225            ${destroot}${prefix}/etc/${name_mysql} \
226            ${destroot}${prefix}/var/db/${name_mysql} \
227            ${destroot}${prefix}/var/log/${name_mysql} \
228            ${destroot}${prefix}/var/run/${name_mysql}
[90896]229        destroot.keepdirs-append  \
[92370]230            ${destroot}${prefix}/var/db/${name_mysql} \
231            ${destroot}${prefix}/var/log/${name_mysql} \
232            ${destroot}${prefix}/var/run/${name_mysql}
[90896]233    }
[93231]234
[90896]235    notes "
[92949]236If this is a new install you might want to run:
237
[93314]238\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
[92949]239"
[93231]240
[90896]241    livecheck.type          none
[91233]242}
Note: See TracBrowser for help on using the repository browser.