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

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

databases/mysql55:

  • Update version to 5.5.33.
  • Update mysql mirrors.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.4 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 108938 2013-08-04 21:44:46Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                mysql55
7set name_mysql      ${name}
8version             5.5.33
9# Set revision_client and revision_server to 0 if you bump version.
10set revision_client 0
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 \
31        http://artfiles.org/mysql/Downloads/MySQL-${version_branch}/ \
32        http://ftp.arnes.si/mysql/Downloads/MySQL-${version_branch}/ \
33        http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-${version_branch}/ \
34        http://ftp.heanet.ie/mirrors/www.mysql.com/Downloads/MySQL-${version_branch}/ \
35        http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-${version_branch}/ \
36        http://ftp.itu.edu.tr/Mirror/Mysql/Downloads/MySQL-${version_branch}/ \
37        http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-${version_branch}/ \
38        http://ftp.ntua.gr/pub/databases/mysql/Downloads/MySQL-${version_branch}/ \
39        http://ftp.sunet.se/pub/unix/databases/relational/mysql/Downloads/MySQL-${version_branch}/ \
40        http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-${version_branch}/ \
41        http://it.mysql.contactlab.it/Downloads/MySQL-${version_branch}/ \
42        http://linorg.usp.br/mysql/Downloads/MySQL-${version_branch}/ \
43        http://mirror.csclub.uwaterloo.ca/mysql/Downloads/MySQL-${version_branch}/ \
44        http://mirror.leaseweb.com/mysql/Downloads/MySQL-${version_branch}/ \
45        http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-${version_branch}/ \
46        http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-${version_branch}/ \
47        http://mirrors.dedipower.com/www.mysql.com/Downloads/MySQL-${version_branch}/ \
48        http://mirrors.dotsrc.org/mysql/Downloads/MySQL-${version_branch}/ \
49        http://mirrors.ircam.fr/pub/mysql/Downloads/MySQL-${version_branch}/ \
50        http://mirrors.ukfast.co.uk/sites/ftp.mysql.com/Downloads/MySQL-${version_branch}/ \
51        http://mirrors.xservers.ro/mysql/Downloads/MySQL-${version_branch}/ \
52        http://mysql.blic.net/Downloads/MySQL-${version_branch}/ \
53        http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-${version_branch}/ \
54        http://mysql.cs.pu.edu.tw/Downloads/MySQL-${version_branch}/ \
55        http://mysql.dataphone.se/Downloads/MySQL-${version_branch}/ \
56        http://mysql.easynet.be/Downloads/MySQL-${version_branch}/ \
57        http://mysql.he.net/Downloads/MySQL-${version_branch}/ \
58        http://mysql.infocom.ua/Downloads/MySQL-${version_branch}/ \
59        http://mysql.inspire.net.nz/Downloads/MySQL-${version_branch}/ \
60        http://mysql.linux.cz/Downloads/MySQL-${version_branch}/ \
61        http://mysql.llarian.net/Downloads/MySQL-${version_branch}/ \
62        http://mysql.mirror.iweb.ca/Downloads/MySQL-${version_branch}/ \
63        http://mysql.mirror.rafal.ca/Downloads/MySQL-${version_branch}/ \
64        http://mysql.mirrors.arminco.com/Downloads/MySQL-${version_branch}/ \
65        http://mysql.mirrors.hoobly.com/Downloads/MySQL-${version_branch}/ \
66        http://mysql.mirrors.ilisys.com.au/Downloads/MySQL-${version_branch}/ \
67        http://mysql.mirrors.ovh.net/ftp.mysql.com/Downloads/MySQL-${version_branch}/ \
68        http://mysql.mirrors.pair.com/Downloads/MySQL-${version_branch}/ \
69        http://mysql.nfsi.pt/Downloads/MySQL-${version_branch}/ \
70        http://mysql.ntu.edu.tw/Downloads/MySQL-${version_branch}/ \
71        http://mysql.spd.co.il/Downloads/MySQL-${version_branch}/ \
72        http://na.mirror.garr.it/mirrors/MySQL/Downloads/MySQL-${version_branch}/ \
73        http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${version_branch}/ \
74        http://www.linorg.usp.br/mysql/Downloads/MySQL-${version_branch}/ \
75        http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-${version_branch}/
76
77# Mirrors with bad distfiles
78# http://mysql.azc.uam.mx/Downloads/MySQL-${version_branch}/ \
79# http://mysql.isu.edu.tw/Downloads/MySQL-${version_branch}/ \
80# http://mysql.mirror.ac.za/Downloads/MySQL-${version_branch}/ \
81# http://mysql.mirror.kangaroot.net/Downloads/MySQL-${version_branch}/ \
82# http://mysql.mirrors.crysys.hit.bme.hu/Downloads/MySQL-${version_branch}/ \
83# http://mysql.mivzakim.net/Downloads/MySQL-${version_branch}/ \
84# http://mysql.sh.cvut.cz/Downloads/MySQL-${version_branch}/ \
85# http://opensource.become.com/mysql/Downloads/MySQL-${version_branch}/ \
86
87    distname            mysql-${version}
88    use_parallel_build  yes
89
90    patch.pre_args      -p1
91    patchfiles          patch-cmake-install_layout.cmake.diff
92
93    checksums           rmd160  a2574b2ff320b0b4f93fb3a616f4ebbacd31f641 \
94                        sha256  6ad9af38de1f3595c5fb81bc24bdb62fa39b2ce1c690d87ac7d7a21ca71fceba
95
96    depends_lib-append  port:zlib port:tcp_wrappers
97    depends_run-append  port:mysql_select
98
99    select.group        mysql
100    select.file         ${filespath}/${name_mysql}
101
102    archcheck.files     lib/libz.dylib lib/libwrap.dylib
103
104    post-extract {
105        file mkdir ${worksrcpath}/build_macports/macports
106        copy ${filespath}/macports-default.cnf \
107            ${filespath}/my.cnf \
108            ${worksrcpath}/build_macports/macports/
109    }
110
111    post-patch {
112        reinplace "s|@NAME@|${name_mysql}|g" \
113            ${worksrcpath}/cmake/install_layout.cmake
114        reinplace "s|@NAME@|${name_mysql}|g" \
115            ${worksrcpath}/build_macports/macports/macports-default.cnf \
116            ${worksrcpath}/build_macports/macports/my.cnf
117        reinplace "s|@PREFIX@|${prefix}|g" \
118            ${worksrcpath}/build_macports/macports/macports-default.cnf \
119            ${worksrcpath}/build_macports/macports/my.cnf
120    }
121
122    configure.cmd       cmake ..
123    configure.dir       ${worksrcpath}/build_macports
124    build.dir           ${worksrcpath}/build_macports
125
126    configure.args-delete \
127                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
128    configure.args-append \
129                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
130                        -DINSTALL_LAYOUT:STRING=MACPORTS \
131                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
132                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
133                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
134                        -DDEFAULT_CHARSET:STRING=utf8 \
135                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
136                        -DWITH_EMBEDDED_SERVER:BOOL=ON \
137                        -DWITH_ZLIB:STRING=system \
138                        -DWITH_UNIT_TESTS:BOOL=ON \
139                        -DENABLE_GCOV:BOOL=OFF \
140                        -DENABLE_DTRACE:BOOL=OFF \
141                        -DWITH_READLINE:BOOL=ON \
142                        -DWITH_LIBEDIT:BOOL=OFF \
143                        -DWITH_LIBWRAP:BOOL=ON \
144                        -DWITH_SSL:STRING=no
145
146    post-build {
147        set dirs ${worksrcpath}/build_macports
148        foreach dir ${dirs} {
149            reinplace -E {s|-arch [a-z0-9_]+||g} \
150                ${dir}/scripts/mysql_config \
151                ${dir}/scripts/mysqlbug
152        }
153    }
154
155    post-destroot {
156        # proc portdestroot::destroot_finish fails to find and compress our man pages
157        # so borrow the compress command and run on our files now.
158        set manpath "${destroot}${prefix}/share/man"
159        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
160        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
161            # Fix paths in manpages
162            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
163            # Compress all manpages with gzip
164            system "$gzip -9vf ${manpage}"
165        }
166        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
167            # Fix paths in sample configuration files
168            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
169        }
170        xinstall -m 755 -o root -d \
171            ${destroot}${prefix}/etc/${name_mysql}
172        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
173            ${destroot}${prefix}/etc/${name_mysql}/
174        xinstall -m 755 -o root -d \
175            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
176        copy ${worksrcpath}/build_macports/macports/my.cnf \
177            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
178    }
179
180    post-install {
181        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
182            ui_msg "The ${name_mysql} client has been installed."
183            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
184        }
185    }
186
187    pre-activate {
188        # The macports-default.cnf is installed by ${name_mysql}.
189        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
190        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
191        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
192            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
193            && [vercmp [lindex $vers 1] 5.5.25] < 0 } {
194
195            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
196        }
197    }
198
199    post-activate {
200        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
201            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
202                ${prefix}/etc/${name_mysql}/
203        }
204    }
205
206    variant openssl description {Enable OpenSSL support} {
207
208        depends_lib-append      port:openssl
209        configure.args-delete   -DWITH_SSL:STRING=no
210        configure.args-append   -DWITH_SSL:STRING=system
211        archcheck.files-append  lib/libssl.dylib
212    }
213
214    variant system_readline description {Use system readline instead of bundled readline} {
215   
216        # Add readline support.
217        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
218        # of readline but use the system's (i.e. MacPorts') copy of readline"
219        depends_lib-append      port:readline
220        configure.args-delete   -DWITH_READLINE:BOOL=ON
221        configure.args-append   -DWITH_READLINE:BOOL=OFF
222        archcheck.files-append  lib/libreadline.dylib
223    }
224
225    livecheck.type          regex
226    livecheck.url           http://dev.mysql.com/downloads/mysql/${version_branch}.html
227    livecheck.regex         "<h1>MySQL Community Server (${version_branch}(\.\[0-9.\]+)?)</h1>"
228}
229
230subport ${name_mysql}-server {
231
232    revision            ${revision_server}
233    license             BSD
234    description         Run ${name_mysql} as server
235    long_description    ${description}
236
237    supported_archs     noarch
238    distfiles
239
240    depends_run         port:${name_mysql}
241
242    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
243        set mysqluser       _mysql
244    } else {
245        set mysqluser       mysql
246    }
247    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
248
249    startupitem.create      yes
250    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
251
252    use_configure       no
253
254    build {}
255
256    destroot {
257        xinstall -m 755 -o root -d \
258            ${destroot}${prefix}/var/run
259        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
260            ${destroot}${prefix}/etc/${name_mysql} \
261            ${destroot}${prefix}/var/db/${name_mysql} \
262            ${destroot}${prefix}/var/log/${name_mysql} \
263            ${destroot}${prefix}/var/run/${name_mysql}
264        destroot.keepdirs-append  \
265            ${destroot}${prefix}/var/db/${name_mysql} \
266            ${destroot}${prefix}/var/log/${name_mysql} \
267            ${destroot}${prefix}/var/run/${name_mysql}
268    }
269
270    notes "
271If this is a new install you might want to run:
272
273\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
274"
275
276    livecheck.type          none
277}
Note: See TracBrowser for help on using the repository browser.