|
| 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 | + |
| 3 | +PortSystem 1.0 |
| 4 | +PortGroup legacysupport 1.0 |
| 5 | +# CLOCK_REALTIME |
| 6 | +legacysupport.newest_darwin_requires_legacy 15 |
| 7 | + |
| 8 | +name mariadb-11.8 |
| 9 | +set name_mysql ${name} |
| 10 | +version 11.8.5 |
| 11 | +set version_branch [join [lrange [split ${version} .] 0 1] .] |
| 12 | +# Please set revision_client and revision_server to 0 if you bump |
| 13 | +# version; these can be changed independently for the 2 subports, but |
| 14 | +# can be changed at the same time if that's what's required. |
| 15 | +set revision_client 0 |
| 16 | +set revision_server 0 |
| 17 | +categories databases |
| 18 | +homepage https://mariadb.org/ |
| 19 | +maintainers {@BjarneDMat mathiesen.info:macintosh} openmaintainer |
| 20 | + |
| 21 | +if {$subport eq $name} { |
| 22 | + |
| 23 | + PortGroup cmake 1.0 |
| 24 | + PortGroup select 1.0 |
| 25 | + PortGroup boost 1.0 |
| 26 | + PortGroup openssl 1.0 |
| 27 | + |
| 28 | + boost.version 1.88 |
| 29 | + compiler.cxx_standard 2011 |
| 30 | + |
| 31 | + openssl.branch 3 |
| 32 | + |
| 33 | + # https://trac.macports.org/ticket/60805 |
| 34 | + compiler.blacklist-append {clang < 900} |
| 35 | + |
| 36 | + revision ${revision_client} |
| 37 | + |
| 38 | + license GPL-2 |
| 39 | + description Multithreaded SQL database server |
| 40 | + long_description Mariadb is a fork of the MySQL server, a multi-threaded SQL database. |
| 41 | + |
| 42 | + cmake.out_of_source yes |
| 43 | + |
| 44 | + master_sites https://downloads.mariadb.org/rest-api/mariadb/${version}/ |
| 45 | + distname mariadb-${version} |
| 46 | + checksums rmd160 e163db0afae0f0233f3493a6f56a163b3bf2eade \ |
| 47 | + sha256 bcb7394569c08877c283e1649869504531bee8caafa30288f078e30d99fcb9f6 \ |
| 48 | + size 119948843 |
| 49 | + |
| 50 | + depends_build-append port:bison |
| 51 | + depends_lib-append port:curl \ |
| 52 | + port:judy \ |
| 53 | + port:libxml2 \ |
| 54 | + port:ncurses \ |
| 55 | + port:pcre2 \ |
| 56 | + port:tcp_wrappers \ |
| 57 | + port:zlib |
| 58 | + depends_run-append port:mysql_select |
| 59 | + |
| 60 | + select.group mysql |
| 61 | + select.file ${filespath}/${name_mysql} |
| 62 | + |
| 63 | + post-extract { |
| 64 | + file mkdir ${cmake.build_dir}/macports |
| 65 | + copy ${filespath}/macports-default.cnf \ |
| 66 | + ${filespath}/my.cnf \ |
| 67 | + ${cmake.build_dir}/macports/ |
| 68 | + } |
| 69 | + |
| 70 | + patch.pre_args-replace -p0 -p1 |
| 71 | + patchfiles patch-cmake-install_layout.cmake.diff \ |
| 72 | + patch-CMakeLists.txt.diff \ |
| 73 | + patch-libmariadb_cmake_install.cmake.diff \ |
| 74 | + patch-libmariadb_libmariadb_CMakeLists.txt.diff \ |
| 75 | + patch-server_storage_perfschema_my_thread.h.diff \ |
| 76 | + patch-cmake_mysql_version.cmake.diff \ |
| 77 | + patch-cmake_mysql_columnstore_version.cmake.diff |
| 78 | + |
| 79 | + # temporary fix for C/C++ flag discovery |
| 80 | + patchfiles-append patch-fix-flag-discovery.diff |
| 81 | + |
| 82 | + post-patch { |
| 83 | + reinplace "s|@NAME@|${name_mysql}|g" \ |
| 84 | + ${worksrcpath}/cmake/install_layout.cmake |
| 85 | + reinplace "s|@NAME@|${name_mysql}|g" \ |
| 86 | + ${worksrcpath}/libmariadb/cmake/install.cmake |
| 87 | + reinplace "s|@NAME@|${name_mysql}|g" \ |
| 88 | + ${cmake.build_dir}/macports/macports-default.cnf \ |
| 89 | + ${cmake.build_dir}/macports/my.cnf |
| 90 | + reinplace "s|@PREFIX@|${prefix}|g" \ |
| 91 | + ${cmake.build_dir}/macports/macports-default.cnf \ |
| 92 | + ${cmake.build_dir}/macports/my.cnf |
| 93 | + move ${worksrcpath}/VERSION ${worksrcpath}/VERSION.txt |
| 94 | + move ${worksrcpath}/storage/columnstore/columnstore/VERSION ${worksrcpath}/storage/columnstore/columnstore/VERSION.txt |
| 95 | + } |
| 96 | + |
| 97 | + configure.args-delete \ |
| 98 | + -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib |
| 99 | + configure.args-append \ |
| 100 | + -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \ |
| 101 | + -DINSTALL_LAYOUT:STRING=MACPORTS \ |
| 102 | + -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \ |
| 103 | + -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \ |
| 104 | + -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \ |
| 105 | + -DDEFAULT_CHARSET:STRING=utf8mb4 \ |
| 106 | + -DDEFAULT_COLLATION:STRING=uca1400_ai_ci \ |
| 107 | + -DWITH_EMBEDDED_SERVER:BOOL=ON \ |
| 108 | + -DWITH_ZLIB:STRING=system \ |
| 109 | + -DWITH_UNIT_TESTS:BOOL=ON \ |
| 110 | + -DWITHOUT_CASSANDRA_STORAGE_ENGINE:BOOL=ON \ |
| 111 | + -DWITHOUT_MROONGA_STORAGE_ENGINE:BOOL=ON \ |
| 112 | + -DWITHOUT_ROCKSDB_STORAGE_ENGINE:BOOL=ON \ |
| 113 | + -DWITHOUT_TOKUDB_STORAGE_ENGINE:BOOL=ON \ |
| 114 | + -DENABLE_GCOV:BOOL=OFF \ |
| 115 | + -DENABLE_DTRACE:BOOL=OFF \ |
| 116 | + -DWITH_READLINE:BOOL=ON \ |
| 117 | + -DWITH_LIBWRAP:BOOL=ON \ |
| 118 | + -DWITH_SSL:STRING=yes \ |
| 119 | + -DWITH_SSL_PATH=${prefix} \ |
| 120 | + -DMYSQL_MAINTAINER_MODE:STRING=AUTO \ |
| 121 | + -DICONV_LIBRARIES=${prefix}/lib/libiconv.dylib \ |
| 122 | + -DICONV_INCLUDE_DIR:PATH=${prefix}/include \ |
| 123 | + -DCONNECT_WITH_JDBC=OFF \ |
| 124 | + -DCONNECT_WITH_LIBXML2=ON \ |
| 125 | + -DCONNECT_WITH_MONGO=OFF \ |
| 126 | + -DCONNECT_WITH_ODBC=OFF \ |
| 127 | + -DCONNECT_WITH_REST=OFF \ |
| 128 | + -DWITH_PCRE=system \ |
| 129 | + -DBISON_EXECUTABLE=${prefix}/bin/bison |
| 130 | + |
| 131 | + configure.checks.implicit_function_declaration.whitelist-append select getthrid |
| 132 | + |
| 133 | + post-destroot { |
| 134 | + # proc portdestroot::destroot_finish fails to find and compress our man pages |
| 135 | + # so borrow the compress command and run on our files now. |
| 136 | + set manpath "${destroot}${prefix}/share/man" |
| 137 | + set gzip [findBinary gzip ${portutil::autoconf::gzip_path}] |
| 138 | + foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] { |
| 139 | + # Fix paths in manpages |
| 140 | + reinplace -q "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage} |
| 141 | + # Compress all manpages with gzip |
| 142 | + system "$gzip -9vf ${manpage}" |
| 143 | + } |
| 144 | + #foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${name_mysql}/support-files/my-*.cnf] { |
| 145 | + # # Fix paths in sample configuration files |
| 146 | + # reinplace -q "s|/etc/my.cnf|${prefix}/etc/${name_mysql}/my.cnf|g" ${samp_conffile} |
| 147 | + #} |
| 148 | + xinstall -m 755 -o root -d \ |
| 149 | + ${destroot}${prefix}/etc/${name_mysql} |
| 150 | + copy ${cmake.build_dir}/macports/macports-default.cnf \ |
| 151 | + ${destroot}${prefix}/etc/${name_mysql}/ |
| 152 | + xinstall -m 755 -o root -d \ |
| 153 | + ${destroot}${prefix}/share/${name_mysql}/support-files/macports |
| 154 | + copy ${cmake.build_dir}/macports/my.cnf \ |
| 155 | + ${destroot}${prefix}/share/${name_mysql}/support-files/macports/ |
| 156 | + } |
| 157 | + |
| 158 | + post-install { |
| 159 | + if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} { |
| 160 | + ui_msg "The ${name_mysql} client has been installed." |
| 161 | + ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port." |
| 162 | + } |
| 163 | + } |
| 164 | + |
| 165 | + post-activate { |
| 166 | + if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} { |
| 167 | + copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \ |
| 168 | + ${prefix}/etc/${name_mysql}/ |
| 169 | + } |
| 170 | + } |
| 171 | + |
| 172 | + variant system_readline description {Use system readline instead of bundled readline} { |
| 173 | + # Add readline support. |
| 174 | + # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy |
| 175 | + # of readline but use the system's (i.e. MacPorts') copy of readline" |
| 176 | + depends_lib-append port:readline |
| 177 | + configure.args-delete -DWITH_READLINE:BOOL=ON |
| 178 | + configure.args-append -DWITH_READLINE:BOOL=OFF |
| 179 | + } |
| 180 | + |
| 181 | + notes " |
| 182 | +On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one |
| 183 | +will be created which loads |
| 184 | +${prefix}/etc/${name_mysql}/macports-default.cnf. |
| 185 | +
|
| 186 | +If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not |
| 187 | +touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf |
| 188 | +will be preserved (e.g., during port upgrades, deactivations or |
| 189 | +activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to |
| 190 | +customize your ${name_mysql} installation. |
| 191 | +
|
| 192 | +Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf |
| 193 | +will be lost during port upgrades, deactivations or activations so you |
| 194 | +are advised to not make changes here. Currently |
| 195 | +${prefix}/etc/${name_mysql}/macports-default.cnf contains only one |
| 196 | +directive; to disable networking. With disabled networking it is |
| 197 | +possible to install and have running all the MacPorts mysql ports |
| 198 | +simultaneously. |
| 199 | +" |
| 200 | + |
| 201 | + livecheck.url https://downloads.mariadb.org/rest-api/mariadb/${version_branch}/latest |
| 202 | + livecheck.regex {"release_id": *"([0-9.]+)"} |
| 203 | +} |
| 204 | + |
| 205 | +subport ${name_mysql}-server { |
| 206 | + |
| 207 | + revision ${revision_server} |
| 208 | + license BSD |
| 209 | + description Run ${name_mysql} as server |
| 210 | + long_description {*}${description} |
| 211 | + |
| 212 | + supported_archs noarch |
| 213 | + distfiles |
| 214 | + |
| 215 | + depends_run port:${name_mysql} |
| 216 | + |
| 217 | + if {"darwin" eq ${os.platform} && ${os.major} > 8} { |
| 218 | + set mysqluser _mysql |
| 219 | + } else { |
| 220 | + set mysqluser mysql |
| 221 | + } |
| 222 | + add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server |
| 223 | + |
| 224 | + pre-extract { |
| 225 | + copy ${filespath}/org.macports.mysql-server.plist ${workpath}/org.macports.${subport}.plist |
| 226 | + } |
| 227 | + |
| 228 | + post-patch { |
| 229 | + reinplace "s|@NAMEMYSQL@|${name_mysql}|g" \ |
| 230 | + ${workpath}/org.macports.${subport}.plist |
| 231 | + reinplace "s|@PREFIX@|${prefix}|g" \ |
| 232 | + ${workpath}/org.macports.${subport}.plist |
| 233 | + reinplace "s|@SUBPORT@|${subport}|g" \ |
| 234 | + ${workpath}/org.macports.${subport}.plist |
| 235 | + reinplace "s|@USER@|${mysqluser}|g" \ |
| 236 | + ${workpath}/org.macports.${subport}.plist |
| 237 | + reinplace "s|@GROUP@|${mysqluser}|g" \ |
| 238 | + ${workpath}/org.macports.${subport}.plist |
| 239 | + } |
| 240 | + |
| 241 | + use_configure no |
| 242 | + |
| 243 | + build {} |
| 244 | + |
| 245 | + destroot { |
| 246 | + xinstall -d -m 755 ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport} |
| 247 | + xinstall -m 0644 -o root -W ${workpath} \ |
| 248 | + org.macports.${subport}.plist \ |
| 249 | + ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport} |
| 250 | + xinstall -d -m 755 ${destroot}/Library/LaunchDaemons |
| 251 | + ln -s ${prefix}/etc/LaunchDaemons/org.macports.${subport}/org.macports.${subport}.plist \ |
| 252 | + ${destroot}/Library/LaunchDaemons/org.macports.${subport}.plist |
| 253 | + xinstall -m 755 -o root -d \ |
| 254 | + ${destroot}${prefix}/var/run |
| 255 | + xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \ |
| 256 | + ${destroot}${prefix}/etc/${name_mysql} \ |
| 257 | + ${destroot}${prefix}/var/db/${name_mysql} \ |
| 258 | + ${destroot}${prefix}/var/log/${name_mysql} \ |
| 259 | + ${destroot}${prefix}/var/run/${name_mysql} |
| 260 | + destroot.keepdirs-append \ |
| 261 | + ${destroot}${prefix}/var/db/${name_mysql} \ |
| 262 | + ${destroot}${prefix}/var/log/${name_mysql} \ |
| 263 | + ${destroot}${prefix}/var/run/${name_mysql} |
| 264 | + } |
| 265 | + |
| 266 | + notes " |
| 267 | +If this is a new install you might want to run: |
| 268 | +
|
| 269 | +\$ sudo mkdir -p ${prefix}/var/db/${name_mysql} |
| 270 | +\$ sudo chown ${mysqluser}:${mysqluser} ${prefix}/var/db/${name_mysql} |
| 271 | +\$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mariadb_install_db |
| 272 | +" |
| 273 | + |
| 274 | + livecheck.type none |
| 275 | +} |
0 commit comments