source: trunk/dports/databases/percona/Portfile @ 97682

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

databases/percona:

  • Update to version 5.5.27-28.1. Closes #36106
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.0 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 97682 2012-09-12 00:40:25Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                percona
7set name_mysql      ${name}
8set version_mysql   5.5.27
9set release         28.1
10# Please set revision_client and revision_server to 0 if you bump version_mysql or release.
11set revision_client 0
12set revision_server 0
13version             ${version_mysql}-${release}
14categories          databases
15platforms           darwin
16license             GPL-2
17maintainers         mac.com:quest openmaintainer
18homepage            http://www.percona.com/
19
20if {$subport == $name} {
21
22    PortGroup           archcheck 1.0
23    PortGroup           cmake 1.0
24    PortGroup           select 1.0
25
26    set version_branch  [join [lrange [split ${version} .] 0 1] .]
27    set version_manual  [join [lrange [split ${version} .] 0 1] {}]
28
29    revision            ${revision_client}
30    license             GPL-2
31    description         Multithreaded SQL database server
32    long_description    MySQL is an open-source, multi-threaded SQL database with a command \
33                        syntax very similar to mSQL.
34
35    master_sites \
36    http://www.percona.com/redir/downloads/Percona-Server-${version_branch}/Percona-Server-${version}/source/:src \
37    http://form.percona.com/rs/percona/images/:pdf
38
39    distname            Percona-Server-${version_mysql}-rel${release}
40    distfiles           ${distname}${extract.suffix}:src
41    use_parallel_build  yes
42
43    patch.pre_args      -p1
44    patchfiles          patch-cmake-install_layout.cmake.diff
45    # https://code.launchpad.net/~stewart/percona-pam-for-mysql/bug1012488
46    patchfiles-append   patch-plugin-percona-pam-for-mysql-CMakeLists.txt.diff \
47                        patch-plugin-percona-pam-for-mysql-src-auth_pam_common.h.diff
48
49    checksums           ${distname}${extract.suffix} \
50                        rmd160  ca33cf3f84b24ddd50c2ebc663e5a7b33517dfe8 \
51                        sha256  bf32acb0b56d3bfabf65748bbbcb5cfce33191bd31893040ed7e2aebc3548df4
52
53    set manual_distfile Percona_Server_${version_manual}_Operations_Manual.pdf
54    extract.only        ${distname}${extract.suffix}
55    distfiles-append    ${manual_distfile}:pdf
56    checksums-append    ${manual_distfile} \
57                        rmd160  80261ad2723cad4a02439175bd3120f9657ebecf \
58                        sha256  031176de33d1def1a55eae90ef34e867164386929eaaa3e565e8d677025f7329
59
60    depends_lib-append  port:zlib
61    depends_run-append  port:mysql_select
62
63    select.group        mysql
64    select.file         ${filespath}/${name_mysql}
65
66    archcheck.files     lib/libz.dylib
67
68    post-extract {
69        file mkdir ${worksrcpath}/build_macports/macports
70        copy ${filespath}/macports-default.cnf \
71            ${filespath}/my.cnf \
72            ${worksrcpath}/build_macports/macports/
73        copy ${distpath}/${manual_distfile} \
74            ${worksrcpath}/build_macports/macports/
75    }
76
77    post-patch {
78        reinplace "s|@NAME@|${name_mysql}|g" \
79            ${worksrcpath}/cmake/install_layout.cmake
80        reinplace "s|@NAME@|${name_mysql}|g" \
81            ${worksrcpath}/build_macports/macports/macports-default.cnf \
82            ${worksrcpath}/build_macports/macports/my.cnf
83        reinplace "s|@PREFIX@|${prefix}|g" \
84            ${worksrcpath}/build_macports/macports/macports-default.cnf \
85            ${worksrcpath}/build_macports/macports/my.cnf
86    }
87
88    configure.cmd       cmake ..
89    configure.dir       ${worksrcpath}/build_macports
90    build.dir           ${worksrcpath}/build_macports
91
92    configure.args-delete \
93                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
94    configure.args-append \
95                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
96                        -DINSTALL_LAYOUT:STRING=MACPORTS \
97                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
98                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
99                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
100                        -DDEFAULT_CHARSET:STRING=utf8 \
101                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
102                        -DWITH_EMBEDDED_SERVER:BOOL=OFF \
103                        -DWITH_ZLIB:STRING=system \
104                        -DWITH_UNIT_TESTS:BOOL=ON \
105                        -DENABLE_GCOV:BOOL=OFF \
106                        -DENABLE_DTRACE:BOOL=OFF \
107                        -DWITH_READLINE:BOOL=ON \
108                        -DWITH_LIBEDIT:BOOL=OFF \
109                        -DWITH_LIBWRAP:BOOL=ON \
110                        -DWITH_SSL:STRING=no
111
112    post-build {
113        set dirs ${worksrcpath}/build_macports
114        foreach dir ${dirs} {
115            reinplace -E {s|-arch [a-z0-9_]+||g} \
116                ${dir}/scripts/mysql_config \
117                ${dir}/scripts/mysqlbug
118        }
119    }
120
121    post-destroot {
122        # proc portdestroot::destroot_finish fails to find and compress our man pages
123        # so borrow the compress command and run on our files now.
124        set manpath "${destroot}${prefix}/share/man"
125        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
126        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
127            # Fix paths in manpages
128            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
129            # Compress all manpages with gzip
130            system "$gzip -9vf ${manpage}"
131        }
132        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
133            # Fix paths in sample configuration files
134            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
135        }
136        xinstall -m 755 -o root -d \
137            ${destroot}${prefix}/etc/${name_mysql}
138        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
139            ${destroot}${prefix}/etc/${name_mysql}/
140        xinstall -m 755 -o root -d \
141            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
142        copy ${worksrcpath}/build_macports/macports/my.cnf \
143            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
144        copy ${worksrcpath}/build_macports/macports/${manual_distfile} \
145            ${destroot}${prefix}/share/doc/${name_mysql}/
146    }
147
148    post-install {
149        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
150            ui_msg "The ${name_mysql} client has been installed."
151            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
152        }
153    }
154
155    pre-activate {
156        # The macports-default.cnf is installed by ${name_mysql}.
157        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
158        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
159        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
160            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
161            && [vercmp [lindex $vers 1] 5.5.24-26.0] < 0 } {
162       
163            set deactivate_proc registry_deactivate_composite
164            if {[info commands registry_deactivate_composite] == {}} {
165                set deactivate_proc registry_deactivate
166            }
167            $deactivate_proc ${name_mysql}-server "" [list ports_nodepcheck 1]
168        }
169    }
170
171    post-activate {
172        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
173            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
174                ${prefix}/etc/${name_mysql}/
175        }
176    }
177
178    variant openssl description {Enable OpenSSL support} {
179
180        depends_lib-append      port:openssl
181        configure.args-delete   -DWITH_SSL:STRING=no
182        configure.args-append   -DWITH_SSL:STRING=system
183        archcheck.files-append  lib/libssl.dylib
184    }
185
186    variant system_readline description {Use system readline instead of bundled readline} {
187   
188        # Add readline support.
189        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
190        # of readline but use the system's (i.e. MacPorts') copy of readline"
191        depends_lib-append      port:readline
192        configure.args-delete   -DWITH_READLINE:BOOL=ON
193        configure.args-append   -DWITH_READLINE:BOOL=OFF
194        archcheck.files-append  lib/libreadline.dylib
195    }
196
197    livecheck.type      regex
198    livecheck.url       http://www.percona.com/downloads/Percona-Server-${version_branch}/
199    livecheck.regex     "/downloads/Percona-Server-${version_branch}/Percona-Server-(\[^/\]+)/"
200}
201
202subport ${name_mysql}-server {
203
204    revision            ${revision_server}
205    license             BSD
206    description         Run ${name_mysql} as server
207    long_description    ${description}
208
209    supported_archs     noarch
210    distfiles
211
212    depends_run         port:${name_mysql}
213
214    if {"darwin" == ${os.platform} && ${os.major} > 8} {
215        set mysqluser       _mysql
216    } else {
217        set mysqluser       mysql
218    }
219    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
220
221    startupitem.create      yes
222    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
223
224    use_configure       no
225
226    build {}
227
228    destroot {
229        xinstall -m 755 -o root -d \
230            ${destroot}${prefix}/var/run
231        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
232            ${destroot}${prefix}/etc/${name_mysql} \
233            ${destroot}${prefix}/var/db/${name_mysql} \
234            ${destroot}${prefix}/var/log/${name_mysql} \
235            ${destroot}${prefix}/var/run/${name_mysql}
236        destroot.keepdirs-append  \
237            ${destroot}${prefix}/var/db/${name_mysql} \
238            ${destroot}${prefix}/var/log/${name_mysql} \
239            ${destroot}${prefix}/var/run/${name_mysql}
240    }
241
242    notes "
243If this is a new install you might want to run:
244
245\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
246"
247
248    livecheck.type          none
249}
Note: See TracBrowser for help on using the repository browser.