source: trunk/dports/databases/mysql51/Portfile @ 139229

Last change on this file since 139229 was 139229, checked in by jeremyhu@…, 4 years ago

misc: Change port:openssl dependency to path:lib/libssl.dylib:openssl

This should allow usage of libressl as a replacement for openssl in relevant
ports. Not all ports have been tested, but libressl aims for API
compatibility with OpenSSL, so it is expected to work.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.7 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 139229 2015-08-08 03:10:35Z jeremyhu@macports.org $
3
4PortSystem          1.0
5
6name                mysql51
7set name_mysql      ${name}
8version             5.1.73
9# Set revision_client and revision_server to 0 if you bump version.
10set revision_client 1
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 {"darwin" eq ${os.platform} && ${os.major} > 8} {
20    set mysqluser       _mysql
21} else {
22    set mysqluser       mysql
23}
24
25if {${subport} eq ${name}} {
26
27    # http://bugs.mysql.com/bug.php?id=47360
28    PortGroup           muniversal 1.0
29    PortGroup           archcheck 1.0
30    PortGroup           select 1.0
31   
32    revision            ${revision_client}
33    license             GPL-2
34    description         Multithreaded SQL database server
35    long_description    MySQL is an open-source, multi-threaded SQL database.
36   
37    master_sites        mysql:MySQL-${version_branch}
38
39    distname            mysql-${version}
40    use_parallel_build  yes
41   
42    patch.pre_args      -p1
43    patchfiles          patch-Makefile.in.diff \
44                        patch-scripts-mysql_secure_installation.sh.diff
45
46    checksums           rmd160  ceee36663abbf135d3ddbebe52ebc537ecba25a6 \
47                        sha256  05ebe21305408b24407d14b77607a3e5ffa3c300e03f1359d3066f301989dcb5
48   
49    depends_lib         port:zlib port:tcp_wrappers
50    depends_run         port:mysql_select
51   
52    select.group        mysql
53    select.file         ${filespath}/${name_mysql}
54   
55    archcheck.files     lib/libz.dylib lib/libwrap.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%@BINDIR@%${prefix}/lib/${name_mysql}/bin%g" \
66            ${worksrcpath}/scripts/mysql_secure_installation.sh
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.args \
76        --bindir=${prefix}/lib/${name_mysql}/bin \
77        --sbindir=${prefix}/lib/${name_mysql}/bin \
78        --libexecdir=${prefix}/lib/${name_mysql}/bin \
79        --sysconfdir=${prefix}/etc/${name_mysql} \
80        --localstatedir=${prefix}/var/db/${name_mysql} \
81        --libdir=${prefix}/lib/${name_mysql} \
82        --includedir=${prefix}/include/${name_mysql} \
83        --datarootdir=${prefix}/share/${name_mysql} \
84        --infodir=${prefix}/share/info/${name_mysql} \
85        --mandir=${prefix}/share/man/${name_mysql} \
86        --with-zlib-dir=${prefix} \
87        --without-ssl \
88        --with-extra-charsets=complex \
89        --with-unix-socket-path=${prefix}/var/run/${name_mysql}/mysqld.sock \
90        --with-mysqld-user=${mysqluser} \
91        --without-docs \
92        --with-plugins=all \
93        --enable-thread-safe-client
94   
95    # Build libmysqld embedded server.
96    configure.cflags-append -fPIC
97    configure.cxxflags-append -fPIC
98    configure.args-append --with-embedded-server --with-pic
99   
100    # doesn't build with clang as of 2011.06.27
101    # This is a bug in mysql's build system, fixed in 5.5
102    compiler.blacklist-append *clang*
103
104    # https://trac.macports.org/ticket/45456?replyto=4#comment
105    compiler.fallback-append macports-llvm-gcc-4.2
106   
107    post-build {
108        if {[variant_isset universal]} {
109            set dirs {}
110            foreach arch ${universal_archs_to_use} {
111                lappend dirs ${worksrcpath}-${arch}
112            }
113        } else {
114            set dirs ${worksrcpath}
115        }
116        foreach dir ${dirs} {
117            reinplace -E {s|-arch [a-z0-9_]+||g} \
118                ${dir}/scripts/mysql_config \
119                ${dir}/scripts/mysqlbug
120        }
121    }
122   
123    post-destroot {
124        # proc portdestroot::destroot_finish fails to find and compress our man pages
125        # so borrow the compress command and run on our files now.
126        set manpath "${destroot}${prefix}/share/man"
127        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
128        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
129            # Fix paths in manpages
130            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
131            # Compress all manpages with gzip
132            system "$gzip -9vf ${manpage}"
133        }
134        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/mysql/my-*.cnf] {
135            # Fix paths in sample configuration files
136            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
137        }
138        xinstall -m 755 -o root -d \
139            ${destroot}${prefix}/etc/${name_mysql}
140        copy ${worksrcpath}/build_macports/macports/macports-default.cnf \
141            ${destroot}${prefix}/etc/${name_mysql}/
142        xinstall -m 755 -o root -d \
143            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
144        copy ${worksrcpath}/build_macports/macports/my.cnf \
145            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
146    }
147   
148    post-install {
149        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
150            ui_msg "The ${name_mysql} client has been installed."
151            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
152        }
153    }
154
155    pre-activate {
156        # The macports-default.cnf is installed by ${name_mysql}.
157        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
158        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
159        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
160            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
161            && [vercmp [lindex $vers 1] 5.1.63] < 1
162            && [vercmp [lindex $vers 2] 3] < 0 } {
163
164            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
165        }
166    }
167
168    post-activate {
169        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
170            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
171                ${prefix}/etc/${name_mysql}/
172        }
173    }
174   
175    variant openssl description {Enable OpenSSL support} {}
176    variant system_readline description {Use system readline instead of bundled readline} {}
177
178    if [variant_isset openssl] {
179        depends_lib-append      path:lib/libssl.dylib:openssl
180        configure.args-delete   --without-ssl
181        configure.args-append   --with-ssl=${prefix}
182        archcheck.files-append  lib/libssl.dylib
183    }
184    if [variant_isset system_readline] {
185        # "--without-readline" has the peculiar meaning "do not use the bundled copy
186        # of readline but use the system's (i.e. MacPorts') copy of readline"
187        depends_lib-append      port:readline
188        configure.args-append   --without-readline
189        archcheck.files-append  lib/libreadline.dylib
190    }
191
192    notes "
193On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one
194will be created which loads
195${prefix}/etc/${name_mysql}/macports-default.cnf.
196
197If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not
198touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf
199will be preserved (e.g., during port upgrades, deactivations or
200activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to
201customize your ${name_mysql} installation.
202
203Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf
204will be lost during port upgrades, deactivations or activations so you
205are advised to not make changes here. Currently
206${prefix}/etc/${name_mysql}/macports-default.cnf contains only one
207directive; to disable networking. With disabled networking it is
208possible to install and have running all the MacPorts mysql ports
209simultaneously.
210"
211
212    livecheck.type          regex
213    livecheck.url           http://dev.mysql.com/downloads/mysql/${version_branch}.html
214    livecheck.regex         "MySQL Community Server (${version_branch}(\.\[0-9.\]+)?)"
215}
216
217subport ${name_mysql}-server {
218
219    revision            ${revision_server}
220    license             BSD
221    description         Run ${name_mysql} as server
222    long_description    ${description}
223   
224    supported_archs     noarch
225    distfiles
226   
227    depends_run         port:${name_mysql}
228   
229    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
230   
231    startupitem.create      yes
232    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
233   
234    use_configure       no
235   
236    build {}
237   
238    destroot {
239        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
240            ${destroot}${prefix}/etc/${name_mysql} \
241            ${destroot}${prefix}/var/db/${name_mysql} \
242            ${destroot}${prefix}/var/log/${name_mysql} \
243            ${destroot}${prefix}/var/run/${name_mysql}
244        destroot.keepdirs-append  \
245            ${destroot}${prefix}/var/db/${name_mysql} \
246            ${destroot}${prefix}/var/log/${name_mysql} \
247            ${destroot}${prefix}/var/run/${name_mysql}
248    }
249
250    notes "
251If this is a new install you might want to run:
252
253\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db
254"
255   
256    livecheck.type          none
257}
Note: See TracBrowser for help on using the repository browser.