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

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

databases/percona:

  • Fix checksum for manual. Closes #47061
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.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 133633 2015-03-07 15:23:12Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                percona
7set name_mysql      ${name}
8set name_package    ${name}-server
9set version_mysql   5.6.23
10set release         72.1
11# Please set revision_client and revision_server to 0 if you bump version_mysql or release.
12set revision_client 0
13set revision_server 0
14version             ${version_mysql}-${release}
15categories          databases
16platforms           darwin
17license             GPL-2
18maintainers         mac.com:quest openmaintainer
19homepage            http://www.percona.com/
20
21if {$subport eq $name} {
22
23    PortGroup           archcheck 1.0
24    PortGroup           cmake 1.0
25    PortGroup           select 1.0
26
27    set version_branch  [join [lrange [split ${version} .] 0 1] .]
28
29    revision            ${revision_client}
30    license             GPL-2
31    description         Multithreaded SQL database server
32    long_description    Percona is a fork of the MySQL server, a multi-threaded SQL database.
33
34    master_sites \
35    http://www.percona.com/redir/downloads/Percona-Server-${version_branch}/Percona-Server-${version}/source/tarball/:src \
36    http://form.percona.com/rs/percona/images/:pdf
37
38    distname            ${name_package}-${version}
39    distfiles           ${distname}${extract.suffix}:src
40    use_parallel_build  yes
41
42    patch.pre_args      -p1
43    patchfiles          patch-cmake-install_layout.cmake.diff
44
45    checksums           ${distname}${extract.suffix} \
46                        rmd160  bfc92bb84ca8027ecec9fefb9fbadebf0e06c6da \
47                        sha256  5382630b98dd05f72e372ede5535ddcad2e389b594311a69f03a3d95f68d4907 \
48
49    set manual_distfile "PerconaServer-${version} manual.pdf"
50    extract.only        ${distname}${extract.suffix}
51    distfiles-append    ${manual_distfile}:pdf
52    checksums-append    ${manual_distfile} \
53                        rmd160  b8040e186bc12079a2f66e0bd02db2bed8d35712 \
54                        sha256  6a0195663e7a1e52ed558e2f814d9f06c5455fbe8cca2abd97a68ac20e384ba5
55
56    depends_lib-append  port:zlib port:tcp_wrappers
57    depends_run-append  port:mysql_select
58
59    select.group        mysql
60    select.file         ${filespath}/${name_mysql}
61
62    archcheck.files     lib/libz.dylib lib/libwrap.dylib
63
64    post-extract {
65        file mkdir ${worksrcpath}/build_macports/macports
66        copy ${filespath}/macports-default.cnf \
67            ${filespath}/my.cnf \
68            ${worksrcpath}/build_macports/macports/
69        copy ${distpath}/${manual_distfile} \
70            ${worksrcpath}/build_macports/macports/
71    }
72
73    post-patch {
74        reinplace "s|@NAME@|${name_mysql}|g" \
75            ${worksrcpath}/cmake/install_layout.cmake
76        reinplace "s|@NAME@|${name_mysql}|g" \
77            ${worksrcpath}/build_macports/macports/macports-default.cnf \
78            ${worksrcpath}/build_macports/macports/my.cnf
79        reinplace "s|@PREFIX@|${prefix}|g" \
80            ${worksrcpath}/build_macports/macports/macports-default.cnf \
81            ${worksrcpath}/build_macports/macports/my.cnf
82    }
83
84    if { (![variant_isset universal] && ${build_arch} eq "i386") || ([variant_isset universal] && [lsearch ${universal_archs} i386] != -1) } {
85        # switch to /usr/bin/gcc and /usr/bin/g++
86        # closest to SET(CMAKE_CXX_COMPILER g++) removed in the patchfile
87        configure.compiler gcc
88    }
89    configure.cmd       cmake ..
90    configure.dir       ${worksrcpath}/build_macports
91    build.dir           ${worksrcpath}/build_macports
92
93    configure.args-delete \
94                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
95    configure.args-append \
96                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
97                        -DINSTALL_LAYOUT:STRING=MACPORTS \
98                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
99                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
100                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
101                        -DDEFAULT_CHARSET:STRING=utf8 \
102                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
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=bundled \
111                        -DWITH_EMBEDDED_SERVER:BOOL=ON
112
113    post-build {
114        set dirs ${worksrcpath}/build_macports
115        foreach dir ${dirs} {
116            reinplace -E {s|-arch [a-z0-9_]+||g} \
117                ${dir}/scripts/mysql_config \
118                ${dir}/scripts/mysqlbug
119        }
120    }
121
122    post-destroot {
123        # proc portdestroot::destroot_finish fails to find and compress our man pages
124        # so borrow the compress command and run on our files now.
125        set manpath "${destroot}${prefix}/share/man"
126        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
127        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
128            # Fix paths in manpages
129            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
130            # Compress all manpages with gzip
131            system "$gzip -9vf ${manpage}"
132        }
133        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
134            # Fix paths in sample configuration files
135            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
136        }
137        xinstall -m 755 -o root -d \
138            ${destroot}${prefix}/etc/${name_mysql}
139        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
140            ${destroot}${prefix}/etc/${name_mysql}/
141        xinstall -m 755 -o root -d \
142            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
143        copy ${worksrcpath}/build_macports/macports/my.cnf \
144            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
145        copy ${worksrcpath}/build_macports/macports/${manual_distfile} \
146            ${destroot}${prefix}/share/doc/${name_mysql}/
147    }
148
149    post-install {
150        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
151            ui_msg "The ${name_mysql} client has been installed."
152            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
153        }
154    }
155
156    pre-activate {
157        # The macports-default.cnf is installed by ${name_mysql}.
158        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
159        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
160        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
161            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
162            && [vercmp [lindex $vers 1] 5.5.24-26.0] < 0 } {
163
164            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
165        }
166    }
167
168    post-activate {
169        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
170            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
171                ${prefix}/etc/${name_mysql}/
172        }
173    }
174
175    variant openssl description {Enable OpenSSL support} {}
176    # Until yassl builds use MacPorts openssl.
177    # Getting mysql56 to build with yassl would make the binaries distributable.
178    # When mysql56 builds with yassl remove "true" from the "if" statement below or
179    # put the contents of the "if" block into the openssl variant block.
180    if { true || [variant_isset openssl] } {
181        configure.args-delete   -DWITH_SSL:STRING=bundled
182        configure.args-append   -DWITH_SSL:STRING=${prefix}
183        depends_lib-append      port:openssl
184        archcheck.files-append  lib/libssl.dylib
185    }
186
187    variant system_readline description {Use system readline instead of bundled readline} {
188   
189        # Add readline support.
190        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
191        # of readline but use the system's (i.e. MacPorts') copy of readline"
192        depends_lib-append      port:readline
193        configure.args-delete   -DWITH_READLINE:BOOL=ON
194        configure.args-append   -DWITH_READLINE:BOOL=OFF
195        archcheck.files-append  lib/libreadline.dylib
196    }
197
198    notes "
199On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one
200will be created which loads
201${prefix}/etc/${name_mysql}/macports-default.cnf.
202
203If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not
204touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf
205will be preserved (e.g., during port upgrades, deactivations or
206activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to
207customize your ${name_mysql} installation.
208
209Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf
210will be lost during port upgrades, deactivations or activations so you
211are advised to not make changes here. Currently
212${prefix}/etc/${name_mysql}/macports-default.cnf contains only one
213directive; to disable networking. With disabled networking it is
214possible to install and have running all the MacPorts mysql ports
215simultaneously.
216"
217
218    livecheck.type      regex
219    livecheck.url       http://www.percona.com/downloads/Percona-Server-${version_branch}/LATEST/source/tarball/
220    livecheck.regex     "${name_package}-(\[\\d\\.-\]*)\\${extract.suffix}"
221}
222
223subport ${name_mysql}-server {
224
225    revision            ${revision_server}
226    license             BSD
227    description         Run ${name_mysql} as server
228    long_description    ${description}
229
230    supported_archs     noarch
231    distfiles
232
233    depends_run         port:${name_mysql}
234
235    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
236        set mysqluser       _mysql
237    } else {
238        set mysqluser       mysql
239    }
240    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
241
242    startupitem.create      yes
243    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
244
245    use_configure       no
246
247    build {}
248
249    destroot {
250        xinstall -m 755 -o root -d \
251            ${destroot}${prefix}/var/run
252        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
253            ${destroot}${prefix}/etc/${name_mysql} \
254            ${destroot}${prefix}/var/db/${name_mysql} \
255            ${destroot}${prefix}/var/log/${name_mysql} \
256            ${destroot}${prefix}/var/run/${name_mysql}
257        destroot.keepdirs-append  \
258            ${destroot}${prefix}/var/db/${name_mysql} \
259            ${destroot}${prefix}/var/log/${name_mysql} \
260            ${destroot}${prefix}/var/run/${name_mysql}
261    }
262
263    notes "
264If this is a new install you might want to run:
265
266\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
267"
268
269    livecheck.type          none
270}
Note: See TracBrowser for help on using the repository browser.