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

Last change on this file since 140702 was 139229, checked in by jeremyhu@…, 4 years ago

misc: Change port:openssl dependency to path:lib/libssl.dylib:openssl

This should allow usage of libressl as a replacement for openssl in relevant
ports. Not all ports have been tested, but libressl aims for API
compatibility with OpenSSL, so it is expected to work.

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