# -*- 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 PortSystem 1.0 name percona set name_mysql ${name} set name_package ${name}-server set version_mysql 8.0.16 set release 7 # Please set revision_client and revision_server to 0 if you bump version_mysql or release. set revision_client 8 set revision_server 2 set boost_version 1.69.0 version ${version_mysql}-${release} categories databases license GPL-2 maintainers nomaintainer homepage https://www.percona.com/ known_fail yes if {$subport eq $name} { PortGroup cmake 1.1 PortGroup select 1.0 PortGroup legacysupport 1.1 set version_branch [join [lrange [split ${version} .] 0 1] .] set boost_distver [join [split ${boost_version} .] _] set boost_distname boost_${boost_distver} revision ${revision_client} license GPL-2 description Multithreaded SQL database server long_description Percona is a fork of the MySQL server, a multi-threaded SQL database. master_sites https://www.percona.com/redir/downloads/Percona-Server-${version_branch}/Percona-Server-${version}/source/tarball:percona \ sourceforge:project/boost/boost/${boost_version}:boost distname ${name_package}-${version} distfiles ${distname}${extract.suffix}:percona \ ${boost_distname}${extract.suffix}:boost # Requires c++14 compiler.cxx_standard 2014 patchfiles patch-cmake-install_layout.cmake.diff \ patch-protobuf.diff \ patch-local_boost_first.diff \ patch-doc_dir.diff \ patch-so_location.diff \ patch-libmysql-CMakeLists.txt.diff checksums ${distname}${extract.suffix} \ rmd160 e3f9f1d6b4e4b8c171119b9c9b70499450467c0b \ sha256 8f8f685c23917054f47b7b3a0f0acb6eb9157e59f46463caf112d1704495e798 \ size 188873588 \ ${boost_distname}${extract.suffix} \ rmd160 ad6cd576a5229a11601986908ff03261582c9f81 \ sha256 9a2c2819310839ea373f42d69e733c339b4e9a19deab6bfec448281554aa4dbb \ size 111710205 depends_lib-append port:cyrus-sasl2 \ path:lib/pkgconfig/icu-uc.pc:icu \ port:libevent \ port:lz4 \ port:protobuf3-cpp \ port:re2 \ port:zlib \ port:tcp_wrappers depends_run-append port:mysql_select select.group mysql select.file ${filespath}/${name_mysql} post-extract { file mkdir ${cmake.build_dir}/macports copy ${filespath}/macports-default.cnf \ ${filespath}/my.cnf \ ${cmake.build_dir}/macports/ } post-patch { reinplace "s|@NAME@|${name_mysql}|g" \ ${worksrcpath}/cmake/install_layout.cmake reinplace "s|@NAME@|${name_mysql}|g" \ ${cmake.build_dir}/macports/macports-default.cnf \ ${cmake.build_dir}/macports/my.cnf reinplace "s|@PREFIX@|${prefix}|g" \ ${cmake.build_dir}/macports/macports-default.cnf \ ${cmake.build_dir}/macports/my.cnf } # the default `cmake.build_type MacPorts` confuses Percona cmake.build_type Release if {[variant_isset debug]} { # storage/innobase/btr/btr0cur.cc:2960:18: error: use of undeclared identifier 'debug_sync_set_action' # See also https://jira.mariadb.org/browse/MDEV-11148 pre-fetch { return -code error "Building Percona with debugging enabled is currently broken" } } if { (![variant_isset universal] && ${build_arch} eq "i386") || ([variant_isset universal] && [lsearch ${universal_archs} i386] != -1) } { # switch to /usr/bin/gcc and /usr/bin/g++ # closest to SET(CMAKE_CXX_COMPILER g++) removed in the patchfile configure.compiler gcc } configure.args-delete \ -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib configure.args-append \ -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${name_mysql}/mysql \ -DINSTALL_LAYOUT:STRING=MACPORTS \ -DSYSCONFDIR:PATH=${prefix}/etc/${name_mysql} \ -DMYSQL_UNIX_ADDR:PATH=${prefix}/var/run/${name_mysql}/mysqld.sock \ -DMYSQL_DATADIR:PATH=${prefix}/var/db/${name_mysql} \ -DDEFAULT_CHARSET:STRING=utf8 \ -DDEFAULT_COLLATION:STRING=utf8_general_ci \ -DWITH_ICU:STRING=system \ -DWITH_LIBEVENT:STRING=system \ -DWITH_LZ4:STRING=system \ -DWITH_PROTOBUF:STRING=system \ -DWITH_RE2:STRING=system \ -DWITH_SASL:STRING=system \ -DWITH_ZLIB:STRING=system \ -DWITH_UNIT_TESTS:BOOL=OFF \ -DENABLE_GCOV:BOOL=OFF \ -DENABLE_DTRACE:BOOL=OFF \ -DWITH_EDITLINE:STRING=bundled \ -DWITH_LIBWRAP:BOOL=ON \ -DWITH_SSL:STRING=bundled \ -DWITH_EMBEDDED_SERVER:BOOL=ON \ -DWITHOUT_TOKUDB=ON \ -DWITHOUT_ROCKSDB=ON \ -DDOWNLOAD_BOOST=0 \ -DWITH_BOOST:PATH="${worksrcpath}/../${boost_distname}" \ -DINSTALL_MYSQLTESTDIR= post-destroot { # proc portdestroot::destroot_finish fails to find and compress our man pages # so borrow the compress command and run on our files now. set manpath "${destroot}${prefix}/share/man" set gzip [findBinary gzip ${portutil::autoconf::gzip_path}] foreach manpage [glob -type f ${destroot}${prefix}/share/man/${name_mysql}/man\[1-9\]/*] { # Fix paths in manpages reinplace -q "s|/etc/|${prefix}/etc/${name_mysql}/|g" ${manpage} # Compress all manpages with gzip system "$gzip -9vf ${manpage}" } set link_dir ${destroot}${prefix}/lib/${name_mysql}/mysql foreach link_target [glob -directory ${link_dir} -type f -nocomplain -tails libperconaserver*.*] { # Create compatibility simlinks set link_name [strsed ${link_target} "s|perconaserver|mysql|"] ln -sf "${link_target}" "${link_dir}/${link_name}" } xinstall -m 755 -o root -d \ ${destroot}${prefix}/etc/${name_mysql} copy ${cmake.build_dir}/macports/macports-default.cnf \ ${destroot}${prefix}/etc/${name_mysql}/ xinstall -m 755 -o root -d \ ${destroot}${prefix}/share/${name_mysql}/support-files/macports copy ${cmake.build_dir}/macports/my.cnf \ ${destroot}${prefix}/share/${name_mysql}/support-files/macports/ } post-install { if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${name_mysql}/org.macports.${name_mysql}-server.plist]} { ui_msg "The ${name_mysql} client has been installed." ui_msg "To install the ${name_mysql} server, install the ${name_mysql}-server port." } } pre-activate { # The macports-default.cnf is installed by ${name_mysql}. # Early versions of ${name_mysql}-server installed macports-default.cnf so for a # reasonable period we need to deactivate older versions of the ${name_mysql}-server. if { [file exists ${prefix}/etc/${name_mysql}/macports-default.cnf] && ![catch {set vers [lindex [registry_active ${name_mysql}-server] 0]}] && [vercmp [lindex $vers 1] 5.5.24-26.0] < 0 } { registry_deactivate_composite ${name_mysql}-server "" [list ports_nodepcheck 1] } } post-activate { if {![file exists ${prefix}/etc/${name_mysql}/my.cnf]} { copy ${prefix}/share/${name_mysql}/support-files/macports/my.cnf \ ${prefix}/etc/${name_mysql}/ } } variant openssl description {Enable OpenSSL support} {} # Until yassl builds use MacPorts openssl. # Getting mysql56 to build with yassl would make the binaries distributable. # When mysql56 builds with yassl remove "true" from the "if" statement below or # put the contents of the "if" block into the openssl variant block. if { true || [variant_isset openssl] } { configure.args-delete -DWITH_SSL:STRING=bundled configure.args-append -DWITH_SSL:STRING=${prefix} depends_lib-append path:lib/libssl.dylib:openssl } variant system_readline description {Use system readline instead of bundled readline} { # Add readline support. # "-DWITH_READLINE:BOOL=OFF" has the peculiar meaning "do not use the bundled copy # of readline but use the system's (i.e. MacPorts') copy of readline" depends_lib-append port:readline configure.args-delete -DWITH_EDITLINE:STRING=bundled configure.args-append -DWITH_READLINE:STRING=system } notes " On activation if no ${prefix}/etc/${name_mysql}/my.cnf file exists one will be created which loads ${prefix}/etc/${name_mysql}/macports-default.cnf. If a ${prefix}/etc/${name_mysql}/my.cnf file exists MacPorts does not touch it and any changes you make to ${prefix}/etc/${name_mysql}/my.cnf will be preserved (e.g., during port upgrades, deactivations or activations). ${prefix}/etc/${name_mysql}/my.cnf is a good place to customize your ${name_mysql} installation. Any changes made to ${prefix}/etc/${name_mysql}/macports-default.cnf will be lost during port upgrades, deactivations or activations so you are advised to not make changes here. Currently ${prefix}/etc/${name_mysql}/macports-default.cnf contains only one directive; to disable networking. With disabled networking it is possible to install and have running all the MacPorts mysql ports simultaneously. " livecheck.type regex livecheck.url https://github.com/percona/percona-server/releases livecheck.regex "releases/tag/Percona-Server-(${version_branch}\[\\d\\.-\]*)" } subport ${name_mysql}-server { revision ${revision_server} license BSD description Run ${name_mysql} as server long_description {*}${description} supported_archs noarch distfiles depends_run port:${name_mysql} if {"darwin" eq ${os.platform} && ${os.major} > 8} { set mysqluser _mysql } else { set mysqluser mysql } add_users ${mysqluser} group=${mysqluser} realname=MySQL\ Server pre-extract { copy ${filespath}/org.macports.mysql-server.plist ${workpath}/org.macports.${subport}.plist } post-patch { reinplace "s|@NAME@|${subport}|g" \ ${workpath}/org.macports.${subport}.plist reinplace "s|@NAMEMYSQL@|${name_mysql}|g" \ ${workpath}/org.macports.${subport}.plist reinplace "s|@PREFIX@|${prefix}|g" \ ${workpath}/org.macports.${subport}.plist reinplace "s|@SUBPORT@|${subport}|g" \ ${workpath}/org.macports.${subport}.plist reinplace "s|@USER@|${mysqluser}|g" \ ${workpath}/org.macports.${subport}.plist reinplace "s|@GROUP@|${mysqluser}|g" \ ${workpath}/org.macports.${subport}.plist } use_configure no build {} destroot { xinstall -d -m 755 ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport} xinstall -m 0644 -o root -W ${workpath} \ org.macports.${subport}.plist \ ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${subport} xinstall -d -m 755 ${destroot}/Library/LaunchDaemons ln -s ${prefix}/etc/LaunchDaemons/org.macports.${subport}/org.macports.${subport}.plist \ ${destroot}/Library/LaunchDaemons/org.macports.${subport}.plist xinstall -m 755 -o root -d \ ${destroot}${prefix}/var/run xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \ ${destroot}${prefix}/etc/${name_mysql} \ ${destroot}${prefix}/var/db/${name_mysql} \ ${destroot}${prefix}/var/log/${name_mysql} \ ${destroot}${prefix}/var/run/${name_mysql} destroot.keepdirs-append \ ${destroot}${prefix}/var/db/${name_mysql} \ ${destroot}${prefix}/var/log/${name_mysql} \ ${destroot}${prefix}/var/run/${name_mysql} } notes " If this is a new install you might want to run: \$ sudo -u ${mysqluser} ${prefix}/lib/${name_mysql}/bin/mysql_install_db " livecheck.type none }