source: trunk/dports/databases/mariadb/Portfile

Last change on this file was 153724, checked in by pixilla@…, 21 months ago

databases/mariadb: replace launchd plist removing daemondo dependency.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.8 KB
RevLine 
[85113]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 153724 2016-10-09 16:53:21Z pixilla@macports.org $
3
[96340]4PortSystem          1.0
[85113]5
[96340]6name                mariadb
7set name_mysql      ${name}
[153190]8version             5.5.52
[119451]9set version_branch  [join [lrange [split ${version} .] 0 1] .]
[96340]10# Please set revision_client and revision_server to 0 if you bump version.
[148874]11set revision_client 0
[153724]12set revision_server 1
[96340]13categories          databases
14platforms           darwin
15license             GPL-2
16maintainers         pixilla openmaintainer
[97283]17homepage            http://mariadb.org/
[85113]18
[108940]19if {$subport eq $name} {
[85113]20
[96340]21    PortGroup           cmake 1.0
22    PortGroup           select 1.0
[85113]23
[96340]24    revision            ${revision_client}
25    license             GPL-2
26    description         Multithreaded SQL database server
[107236]27    long_description    Mariadb is a fork of the MySQL server, a multi-threaded SQL database.
[85113]28
[96340]29    master_sites \
[119454]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/
[85113]39
[108940]40# Mirrors with bad distfiles
[119454]41# http://mirror.switch.ch/mirror/mariadb/mariadb-${version}/source/ \
[108940]42
[137069]43    cmake.out_of_source yes
[96340]44    use_parallel_build  yes
[85113]45
[96340]46    patch.pre_args      -p1
47    patchfiles          patch-cmake-install_layout.cmake.diff \
48                        patch-CMakeLists.txt.diff
[85113]49
[153190]50    checksums           rmd160  fcad9e40ecd29b341a8cdc42afc18aa83b85e60c \
51                        sha256  e142f9459507b97c5848042863b313ce70750118446bb4e35e5c07fe66007293
[94841]52
[111854]53    depends_lib-append  port:zlib port:tcp_wrappers port:ncurses
[96340]54    depends_run-append  port:mysql_select
[85113]55
[96340]56    select.group        mysql
57    select.file         ${filespath}/${name_mysql}
[94839]58
[96340]59    post-extract {
[137069]60        file mkdir ${cmake.build_dir}/macports
[96340]61        copy ${filespath}/macports-default.cnf \
62            ${filespath}/my.cnf \
[137069]63            ${cmake.build_dir}/macports/
[96340]64    }
[85113]65
[96340]66    post-patch {
67        reinplace "s|@NAME@|${name_mysql}|g" \
68            ${worksrcpath}/cmake/install_layout.cmake
69        reinplace "s|@NAME@|${name_mysql}|g" \
[137069]70            ${cmake.build_dir}/macports/macports-default.cnf \
71            ${cmake.build_dir}/macports/my.cnf
[96340]72        reinplace "s|@PREFIX@|${prefix}|g" \
[137069]73            ${cmake.build_dir}/macports/macports-default.cnf \
74            ${cmake.build_dir}/macports/my.cnf
[85113]75    }
76
[96340]77    configure.args-delete \
78                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
79    configure.args-append \
80                        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \
81                        -DINSTALL_LAYOUT:STRING=MACPORTS \
82                        -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \
83                        -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \
84                        -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \
85                        -DDEFAULT_CHARSET:STRING=utf8 \
86                        -DDEFAULT_COLLATION:STRING=utf8_general_ci \
[100156]87                        -DWITH_EMBEDDED_SERVER:BOOL=ON \
[96340]88                        -DWITH_ZLIB:STRING=system \
89                        -DWITH_UNIT_TESTS:BOOL=ON \
[123180]90                        -DWITHOUT_OQGRAPH_STORAGE_ENGINE:BOOL=ON \
91                        -DWITHOUT_TOKUDB_STORAGE_ENGINE:BOOL=ON \
[96340]92                        -DENABLE_GCOV:BOOL=OFF \
93                        -DENABLE_DTRACE:BOOL=OFF \
94                        -DWITH_READLINE:BOOL=ON \
95                        -DWITH_LIBWRAP:BOOL=ON \
96                        -DWITH_SSL:STRING=no
97
98    post-build {
[137069]99        set dirs ${cmake.build_dir}
[96340]100        foreach dir ${dirs} {
101            reinplace -E {s|-arch [a-z0-9_]+||g} \
102                ${dir}/scripts/mysql_config \
103                ${dir}/scripts/mysqlbug
104        }
[85113]105    }
[96340]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}
[137069]124        copy ${cmake.build_dir}/macports/macports-default.cnf \
[96340]125            ${destroot}${prefix}/etc/${name_mysql}/
126        xinstall -m 755 -o root -d \
127            ${destroot}${prefix}/share/${name_mysql}/support-files/macports
[137069]128        copy ${cmake.build_dir}/macports/my.cnf \
[96340]129            ${destroot}${prefix}/share/${name_mysql}/support-files/macports/
[85113]130    }
[96340]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 {
[97283]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.
[96340]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 } {
[99736]146
147            registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1]
[96340]148        }
149    }
150
151    post-activate {
[97283]152        if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} {
[96340]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
[139229]160        depends_lib-append      path:lib/libssl.dylib:openssl
[96340]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} {
[85113]166   
[96340]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
[85113]173    }
[96340]174
[111525]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
[96340]195    livecheck.type      regex
[100156]196    livecheck.url       https://downloads.mariadb.org/mariadb/
[119451]197    livecheck.regex     "href=\"/mariadb/(${version_branch}\[^/\]+)/"
[85113]198}
199
[96340]200subport ${name_mysql}-server {
201
202    revision            ${revision_server}
203    license             BSD
204    description         Run ${name_mysql} as server
205    long_description    ${description}
206
207    supported_archs     noarch
208    distfiles
209
210    depends_run         port:${name_mysql}
211
[108940]212    if {"darwin" eq ${os.platform} && ${os.major} > 8} {
[96340]213        set mysqluser       _mysql
214    } else {
215        set mysqluser       mysql
[85113]216    }
[96340]217    add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server
218
[153724]219    pre-extract {
220        copy ${filespath}/org.macports.mysql-server.plist ${workpath}/org.macports.${subport}.plist
221    }
[96340]222
[153724]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   
[96340]238    use_configure       no
239
240    build {}
241
242    destroot {
[153724]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
[96340]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
[85113]270}
Note: See TracBrowser for help on using the repository browser.