source: trunk/dports/databases/mysql56/Portfile @ 139208

Last change on this file since 139208 was 137343, checked in by pixilla@…, 4 years ago

databases/mariadb:
databases/mariadb-10.0:
databases/mariadb-10.1:
databases/mysql51:
databases/mysql55:
databases/mysql56:
databases/mysql_select:
databases/percona:

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