source: trunk/dports/databases/mariadb-10.1/Portfile

Last change on this file was 153726, checked in by pixilla@…, 12 months ago

databases/mariadb-10.1: replace launchd plist removing daemondo dependency.

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