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

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

databases/mysql55:

  • Update version to 5.5.27.
  • Fix wording of comments in files/macports-default.cnf.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.9 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 96347 2012-08-07 18:18:52Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                mysql55
7set name_mysql      ${name}
8version             5.5.27
9# Please set revision_client and revision_server to 0 if you bump version.
10set revision_client 0
11set revision_server 0
12categories          databases
13platforms           darwin
14license             GPL-2
15maintainers         pixilla openmaintainer
16
17if {$subport == $name} {
18
19    PortGroup           archcheck 1.0
20    PortGroup           cmake 1.0
21    PortGroup           select 1.0
22
23    set branch          [join [lrange [split ${version} .] 0 1] .]
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 with a command \
29                        syntax very similar to mSQL.
30
31    homepage            http://www.mysql.com/
32    master_sites \
33        http://mysql.he.net/Downloads/MySQL-${branch}/ \
34        http://mirrors.sunsite.dk/mysql/Downloads/MySQL-${branch}/ \
35        http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${branch}/ \
36        http://mirror.facebook.net/mysql/Downloads/MySQL-${branch}/ \
37        http://ftp.plusline.de/mysql/Downloads/MySQL-${branch}/ \
38        http://mysql.mirrors.pair.com/Downloads/MySQL-${branch}/
39
40    distname            mysql-${version}
41    use_parallel_build  yes
42
43    patch.pre_args      -p1
44    patchfiles          patch-cmake-install_layout.cmake.diff
45
46    checksums           rmd160  cd4b94a95c7639f96870c802b9b334d9e705b9a2 \
47                        sha256  51ffafbd82039f8afbe5b3c26f15cc338ed6cd4f67e56d7dd33efaa28c9d99e4
48
49    depends_lib-append  port:zlib \
50                        port:cmake
51    depends_run-append  port:mysql_select
52
53    select.group        mysql
54    select.file         ${filespath}/${name_mysql}
55
56    archcheck.files     lib/libz.dylib
57
58    post-extract {
59        file mkdir ${worksrcpath}/build_macports/macports
60        copy ${filespath}/macports-default.cnf \
61            ${filespath}/my.cnf \
62            ${worksrcpath}/build_macports/macports/
63    }
64
65    post-patch {
66        reinplace "s|@NAME@|${name_mysql}|g" \
67            ${worksrcpath}/cmake/install_layout.cmake
68        reinplace "s|@NAME@|${name_mysql}|g" \
69            ${worksrcpath}/build_macports/macports/macports-default.cnf \
70            ${worksrcpath}/build_macports/macports/my.cnf
71        reinplace "s|@PREFIX@|${prefix}|g" \
72            ${worksrcpath}/build_macports/macports/macports-default.cnf \
73            ${worksrcpath}/build_macports/macports/my.cnf
74    }
75
76    configure.cmd       cmake ..
77    configure.dir       ${worksrcpath}/build_macports
78    build.dir           ${worksrcpath}/build_macports
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_EMBEDDED_SERVER:BOOL=OFF \
91                        -DWITH_ZLIB:STRING=system \
92                        -DWITH_UNIT_TESTS:BOOL=ON \
93                        -DENABLE_GCOV:BOOL=OFF \
94                        -DENABLE_DTRACE:BOOL=OFF \
95                        -DWITH_READLINE:BOOL=ON \
96                        -DWITH_LIBEDIT:BOOL=OFF \
97                        -DWITH_LIBWRAP:BOOL=ON \
98                        -DWITH_SSL:STRING=no
99
100    post-build {
101        set dirs ${worksrcpath}/build_macports
102        foreach dir ${dirs} {
103            reinplace -E {s|-arch [a-z0-9_]+||g} \
104                ${dir}/scripts/mysql_config \
105                ${dir}/scripts/mysqlbug
106        }
107    }
108
109    post-destroot {
110        # proc portdestroot::destroot_finish fails to find and compress our man pages
111        # so borrow the compress command and run on our files now.
112        set manpath "${destroot}${prefix}/share/man"
113        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
114        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
115            # Fix paths in manpages
116            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
117            # Compress all manpages with gzip
118            system "$gzip -9vf ${manpage}"
119        }
120        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
121            # Fix paths in sample configuration files
122            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
123        }
124        xinstall -m 755 -o root -d \
125            ${destroot}${prefix}/etc/${name_mysql}
126        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
127            ${destroot}${prefix}/etc/${name_mysql}/
128        xinstall -m 755 -o root -d \
129            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
130        copy ${worksrcpath}/build_macports/macports/my.cnf \
131            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
132    }
133
134    post-install {
135        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
136            ui_msg "The ${name_mysql} client has been installed."
137            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
138        }
139    }
140
141    pre-activate {
142        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
143            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
144            && [vercmp [lindex $vers 1] 5.5.25] < 0 } {
145       
146            set deactivate_proc registry_deactivate_composite
147            if {[info commands registry_deactivate_composite] == {}} {
148                set deactivate_proc registry_deactivate
149            }
150            $deactivate_proc ${name_mysql}-server "" [list ports_nodepcheck 1]
151        }
152    }
153
154    post-activate {
155        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
156            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
157                ${prefix}/etc/${name_mysql}/
158        }
159    }
160
161    variant openssl description {Enable OpenSSL support} {
162
163        depends_lib-append      port:openssl
164        configure.args-delete   -DWITH_SSL:STRING=no
165        configure.args-append   -DWITH_SSL:STRING=system
166        archcheck.files-append  lib/libssl.dylib
167    }
168
169    variant system_readline description {Use system readline instead of bundled readline} {
170   
171        # Add readline support.
172        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
173        # of readline but use the system's (i.e. MacPorts') copy of readline"
174        depends_lib-append      port:readline
175        configure.args-delete   -DWITH_READLINE:BOOL=ON
176        configure.args-append   -DWITH_READLINE:BOOL=OFF
177        archcheck.files-append  lib/libreadline.dylib
178    }
179
180    livecheck.type          regex
181    livecheck.version       [lindex [split ${version} -] 0]
182    livecheck.url           http://dev.mysql.com/
183    livecheck.regex         "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
184}
185
186subport ${name_mysql}-server {
187
188    revision            ${revision_server}
189    license             BSD
190    description         Run ${name_mysql} as server
191    long_description    ${description}
192
193    supported_archs     noarch
194    distfiles
195
196    depends_run         port:${name_mysql}
197
198    if {"darwin" == ${os.platform} && ${os.major} > 8} {
199        set mysqluser       _mysql
200    } else {
201        set mysqluser       mysql
202    }
203    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
204
205    startupitem.create      yes
206    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
207
208    use_configure       no
209
210    build {}
211
212    destroot {
213        xinstall -m 755 -o root -d \
214            ${destroot}${prefix}/var/run
215        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
216            ${destroot}${prefix}/etc/${name_mysql} \
217            ${destroot}${prefix}/var/db/${name_mysql} \
218            ${destroot}${prefix}/var/log/${name_mysql} \
219            ${destroot}${prefix}/var/run/${name_mysql}
220        destroot.keepdirs-append  \
221            ${destroot}${prefix}/var/db/${name_mysql} \
222            ${destroot}${prefix}/var/log/${name_mysql} \
223            ${destroot}${prefix}/var/run/${name_mysql}
224    }
225
226    notes "
227If this is a new install you might want to run:
228
229\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
230"
231
232    livecheck.type          none
233}
Note: See TracBrowser for help on using the repository browser.