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

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

databases/mysql55:

  • Move homepage outside of subport.
  • Make var names more consistent across mysql ports.
  • Remove lib dependency on cmake.
  • Add comment about why we deactivate old versions of mysql55-server.
  • Do not set livecheck.version to it's default value.
  • 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 97294 2012-09-02 23:08:18Z 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
16homepage            http://www.mysql.com/
17
18if {$subport == $name} {
19
20    PortGroup           archcheck 1.0
21    PortGroup           cmake 1.0
22    PortGroup           select 1.0
23
24    set version_branch  [join [lrange [split ${version} .] 0 1] .]
25
26    revision            ${revision_client}
27    license             GPL-2
28    description         Multithreaded SQL database server
29    long_description    MySQL is an open-source, multi-threaded SQL database with a command \
30                        syntax very similar to mSQL.
31
32    master_sites \
33        http://mysql.he.net/Downloads/MySQL-${version_branch}/ \
34        http://mirrors.sunsite.dk/mysql/Downloads/MySQL-${version_branch}/ \
35        http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${version_branch}/ \
36        http://mirror.facebook.net/mysql/Downloads/MySQL-${version_branch}/ \
37        http://ftp.plusline.de/mysql/Downloads/MySQL-${version_branch}/ \
38        http://mysql.mirrors.pair.com/Downloads/MySQL-${version_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    depends_run-append  port:mysql_select
51
52    select.group        mysql
53    select.file         ${filespath}/${name_mysql}
54
55    archcheck.files     lib/libz.dylib
56
57    post-extract {
58        file mkdir ${worksrcpath}/build_macports/macports
59        copy ${filespath}/macports-default.cnf \
60            ${filespath}/my.cnf \
61            ${worksrcpath}/build_macports/macports/
62    }
63
64    post-patch {
65        reinplace "s|@NAME@|${name_mysql}|g" \
66            ${worksrcpath}/cmake/install_layout.cmake
67        reinplace "s|@NAME@|${name_mysql}|g" \
68            ${worksrcpath}/build_macports/macports/macports-default.cnf \
69            ${worksrcpath}/build_macports/macports/my.cnf
70        reinplace "s|@PREFIX@|${prefix}|g" \
71            ${worksrcpath}/build_macports/macports/macports-default.cnf \
72            ${worksrcpath}/build_macports/macports/my.cnf
73    }
74
75    configure.cmd       cmake ..
76    configure.dir       ${worksrcpath}/build_macports
77    build.dir           ${worksrcpath}/build_macports
78
79    configure.args-delete \
80                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
81    configure.args-append \
82                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
83                        -DINSTALL_LAYOUT:STRING=MACPORTS \
84                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
85                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
86                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
87                        -DDEFAULT_CHARSET:STRING=utf8 \
88                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
89                        -DWITH_EMBEDDED_SERVER:BOOL=OFF \
90                        -DWITH_ZLIB:STRING=system \
91                        -DWITH_UNIT_TESTS:BOOL=ON \
92                        -DENABLE_GCOV:BOOL=OFF \
93                        -DENABLE_DTRACE:BOOL=OFF \
94                        -DWITH_READLINE:BOOL=ON \
95                        -DWITH_LIBEDIT:BOOL=OFF \
96                        -DWITH_LIBWRAP:BOOL=ON \
97                        -DWITH_SSL:STRING=no
98
99    post-build {
100        set dirs ${worksrcpath}/build_macports
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 ${worksrcpath}/build_macports/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 ${worksrcpath}/build_macports/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.25] < 0 } {
147       
148            set deactivate_proc registry_deactivate_composite
149            if {[info commands registry_deactivate_composite] == {}} {
150                set deactivate_proc registry_deactivate
151            }
152            $deactivate_proc ${name_mysql}-server "" [list ports_nodepcheck 1]
153        }
154    }
155
156    post-activate {
157        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
158            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
159                ${prefix}/etc/${name_mysql}/
160        }
161    }
162
163    variant openssl description {Enable OpenSSL support} {
164
165        depends_lib-append      port:openssl
166        configure.args-delete   -DWITH_SSL:STRING=no
167        configure.args-append   -DWITH_SSL:STRING=system
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_READLINE:BOOL=ON
178        configure.args-append   -DWITH_READLINE:BOOL=OFF
179        archcheck.files-append  lib/libreadline.dylib
180    }
181
182    livecheck.type          regex
183    livecheck.url           http://dev.mysql.com/
184    livecheck.regex         "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${version_branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
185}
186
187subport ${name_mysql}-server {
188
189    revision            ${revision_server}
190    license             BSD
191    description         Run ${name_mysql} as server
192    long_description    ${description}
193
194    supported_archs     noarch
195    distfiles
196
197    depends_run         port:${name_mysql}
198
199    if {"darwin" == ${os.platform} && ${os.major} > 8} {
200        set mysqluser       _mysql
201    } else {
202        set mysqluser       mysql
203    }
204    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
205
206    startupitem.create      yes
207    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
208
209    use_configure       no
210
211    build {}
212
213    destroot {
214        xinstall -m 755 -o root -d \
215            ${destroot}${prefix}/var/run
216        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
217            ${destroot}${prefix}/etc/${name_mysql} \
218            ${destroot}${prefix}/var/db/${name_mysql} \
219            ${destroot}${prefix}/var/log/${name_mysql} \
220            ${destroot}${prefix}/var/run/${name_mysql}
221        destroot.keepdirs-append  \
222            ${destroot}${prefix}/var/db/${name_mysql} \
223            ${destroot}${prefix}/var/log/${name_mysql} \
224            ${destroot}${prefix}/var/run/${name_mysql}
225    }
226
227    notes "
228If this is a new install you might want to run:
229
230\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
231"
232
233    livecheck.type          none
234}
Note: See TracBrowser for help on using the repository browser.