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
Line 
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
4PortSystem          1.0
5
6name                mysql55
7set name_mysql      ${name}
8version             5.5.36
9# Set revision_client and revision_server to 0 if you bump version.
10set revision_client 0
11set revision_server 0
12set version_branch  [join [lrange [split ${version} .] 0 1] .]
13categories          databases
14platforms           darwin
15license             GPL-2
16maintainers         pixilla openmaintainer
17homepage            http://www.mysql.com/
18
19if {${subport} eq ${name}} {
20
21    PortGroup           archcheck 1.0
22    PortGroup           cmake 1.0
23    PortGroup           select 1.0
24
25    revision            ${revision_client}
26    license             GPL-2
27    description         Multithreaded SQL database server
28    long_description    MySQL is an open-source, multi-threaded SQL database.
29
30    master_sites        mysql:MySQL-${version_branch}
31
32    distname            mysql-${version}
33    use_parallel_build  yes
34
35    patch.pre_args      -p1
36    patchfiles          patch-cmake-install_layout.cmake.diff
37
38    checksums           rmd160  7651338751545a30652836d9c7bb0d3102592180 \
39                        sha256  30f2cde5bf854cf1ef74ecd1ae2f6e5e9ec7d11eb5b50643e1aa91c911c75897
40
41    depends_lib-append  port:zlib port:tcp_wrappers
42    depends_run-append  port:mysql_select
43
44    select.group        mysql
45    select.file         ${filespath}/${name_mysql}
46
47    archcheck.files     lib/libz.dylib lib/libwrap.dylib
48
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
56    post-patch {
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
65    }
66
67    configure.cmd       cmake ..
68    configure.dir       ${worksrcpath}/build_macports
69    build.dir           ${worksrcpath}/build_macports
70
71    configure.args-delete \
72                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
73    configure.args-append \
74                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
75                        -DINSTALL_LAYOUT:STRING=MACPORTS \
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} \
79                        -DDEFAULT_CHARSET:STRING=utf8 \
80                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
81                        -DWITH_EMBEDDED_SERVER:BOOL=ON \
82                        -DWITH_ZLIB:STRING=system \
83                        -DWITH_UNIT_TESTS:BOOL=ON \
84                        -DENABLE_GCOV:BOOL=OFF \
85                        -DENABLE_DTRACE:BOOL=OFF \
86                        -DWITH_READLINE:BOOL=ON \
87                        -DWITH_LIBEDIT:BOOL=OFF \
88                        -DWITH_LIBWRAP:BOOL=ON \
89                        -DWITH_SSL:STRING=no
90
91    post-build {
92        set dirs ${worksrcpath}/build_macports
93        foreach dir ${dirs} {
94            reinplace -E {s|-arch [a-z0-9_]+||g} \
95                ${dir}/scripts/mysql_config \
96                ${dir}/scripts/mysqlbug
97        }
98    }
99
100    post-destroot {
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}]
105        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
106            # Fix paths in manpages
107            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
108            # Compress all manpages with gzip
109            system "$gzip -9vf ${manpage}"
110        }
111        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
112            # Fix paths in sample configuration files
113            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
114        }
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/
123    }
124
125    post-install {
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."
129        }
130    }
131
132    pre-activate {
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.
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 } {
139
140            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
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
151    variant openssl description {Enable OpenSSL support} {
152
153        depends_lib-append      port:openssl
154        configure.args-delete   -DWITH_SSL:STRING=no
155        configure.args-append   -DWITH_SSL:STRING=system
156        archcheck.files-append  lib/libssl.dylib
157    }
158
159    variant system_readline description {Use system readline instead of bundled readline} {
160   
161        # Add readline support.
162        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
163        # of readline but use the system's (i.e. MacPorts') copy of readline"
164        depends_lib-append      port:readline
165        configure.args-delete   -DWITH_READLINE:BOOL=ON
166        configure.args-append   -DWITH_READLINE:BOOL=OFF
167        archcheck.files-append  lib/libreadline.dylib
168    }
169
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
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.
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
190    livecheck.type          regex
191    livecheck.url           http://dev.mysql.com/downloads/mysql/${version_branch}.html
192    livecheck.regex         "<h1>MySQL Community Server (${version_branch}(\.\[0-9.\]+)?)</h1>"
193}
194
195subport ${name_mysql}-server {
196
197    revision            ${revision_server}
198    license             BSD
199    description         Run ${name_mysql} as server
200    long_description    ${description}
201
202    supported_archs     noarch
203    distfiles
204
205    depends_run         port:${name_mysql}
206
207    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
208        set mysqluser       _mysql
209    } else {
210        set mysqluser       mysql
211    }
212    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
213
214    startupitem.create      yes
215    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
216
217    use_configure       no
218
219    build {}
220
221    destroot {
222        xinstall -m 755 -o root -d \
223            ${destroot}${prefix}/var/run
224        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
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}
229        destroot.keepdirs-append  \
230            ${destroot}${prefix}/var/db/${name_mysql} \
231            ${destroot}${prefix}/var/log/${name_mysql} \
232            ${destroot}${prefix}/var/run/${name_mysql}
233    }
234
235    notes "
236If this is a new install you might want to run:
237
238\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
239"
240
241    livecheck.type          none
242}
Note: See TracBrowser for help on using the repository browser.