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

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

databases:

  • Revbump.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.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 93236 2012-05-18 05:50:36Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                mysql55
7set name_mysql      ${name}
8version             5.5.24
9revision            1
10categories          databases
11platforms           darwin
12license             GPL-2
13maintainers         pixilla openmaintainer
14
15if {$subport == $name} {
16
17    PortGroup           archcheck 1.0
18    PortGroup           cmake 1.0
19    PortGroup           select 1.0
20
21    set branch          [join [lrange [split ${version} .] 0 1] .]
22
23    license             GPL-2
24    description         Multithreaded SQL database server
25    long_description    MySQL is an open-source, multi-threaded SQL database with a command \
26                        syntax very similar to mSQL.
27
28    homepage            http://www.mysql.com/
29    master_sites \
30        http://mysql.he.net/Downloads/MySQL-${branch}/ \
31        http://mirrors.sunsite.dk/mysql/Downloads/MySQL-${branch}/ \
32        http://sunsite.informatik.rwth-aachen.de/mysql/Downloads/MySQL-${branch}/ \
33        http://mirror.facebook.net/mysql/Downloads/MySQL-${branch}/ \
34        http://ftp.plusline.de/mysql/Downloads/MySQL-${branch}/
35
36# This mirror has a bad distfile for version 5.5.23
37#        http://mysql.mirrors.pair.com/Downloads/MySQL-${branch}/ \
38
39    distname            mysql-${version}
40    use_parallel_build  yes
41
42    patch.pre_args      -p1
43    patchfiles          patch-cmake-install_layout.cmake.diff \
44                        patch-configure.cmake.diff
45# http://bugs.mysql.com/bug.php?id=65050
46
47    checksums           rmd160  8a6cf0ff40d7b21bb9bb2fab82d0695574e6f2f9 \
48                        sha256  41e687dfec416a8b50d8d550899346c0e7096fe1200228cce24ed8daf3a779c6
49
50    depends_lib-append  port:zlib \
51                        port:readline \
52                        port:cmake
53    depends_run         port:mysql_select
54
55    select.group        mysql
56    select.file         ${filespath}/${name}
57
58    archcheck.files     lib/libz.dylib \
59                        lib/libreadline.dylib
60
61    post-patch {
62        reinplace "s|@NAME@|${name}|g" ${worksrcpath}/cmake/install_layout.cmake
63        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/cmake/install_layout.cmake
64    }
65
66    configure.args-delete \
67                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
68    configure.args-append \
69                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name}/mysql \
70                        -DINSTALL_LAYOUT=MACPORTS \
71                        -DSYSCONFDIR:PATH=${prefix}/etc/${name} \
72                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name}/mysqld.sock \
73                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name} \
74                        -DDEFAULT_CHARSET:STRING=utf8 \
75                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
76                        -DWITH_EMBEDDED_SERVER:BOOL=OFF \
77                        -DWITH_READLINE:BOOL=ON \
78                        -DWITH_ZLIB:STRING=system \
79                        -DWITH_UNIT_TESTS:BOOL=OFF \
80                        -DENABLE_GCOV:BOOL=OFF \
81                        -DENABLE_DTRACE:BOOL=OFF
82
83    post-build {
84        set dirs ${worksrcpath}
85        foreach dir ${dirs} {
86            reinplace -E {s|-arch [a-z0-9_]+||g} \
87                ${dir}/scripts/mysql_config \
88                ${dir}/scripts/mysqlbug
89        }
90    }
91
92    pre-destroot {
93        xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
94        destroot.keepdirs-append ${destroot}${prefix}/etc/${name}
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}/man\[1-9\]/*] {
103            # Fix paths in manpages
104            reinplace "s|/etc/|${prefix}/etc/${name}/|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}/support-files/my-*.cnf] {
109            # Fix paths in sample configuration files
110            reinplace "s|/etc/my.cnf|${prefix}/etc/${name}/my.cnf|g" ${samp_conffile}
111        }
112    }
113
114    post-install {
115        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}-server.plist]} {
116            ui_msg "The ${name} client has been installed."
117            ui_msg "To install the ${name} server, install the ${name}-server port."
118        }
119    }
120
121    variant openssl description {Enable OpenSSL support} {
122
123        license-append          OpenSSL SSLeay
124        depends_lib-append      port:openssl
125        configure.args-append   -DWITH_SSL:STRING=ON
126        archcheck.files-append  lib/libssl.dylib
127    }
128
129    livecheck.type          regex
130    livecheck.version       [lindex [split ${version} -] 0]
131    livecheck.url           http://dev.mysql.com/
132    livecheck.regex         "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
133}
134
135subport ${name_mysql}-server {
136
137    revision            1
138    license             BSD
139    description         Run ${name_mysql} as server
140    long_description    ${description}
141
142    supported_archs     noarch
143    distfiles
144
145    depends_run         port:${name_mysql}
146
147    if {"darwin" == ${os.platform} && ${os.major} > 8} {
148        set mysqluser       _mysql
149    } else {
150        set mysqluser       mysql
151    }
152    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
153
154    startupitem.create      yes
155    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
156
157    use_configure       no
158
159    build {}
160
161    destroot {
162        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
163        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
164            ${destroot}${prefix}/etc/${name_mysql} \
165            ${destroot}${prefix}/var/db/${name_mysql} \
166            ${destroot}${prefix}/var/log/${name_mysql} \
167            ${destroot}${prefix}/var/run/${name_mysql}
168        destroot.keepdirs-append  \
169            ${destroot}${prefix}/var/db/${name_mysql} \
170            ${destroot}${prefix}/var/log/${name_mysql} \
171            ${destroot}${prefix}/var/run/${name_mysql}
172        set fp [open "${destroot}${prefix}/etc/${name_mysql}/macports-default.cnf" "w"]
173        puts $fp "# WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!"
174        puts $fp "# Make your changes to ${prefix}/etc/${name_mysql}/my.cnf"
175        puts $fp "# YOU HAVE BEEN WARNED!"
176        puts $fp ""
177        puts $fp "# MacPorts default options"
178        puts $fp "\[mysqld\]"
179        puts $fp "# skip-networking so multple mysql server ports can be loaded"
180        puts $fp "# without each competing for port 3306."
181        puts $fp "# One can always put the servers on different ports and"
182        puts $fp "# remove or comment this option."
183        puts $fp "skip-networking"
184        close $fp
185    }
186
187    post-activate {
188        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
189            set fp [open "${prefix}/etc/${name_mysql}/my.cnf" "w"]
190            puts $fp "# Use default MacPorts settings"
191            puts $fp "!include ${prefix}/etc/${name_mysql}/macports-default.cnf"
192            close $fp
193        }
194    }
195
196    notes "
197If this is a new install you might want to run:
198
199\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/scripts/mysql_install_db
200"
201
202    livecheck.type          none
203}
Note: See TracBrowser for help on using the repository browser.