source: trunk/dports/databases/mariadb-10.1/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.

File size: 10.3 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 114690 2013-12-13 23:09:43Z pixilla@macports.org $
3
4PortSystem          1.0
5
6name                mariadb-10.1
7set name_mysql      ${name}
8version             10.1.4
9set version_branch  [join [lrange [split ${version} .] 0 1] .]
10# Please set revision_client and revision_server to 0 if you bump version.
11set revision_client 1
12set revision_server 0
13categories          databases
14platforms           darwin
15license             GPL-2
16maintainers         pixilla openmaintainer
17homepage            http://mariadb.org/
18
19if {$subport eq $name} {
20
21    PortGroup           archcheck 1.0
22    PortGroup           cmake 1.0
23    PortGroup           select 1.0
24
25    revision            ${revision_client}
26    license             GPL-2
27    description         (Warning: Alpha version) Multithreaded SQL database server
28    long_description    (Warning: Alpha version) Mariadb is a fork of the MySQL server, a \
29                        multi-threaded SQL database.
30
31    master_sites \
32        http://ftp.osuosl.org/pub/mariadb/mariadb-${version}/source/ \
33        http://mirror2.hs-esslingen.de/mariadb/mariadb-${version}/source/ \
34        http://mirror3.layerjet.com/mariadb/mariadb-${version}/source/ \
35        http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/mariadb-${version}/source/ \
36        http://mirrors.supportex.net/mariadb/mariadb-${version}/source/ \
37        http://mirrors.fe.up.pt/pub/mariadb/mariadb-${version}/source/ \
38        http://gd.tuwien.ac.at/db/mariadb/mariadb-${version}/source/ \
39        http://mirror.aarnet.edu.au/pub/MariaDB/mariadb-${version}/source/ \
40        http://ftp.heanet.ie/mirrors/mariadb/mariadb-${version}/source/ \
41        http://mirror.switch.ch/mirror/mariadb/mariadb-${version}/source/
42
43    distname            mariadb-${version}
44    cmake.out_of_source yes
45    use_parallel_build  yes
46
47    patch.pre_args      -p1
48    patchfiles          patch-cmake-install_layout.cmake.diff \
49                        patch-CMakeLists.txt.diff
50
51    # Upstream issue MDEV-8073 fix
52    # https://mariadb.atlassian.net/browse/MDEV-8073
53    patchfiles-append   patch-sql-mdl.cc.diff
54
55    checksums           rmd160  07d5ff5d48cc85093655c6af3579f6be61416df9 \
56                        sha256  14cc92414b2c3822923977a6fb544593498dbb5005044db33c193511757d411c
57
58    depends_lib-append  port:zlib port:tcp_wrappers port:ncurses
59    depends_run-append  port:mysql_select
60
61    select.group        mysql
62    select.file         ${filespath}/${name_mysql}
63
64    archcheck.files     lib/libz.dylib lib/libwrap.dylib
65
66    post-extract {
67        file mkdir ${cmake.build_dir}/macports
68        copy ${filespath}/macports-default.cnf \
69            ${filespath}/my.cnf \
70            ${cmake.build_dir}/macports/
71    }
72
73    post-patch {
74        reinplace "s|@NAME@|${name_mysql}|g" \
75            ${worksrcpath}/cmake/install_layout.cmake
76        reinplace "s|@NAME@|${name_mysql}|g" \
77            ${cmake.build_dir}/macports/macports-default.cnf \
78            ${cmake.build_dir}/macports/my.cnf
79        reinplace "s|@PREFIX@|${prefix}|g" \
80            ${cmake.build_dir}/macports/macports-default.cnf \
81            ${cmake.build_dir}/macports/my.cnf
82    }
83
84    configure.args-delete \
85                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
86    configure.args-append \
87                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
88                        -DINSTALL_LAYOUT:STRING=MACPORTS \
89                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
90                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
91                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
92                        -DDEFAULT_CHARSET:STRING=utf8 \
93                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
94                        -DWITH_EMBEDDED_SERVER:BOOL=ON \
95                        -DWITH_ZLIB:STRING=system \
96                        -DWITH_UNIT_TESTS:BOOL=ON \
97                        -DWITHOUT_OQGRAPH_STORAGE_ENGINE:BOOL=ON \
98                        -DPLUGIN_TOKUDB:STRING=NO \
99                        -DENABLE_GCOV:BOOL=OFF \
100                        -DENABLE_DTRACE:BOOL=OFF \
101                        -DWITH_READLINE:BOOL=ON \
102                        -DWITH_LIBWRAP:BOOL=ON \
103                        -DWITH_SSL:STRING=no \
104                        -DMYSQL_MAINTAINER_MODE:STRING=AUTO
105
106    post-build {
107        set dirs ${cmake.build_dir}
108        foreach dir ${dirs} {
109            reinplace -E {s|-arch [a-z0-9_]+||g} \
110                ${dir}/scripts/mysql_config \
111                ${dir}/scripts/mysqlbug
112        }
113    }
114
115    post-destroot {
116        # proc portdestroot::destroot_finish fails to find and compress our man pages
117        # so borrow the compress command and run on our files now.
118        set manpath "${destroot}${prefix}/share/man"
119        set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
120        foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] {
121            # Fix paths in manpages
122            reinplace "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage}
123            # Compress all manpages with gzip
124            system "$gzip -9vf ${manpage}"
125        }
126        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] {
127            # Fix paths in sample configuration files
128            reinplace "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile}
129        }
130        xinstall -m 755 -o root -d \
131            ${destroot}${prefix}/etc/${name_mysql}
132        copy ${cmake.build_dir}/macports/macports-default.cnf \
133            ${destroot}${prefix}/etc/${name_mysql}/
134        xinstall -m 755 -o root -d \
135            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
136        copy ${cmake.build_dir}/macports/my.cnf \
137            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
138    }
139
140    post-install {
141        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} {
142            ui_msg "The ${name_mysql} client has been installed."
143            ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port."
144        }
145    }
146
147    pre-activate {
148        # The macports-default.cnf is installed by ${name_mysql}.
149        # Early versions of ${name_mysql}-server installed macports-default.cnf so for a
150        # reasonable period we need to deactivate older versions of the ${name_mysql}-server.
151        if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf]
152            && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}]
153            && [vercmp [lindex $vers 1] 5.5.24] < 0 } {
154
155            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
156        }
157    }
158
159    post-activate {
160        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
161            copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \
162                ${prefix}/etc/${name_mysql}/
163        }
164    }
165
166    variant openssl description {Enable OpenSSL support} {
167
168        depends_lib-append      path:lib/libssl.dylib:openssl
169        configure.args-delete   -DWITH_SSL:STRING=no
170        configure.args-append   -DWITH_SSL:STRING=system
171        archcheck.files-append  lib/libssl.dylib
172    }
173
174    variant system_readline description {Use system readline instead of bundled readline} {
175   
176        # Add readline support.
177        # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy
178        # of readline but use the system's (i.e. MacPorts') copy of readline"
179        depends_lib-append      port:readline
180        configure.args-delete   -DWITH_READLINE:BOOL=ON
181        configure.args-append   -DWITH_READLINE:BOOL=OFF
182        archcheck.files-append  lib/libreadline.dylib
183    }
184
185    notes "
186On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one
187will be created which loads
188${prefix}/etc/${name_mysql}/macports-default.cnf.
189
190If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not
191touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf
192will be preserved (e.g., during port upgrades, deactivations or
193activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to
194customize your ${name_mysql} installation.
195
196Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf
197will be lost during port upgrades, deactivations or activations so you
198are advised to not make changes here. Currently
199${prefix}/etc/${name_mysql}/macports-default.cnf contains only one
200directive; to disable networking. With disabled networking it is
201possible to install and have running all the MacPorts mysql ports
202simultaneously.
203"
204
205    livecheck.type      regex
206    livecheck.url       https://downloads.mariadb.org
207    livecheck.regex     "btn-large\" href=\"/mariadb/(${version_branch}\[^/\]+)/\">"
208}
209
210subport ${name_mysql}-server {
211
212    revision            ${revision_server}
213    license             BSD
214    description         (Beta version) Run ${name_mysql} as server
215    long_description    ${description}
216
217    supported_archs     noarch
218    distfiles
219
220    depends_run         port:${name_mysql}
221
222    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
223        set mysqluser       _mysql
224    } else {
225        set mysqluser       mysql
226    }
227    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
228
229    startupitem.create      yes
230    startupitem.executable  ${prefix}/lib/${name_mysql}/bin/mysqld --user=${mysqluser}
231
232    use_configure       no
233
234    build {}
235
236    destroot {
237        xinstall -m 755 -o root -d \
238            ${destroot}${prefix}/var/run
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.