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

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

databases/mysql55:

  • Patch no longer contains @PREFIX@.
  • 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 93238 2012-05-18 06:16:23Z 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    }
64
65    configure.args-delete \
66                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
67    configure.args-append \
68                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name}/mysql \
69                        -DINSTALL_LAYOUT=MACPORTS \
70                        -DSYSCONFDIR:PATH=${prefix}/etc/${name} \
71                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name}/mysqld.sock \
72                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name} \
73                        -DDEFAULT_CHARSET:STRING=utf8 \
74                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
75                        -DWITH_EMBEDDED_SERVER:BOOL=OFF \
76                        -DWITH_READLINE:BOOL=ON \
77                        -DWITH_ZLIB:STRING=system \
78                        -DWITH_UNIT_TESTS:BOOL=OFF \
79                        -DENABLE_GCOV:BOOL=OFF \
80                        -DENABLE_DTRACE:BOOL=OFF
81
82    post-build {
83        set dirs ${worksrcpath}
84        foreach dir ${dirs} {
85            reinplace -E {s|-arch [a-z0-9_]+||g} \
86                ${dir}/scripts/mysql_config \
87                ${dir}/scripts/mysqlbug
88        }
89    }
90
91    pre-destroot {
92        xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
93        destroot.keepdirs-append ${destroot}${prefix}/etc/${name}
94    }
95
96    post-destroot {
97        # proc portdestroot::destroot_finish fails to find and compress our man pages
98        # so borrow the compress command and run on our files now.
99        set manpath "${destroot}${prefix}/share/man"
100        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
101        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name}/man\[1-9\]/*] {
102            # Fix paths in manpages
103            reinplace "s|/etc/|${prefix}/etc/${name}/|g" ${manpage}
104            # Compress all manpages with gzip
105            system "$gzip -9vf ${manpage}"
106        }
107        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name}/support-files/my-*.cnf] {
108            # Fix paths in sample configuration files
109            reinplace "s|/etc/my.cnf|${prefix}/etc/${name}/my.cnf|g" ${samp_conffile}
110        }
111    }
112
113    post-install {
114        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}-server.plist]} {
115            ui_msg "The ${name} client has been installed."
116            ui_msg "To install the ${name} server, install the ${name}-server port."
117        }
118    }
119
120    variant openssl description {Enable OpenSSL support} {
121
122        license-append          OpenSSL SSLeay
123        depends_lib-append      port:openssl
124        configure.args-append   -DWITH_SSL:STRING=ON
125        archcheck.files-append  lib/libssl.dylib
126    }
127
128    livecheck.type          regex
129    livecheck.version       [lindex [split ${version} -] 0]
130    livecheck.url           http://dev.mysql.com/
131    livecheck.regex         "<a href=\"http://dev.mysql.com/downloads/mysql/\[^\"\]+\">(${branch}(\.\[0-9.\]+)?)\[^<\]*</a>"
132}
133
134subport ${name_mysql}-server {
135
136    revision            1
137    license             BSD
138    description         Run ${name_mysql} as server
139    long_description    ${description}
140
141    supported_archs     noarch
142    distfiles
143
144    depends_run         port:${name_mysql}
145
146    if {"darwin" == ${os.platform} && ${os.major} > 8} {
147        set mysqluser       _mysql
148    } else {
149        set mysqluser       mysql
150    }
151    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
152
153    startupitem.create      yes
154    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
155
156    use_configure       no
157
158    build {}
159
160    destroot {
161        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
162        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
163            ${destroot}${prefix}/etc/${name_mysql} \
164            ${destroot}${prefix}/var/db/${name_mysql} \
165            ${destroot}${prefix}/var/log/${name_mysql} \
166            ${destroot}${prefix}/var/run/${name_mysql}
167        destroot.keepdirs-append  \
168            ${destroot}${prefix}/var/db/${name_mysql} \
169            ${destroot}${prefix}/var/log/${name_mysql} \
170            ${destroot}${prefix}/var/run/${name_mysql}
171        set fp [open "${destroot}${prefix}/etc/${name_mysql}/macports-default.cnf" "w"]
172        puts $fp "# WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!"
173        puts $fp "# Make your changes to ${prefix}/etc/${name_mysql}/my.cnf"
174        puts $fp "# YOU HAVE BEEN WARNED!"
175        puts $fp ""
176        puts $fp "# MacPorts default options"
177        puts $fp "\[mysqld\]"
178        puts $fp "# skip-networking so multple mysql server ports can be loaded"
179        puts $fp "# without each competing for port 3306."
180        puts $fp "# One can always put the servers on different ports and"
181        puts $fp "# remove or comment this option."
182        puts $fp "skip-networking"
183        close $fp
184    }
185
186    post-activate {
187        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
188            set fp [open "${prefix}/etc/${name_mysql}/my.cnf" "w"]
189            puts $fp "# Use default MacPorts settings"
190            puts $fp "!include ${prefix}/etc/${name_mysql}/macports-default.cnf"
191            close $fp
192        }
193    }
194
195    notes "
196If this is a new install you might want to run:
197
198\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/scripts/mysql_install_db
199"
200
201    livecheck.type          none
202}
Note: See TracBrowser for help on using the repository browser.