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

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