aboutsummaryrefslogtreecommitdiff
path: root/databases/mariadb101-server
diff options
context:
space:
mode:
authorBernard Spil <brnrd@FreeBSD.org>2016-02-13 19:02:11 +0000
committerBernard Spil <brnrd@FreeBSD.org>2016-02-13 19:02:11 +0000
commiteaba6fd276e88a4d7d31206b165709689b057dc3 (patch)
treeec99111658fa37fc7b9707a154f5335176cd717c /databases/mariadb101-server
parent7f59cc28ce8f2a13941fc97a4a155f49bbce6d02 (diff)
downloadports-eaba6fd276e88a4d7d31206b165709689b057dc3.tar.gz
ports-eaba6fd276e88a4d7d31206b165709689b057dc3.zip
Notes
Diffstat (limited to 'databases/mariadb101-server')
-rw-r--r--databases/mariadb101-server/Makefile163
-rw-r--r--databases/mariadb101-server/distinfo2
-rw-r--r--databases/mariadb101-server/files/extra-patch-include_my__compare.h11
-rw-r--r--databases/mariadb101-server/files/mysql-server.in139
-rw-r--r--databases/mariadb101-server/files/patch-CMakeLists.txt20
-rw-r--r--databases/mariadb101-server/files/patch-client_CMakeLists.txt72
-rw-r--r--databases/mariadb101-server/files/patch-cmake_jemalloc.cmake24
-rw-r--r--databases/mariadb101-server/files/patch-extra_CMakeLists.txt13
-rw-r--r--databases/mariadb101-server/files/patch-extra_yassl_taocrypt_src_integer.cpp1
-rw-r--r--databases/mariadb101-server/files/patch-include_CMakeLists.txt26
-rw-r--r--databases/mariadb101-server/files/patch-libmysql_CMakeLists.txt41
-rw-r--r--databases/mariadb101-server/files/patch-libservices_CMakeLists.txt11
-rw-r--r--databases/mariadb101-server/files/patch-man_CMakeLists.txt14
-rw-r--r--databases/mariadb101-server/files/patch-mysys_my__default.c63
-rw-r--r--databases/mariadb101-server/files/patch-pcre_CMakeLists.txt13
-rw-r--r--databases/mariadb101-server/files/patch-scripts_CMakeLists.txt1
-rw-r--r--databases/mariadb101-server/files/patch-scripts_mysql__config.sh12
-rw-r--r--databases/mariadb101-server/files/patch-scripts_mysqld__safe.sh26
-rw-r--r--databases/mariadb101-server/files/patch-sql_CMakeLists.txt30
-rw-r--r--databases/mariadb101-server/files/patch-sql_sql__trigger.cc52
-rw-r--r--databases/mariadb101-server/files/patch-sql_sql__view.cc65
-rw-r--r--databases/mariadb101-server/files/patch-sql_sys__vars.cc40
-rw-r--r--databases/mariadb101-server/files/patch-storage_connect_json.cpp1
-rw-r--r--databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_cmake__modules_TokuFeatureDetection.cmake19
-rw-r--r--databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_portability_memory.cc16
-rw-r--r--databases/mariadb101-server/files/patch-support-files_CMakeLists.txt14
-rw-r--r--databases/mariadb101-server/files/pkg-message.in15
-rw-r--r--databases/mariadb101-server/pkg-descr14
-rw-r--r--databases/mariadb101-server/pkg-plist190
29 files changed, 1108 insertions, 0 deletions
diff --git a/databases/mariadb101-server/Makefile b/databases/mariadb101-server/Makefile
new file mode 100644
index 000000000000..98af9553609e
--- /dev/null
+++ b/databases/mariadb101-server/Makefile
@@ -0,0 +1,163 @@
+# $FreeBSD$
+
+PORTNAME?= mariadb
+PORTVERSION= 10.1.11
+CATEGORIES= databases ipv6
+MASTER_SITES= http://ftp.osuosl.org/pub/${SITESDIR}/ \
+ http://mirrors.supportex.net/${SITESDIR}/ \
+ http://mirror2.hs-esslingen.de/pub/Mirrors/${SITESDIR}/ \
+ http://gd.tuwien.ac.at/db/${SITESDIR}/ \
+ http://mirrors.fe.up.pt/pub/${SITESDIR}/ \
+ http://mirror.de.gsnw.de:56431/${SITESDIR}/ \
+ http://mirror.layerjet.com/${SITESDIR}/ \
+ http://mirror.switch.ch/mirror/${SITESDIR}/
+PKGNAMESUFFIX?= 101-server
+
+MAINTAINER= brnrd@FreeBSD.org
+COMMENT?= Multithreaded SQL database (server)
+
+LICENSE= GPLv2
+
+SUB_FILES= pkg-message
+PKGMESSAGE= ${WRKDIR}/pkg-message
+
+SLAVEDIRS= databases/mariadb101-client
+USES= bison:build cmake cpe execinfo shebangfix
+USE_LDCONFIG= ${PREFIX}/lib/mysql
+SHEBANG_FILES= scripts/*.sh
+SITESDIR= mariadb/mariadb-${PORTVERSION}/source
+
+OPTIONS_DEFINE= FASTMTX
+OPTIONS_SINGLE= GSSAPI
+OPTIONS_SINGLE_GSSAPI= GSSAPI_BASE GSSAPI_HEIMDAL GSSAPI_MIT
+OPTIONS_DEFAULT= GSSAPI_BASE
+
+FASTMTX_DESC= Replace mutexes with spinlocks
+
+.if !defined(CLIENT_ONLY)
+# MySQL-Server options
+OPTIONS_DEFINE+= MAXKEY
+OPTIONS_DEFAULT+= MAXKEY SPHINX SPIDER
+OPTIONS_GROUP= ENGINES
+OPTIONS_GROUP_ENGINES= INNOBASE MROONGA OQGRAPH SPHINX SPIDER TOKUDB
+
+ENGINES_DESC= Optional MariaDB storage engines
+INNOBASE_DESC= Build InnoDB engine next to XtraDB
+MAXKEY_DESC= Change max key length from 1000 to 4000
+MROONGA_DESC= Mroonga Full Text Search engine
+OQGRAPH_DESC= Open Query Graph Computation engine (Requires GCC)
+SPHINX_DESC= SphinxSE engine
+SPIDER_DESC= Partitioning and XA-transactions engine
+TOKUDB_DESC= Fractal tree index tree data structure engine
+.endif
+
+GSSAPI_BASE_USES= gssapi
+GSSAPI_HEIMDAL_USES= gssapi:heimdal
+GSSAPI_MIT_USES= gssapi:mit
+
+CMAKE_ARGS+= -DINSTALL_DOCDIR="share/doc/mysql" \
+ -DINSTALL_DOCREADMEDIR="share/doc/mysql" \
+ -DINSTALL_INCLUDEDIR="include/mysql" \
+ -DINSTALL_INFODIR="info" \
+ -DINSTALL_LIBDIR="lib/mysql" \
+ -DINSTALL_MANDIR="man" \
+ -DINSTALL_MYSQLDATADIR="/var/db/mysql" \
+ -DINSTALL_MYSQLSHAREDIR="share/mysql" \
+ -DINSTALL_MYSQLTESTDIR= \
+ -DINSTALL_PLUGINDIR="lib/mysql/plugin" \
+ -DINSTALL_SBINDIR="libexec" \
+ -DINSTALL_SCRIPTDIR="bin" \
+ -DINSTALL_SHAREDIR="share" \
+ -DINSTALL_SQLBENCHDIR= \
+ -DINSTALL_SUPPORTFILESDIR="share/mysql" \
+ -DWITH_UNIT_TESTS=0 \
+ -DWITH_LIBWRAP=1 \
+ -DWITH_SSL=${OPENSSLBASE} \
+ -DKRB5_CONFIG=${KRB5CONFIG} \
+ -DEXECINFO_ROOT=${LOCALBASE} \
+ -DCOMPILATION_COMMENT="FreeBSD Ports"
+
+DATADIR= ${PREFIX}/share/mysql
+
+.ifdef USE_MYSQL
+.error You have `USE_MYSQL' variable defined either in environment or in make(1) arguments. This leads to a circular dependency. Please undefine and try again.
+.endif
+
+CONFLICTS_INSTALL= mariadb5*-${PKGNAMESUFFIX:C/^[0-9]*-//}-* \
+ mariadb10[02-9]-${PKGNAMESUFFIX:C/^[0-9]*-//}-* \
+ mysql[0-9]*-${PKGNAMESUFFIX:C/^[0-9]*-//}-* \
+ percona[0-9]*-${PKGNAMESUFFIX:C/^[0-9]*-//}-*
+
+USE_OPENSSL= yes
+FASTMTX_CMAKE_ON= -DWITH_FAST_MUTEXES=1
+
+.if defined(CLIENT_ONLY)
+# MySQL-Client part
+USES+= readline
+.else
+# MySQL-Server part
+USE_MYSQL= yes
+WANT_MYSQL_VER= 101m
+OPTIONS_SUB= yes
+USE_LDCONFIG+= ${PREFIX}/lib/mysql/plugin
+USE_RC_SUBR= mysql-server
+USERS= mysql
+GROUPS= mysql
+CMAKE_ARGS+= -DWITH_EMBEDDED_SERVER="ON" \
+ -DCMAKE_SKIP_BUILD_RPATH:BOOL=YES \
+ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+
+.for ENGINE in ${OPTIONS_GROUP_ENGINES}
+${ENGINE}_CMAKE_OFF= -DWITHOUT_${ENGINE}=1
+.endfor
+
+MAXKEY_EXTRA_PATCHES+= ${FILESDIR}/extra-patch-include_my__compare.h
+OQGRAPH_LIB_DEPENDS= libboost_system.so:${PORTSDIR}/devel/boost-libs \
+ libJudy.so:${PORTSDIR}/devel/judy
+# Currently OQGraph does not build using clang.
+# See See https://mariadb.atlassian.net/browse/MDEV-8051.
+OQGRAPH_USE= gcc=yes
+TOKUDB_LIB_DEPENDS= libsnappy.so:${PORTSDIR}/archivers/snappy
+
+post-install:
+# Remove programs to avoid conflict with mariadb101-client
+# These are "client" components, so there should be a switch that
+# prevents them from being installed but it's unknown right now
+ ${RM} ${STAGEDIR}${PREFIX}/bin/msql2mysql \
+ ${STAGEDIR}${PREFIX}/bin/mysql_config \
+ ${STAGEDIR}${PREFIX}/bin/mysql_find_rows \
+ ${STAGEDIR}${PREFIX}/bin/mysqlaccess
+ ${RM} -r ${STAGEDIR}/${PREFIX}/share/mysql/policy \
+ ${STAGEDIR}/${PREFIX}/share/pkgconfig
+# See https://mariadb.atlassian.net/browse/MDEV-9529
+ ${RM} ${STAGEDIR}/${PREFIX}/bin/maria_add_gis_sp.sql
+.endif # defined(CLIENT_ONLY)
+
+.include <bsd.port.options.mk>
+
+.if defined(WITH_OPENSSL_PORT) && ${PORT_OPTIONS:MGSSAPI_BASE}
+IGNORE= GSSAPI_BASE is not compatible with OpenSSL from ports. Use other GSSAPI options or OpenSSL from base system
+.endif
+
+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} == DragonFly
+CMAKE_ARGS+= -DWITHOUT_TOKUDB
+.endif
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1000012
+CMAKE_ARGS+= -DWITH_JEMALLOC="system"
+.else
+CMAKE_ARGS+= -DWITH_JEMALLOC="no"
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} 's/*.1/${MAN1}/' ${WRKSRC}/man/CMakeLists.txt
+ @${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/mysys/my_default.c
+ @${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/scripts/mysql_config.sh
+.if ${OPSYS} == DragonFly
+ ${CP} ${WRKSRC}/cmake/os/FreeBSD.cmake \
+ ${WRKSRC}/cmake/os/DragonFly.cmake
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/databases/mariadb101-server/distinfo b/databases/mariadb101-server/distinfo
new file mode 100644
index 000000000000..e4c38e7fea55
--- /dev/null
+++ b/databases/mariadb101-server/distinfo
@@ -0,0 +1,2 @@
+SHA256 (mariadb-10.1.11.tar.gz) = cd32927370343b4f14bcc6073bca163623c27843ae7bc59c8c6a9ebeda0325ce
+SIZE (mariadb-10.1.11.tar.gz) = 55184229
diff --git a/databases/mariadb101-server/files/extra-patch-include_my__compare.h b/databases/mariadb101-server/files/extra-patch-include_my__compare.h
new file mode 100644
index 000000000000..5fc447b98cd7
--- /dev/null
+++ b/databases/mariadb101-server/files/extra-patch-include_my__compare.h
@@ -0,0 +1,11 @@
+--- include/my_compare.h.orig 2012-11-28 17:49:43.000000000 +0200
++++ include/my_compare.h 2012-12-23 02:45:51.000000000 +0200
+@@ -40,7 +40,7 @@
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+ */
+
+-#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
++#define HA_MAX_KEY_LENGTH 4000 /* Max length in bytes */
+ #define HA_MAX_KEY_SEG 32 /* Max segments for key */
+
+ #define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
diff --git a/databases/mariadb101-server/files/mysql-server.in b/databases/mariadb101-server/files/mysql-server.in
new file mode 100644
index 000000000000..5f5603f2f575
--- /dev/null
+++ b/databases/mariadb101-server/files/mysql-server.in
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+# $FreeBSD: head/databases/mariadb55-server/files/mysql-server.in 361647 2014-07-12 22:42:33Z rakuco $
+#
+# PROVIDE: mysql
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable mysql:
+# mysql_(instance_)?enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable MySQL.
+# mysql_(instance_)?limits (bool): Set to "NO" by default.
+# Set it to yes to run `limits -e -U mysql`
+# just before mysql starts.
+# mysql_(instance_)?dbdir (str): Default to "/var/db/mysql"
+# Base database directory.
+# mysql_(instance_)?args (str): Custom additional arguments to be passed
+# to mysqld_safe (default empty).
+# mysql_(instance_)?pidfile (str): Custum PID file path and name.
+# Default to "${mysql_dbdir}/${hostname}.pid".
+# mysql_(instance_)?user (str): User to run mysqld as
+# Default to "mysql" created by the port
+# mysql_(instance_)?optfile (str): Server-specific option file.
+# Default to "${mysql_dbdir}/my.cnf".
+# mysql_instances (str): Set to "" by default.
+# If defined, list of instances to enable
+
+. /etc/rc.subr
+
+name="mysql"
+rcvar=mysql_enable
+
+load_rc_config $name
+
+: ${mysql_enable="NO"}
+: ${mysql_limits="NO"}
+: ${mysql_user="mysql"}
+: ${mysql_limits_args="-e -U $mysql_user"}
+: ${mysql_dbdir="/var/db/mysql"}
+: ${mysql_optfile="${mysql_dbdir}/my.cnf"}
+
+command="/usr/sbin/daemon"
+procname="%%PREFIX%%/libexec/mysqld"
+start_precmd="${name}_prestart"
+start_postcmd="${name}_poststart"
+
+if [ -n "$2" ]; then
+ instance="$2"
+ load_rc_config ${name}_${instance}
+ case "$mysql_instances" in
+ "$2 "*|*" $2 "*|*" $2"|"$2")
+ eval mysql_args="\${mysql_${instance}_args:-\"${mysql_args}\"}"
+ eval mysql_dbdir="\${mysql_${instance}_dbdir:-\"/var/db/mysql_${instance}\"}"
+ eval mysql_limits="\${mysql_${instance}_limits:-\"${mysql_limits}\"}"
+ eval mysql_user="\${mysql_${instance}_user:-\"${mysql_user}\"}"
+ eval mysql_limits_args="\${mysql_${instance}_limits_args:-\"-e -U $mysql_user\"}"
+ eval mysql_optfile="\${mysql_${instance}_optfile:-\"${mysql_dbdir}/my.cnf\"}"
+ eval mysql_pidfile="\${mysql_${instance}_pidfile:-\"${mysql_dbdir}/`/bin/hostname`.pid\"}"
+ ;;
+ *)
+ err 1 "$2 not found in mysql_instances" ;;
+ esac
+else
+ if [ -n "${mysql_instances}" -a -n "$1" ]; then
+ for instance in ${mysql_instances}; do
+ eval _enable="\${mysql_${instance}_enable}"
+ case "${_enable:-${mysql_enable}}" in
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ continue
+ ;;
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ ;;
+ *)
+ if [ -z "$_enable" ]; then
+ _var=mysql_enable
+ else
+ _var=mysql_${instance}_enable
+ fi
+ warn "Bad value" \
+ "'${_enable:-${mysql_enable}}'" \
+ "for ${_var}. " \
+ "Instance ${instance} skipped."
+ continue
+ ;;
+ esac
+ echo "===> mysql instance: ${instance}"
+ if %%PREFIX%%/etc/rc.d/mysql-server $1 ${instance}; then
+ success="${instance} ${success}"
+ else
+ failed="${instance} (${retcode}) ${failed}"
+ fi
+ done
+ exit 0
+ else
+ mysql_pidfile=${mysql_pidfile:-"${mysql_dbdir}/`/bin/hostname`.pid"}
+ fi
+fi
+
+pidfile=$mysql_pidfile
+mysql_install_db="%%PREFIX%%/bin/mysql_install_db"
+mysql_install_db_args="--basedir=%%PREFIX%% --datadir=${mysql_dbdir} --force"
+command_args="-c -f %%PREFIX%%/bin/mysqld_safe --defaults-extra-file=${mysql_optfile} --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args}"
+
+mysql_create_auth_tables()
+{
+ eval $mysql_install_db $mysql_install_db_args
+ [ $? -eq 0 ] && chown -R ${mysql_user}:$(id -gn $mysql_user) ${mysql_dbdir}
+}
+
+mysql_prestart()
+{
+ local dir
+ for dir in /etc /etc/mysql; do
+ if [ -f "${dir}/my.cnf" ]; then
+ echo "Please move existing my.cnf file from ${dir} to %%PREFIX%%${dir}"
+ return 1
+ fi
+ done
+ if [ ! -d "${mysql_dbdir}/mysql/." ]; then
+ mysql_create_auth_tables || return 1
+ fi
+ if checkyesno mysql_limits; then
+ eval `/usr/bin/limits ${mysql_limits_args:-"-e -U $mysql_user"}` 2>/dev/null
+ else
+ return 0
+ fi
+}
+
+mysql_poststart()
+{
+ local timeout=15
+ while [ ! -f "${pidfile}" -a ${timeout} -gt 0 ]; do
+ timeout=$(( timeout - 1 ))
+ sleep 1
+ done
+ return 0
+}
+
+run_rc_command "$1"
diff --git a/databases/mariadb101-server/files/patch-CMakeLists.txt b/databases/mariadb101-server/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..0a25755095a1
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-CMakeLists.txt
@@ -0,0 +1,20 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- CMakeLists.txt.orig 2015-10-15 15:43:35 UTC
++++ CMakeLists.txt
+@@ -452,6 +452,7 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+
++IF(FALSE)
+ INSTALL_DOCUMENTATION(README CREDITS COPYING COPYING.LESSER COPYING.thirdparty
+ EXCEPTIONS-CLIENT COMPONENT Readme)
+ # MDEV-6526 these files are not installed anymore
+@@ -462,6 +463,7 @@ IF(UNIX)
+ INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme)
+ INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme)
+ ENDIF()
++ENDIF()
+
+ INCLUDE(CPack)
+
diff --git a/databases/mariadb101-server/files/patch-client_CMakeLists.txt b/databases/mariadb101-server/files/patch-client_CMakeLists.txt
new file mode 100644
index 000000000000..e82312f3dbd2
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-client_CMakeLists.txt
@@ -0,0 +1,72 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- client/CMakeLists.txt.orig 2015-10-15 15:43:35 UTC
++++ client/CMakeLists.txt
+@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
+ COPY_OPENSSL_DLLS(copy_openssl_client)
+
+ ADD_DEFINITIONS(${SSL_DEFINES})
++IF(FALSE)
+ MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc
+ ${CMAKE_SOURCE_DIR}/sql/sql_string.cc)
+ TARGET_LINK_LIBRARIES(mysql mysqlclient)
+@@ -37,6 +38,7 @@ IF(UNIX)
+ TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY})
+ SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE)
+ ENDIF(UNIX)
++ENDIF()
+
+ MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
+ SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
+@@ -44,6 +46,7 @@ TARGET_LINK_LIBRARIES(mysqltest mysqlcli
+ SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
+
+
++IF(FALSE)
+ MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
+ TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient)
+
+@@ -53,17 +56,21 @@ TARGET_LINK_LIBRARIES(mysqldump mysqlcli
+ MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
+ SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
+ TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)
++ENDIF()
+
+ MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server)
+ TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient)
+ ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
+
++IF(FALSE)
+ MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c)
+ TARGET_LINK_LIBRARIES(mysqlshow mysqlclient)
++ENDIF()
+
+ MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
+ TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient)
+
++IF(FALSE)
+ MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)
+ TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)
+
+@@ -73,17 +80,20 @@ TARGET_LINK_LIBRARIES(mysqladmin mysqlcl
+ MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
+ SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
+ TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
++ENDIF()
+
+ # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
+ IF(WIN32)
+ MYSQL_ADD_EXECUTABLE(echo echo.c COMPONENT Junk)
+ ENDIF(WIN32)
+
++IF(FALSE)
+ # async_example is just a code example, do not install it.
+ ADD_EXECUTABLE(async_example async_example.c)
+ TARGET_LINK_LIBRARIES(async_example mysqlclient)
++ENDIF()
+
+-SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example
++SET_TARGET_PROPERTIES (mysql_upgrade mysql_plugin
+ PROPERTIES HAS_CXX TRUE)
+
+ ADD_DEFINITIONS(-DHAVE_DLOPEN)
diff --git a/databases/mariadb101-server/files/patch-cmake_jemalloc.cmake b/databases/mariadb101-server/files/patch-cmake_jemalloc.cmake
new file mode 100644
index 000000000000..187de9ad4298
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-cmake_jemalloc.cmake
@@ -0,0 +1,24 @@
+Fix jemalloc detection on FreeBSD 10.x
+Upstream https://github.com/MariaDB/server/pull/140
+
+--- cmake/jemalloc.cmake.orig 2015-12-23 15:33:29 UTC
++++ cmake/jemalloc.cmake
+@@ -12,9 +12,16 @@ MACRO(JEMALLOC_TRY_STATIC)
+ ENDMACRO()
+
+ MACRO(JEMALLOC_TRY_DYNAMIC)
+- SET(libname jemalloc)
+ SET(what system)
+- CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_DYNAMIC_JEMALLOC)
++ IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND
++ CMAKE_SYSTEM_VERSION STRGREATER "10.0")
++ # Since FreeBSD 10.0 jemalloc is in base libc
++ SET(libname c)
++ SET(HAVE_DYNAMIC_JEMALLOC ON)
++ ELSE()
++ SET(libname jemalloc)
++ CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_DYNAMIC_JEMALLOC)
++ ENDIF()
+ ENDMACRO()
+
+ MACRO (CHECK_JEMALLOC)
diff --git a/databases/mariadb101-server/files/patch-extra_CMakeLists.txt b/databases/mariadb101-server/files/patch-extra_CMakeLists.txt
new file mode 100644
index 000000000000..cb63c979ddb1
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-extra_CMakeLists.txt
@@ -0,0 +1,13 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- extra/CMakeLists.txt.orig 2015-10-15 15:43:36 UTC
++++ extra/CMakeLists.txt
+@@ -91,6 +91,8 @@ IF(UNIX)
+ MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c)
+ TARGET_LINK_LIBRARIES(resolve_stack_dump mysys)
+
++IF(FALSE)
+ MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client)
+ TARGET_LINK_LIBRARIES(mysql_waitpid mysys)
+ ENDIF()
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-extra_yassl_taocrypt_src_integer.cpp b/databases/mariadb101-server/files/patch-extra_yassl_taocrypt_src_integer.cpp
new file mode 100644
index 000000000000..bb7b160deb37
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-extra_yassl_taocrypt_src_integer.cpp
@@ -0,0 +1 @@
+# Intentionally empty
diff --git a/databases/mariadb101-server/files/patch-include_CMakeLists.txt b/databases/mariadb101-server/files/patch-include_CMakeLists.txt
new file mode 100644
index 000000000000..087fee6a15de
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-include_CMakeLists.txt
@@ -0,0 +1,26 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- include/CMakeLists.txt.orig 2015-10-15 15:43:36 UTC
++++ include/CMakeLists.txt
+@@ -62,17 +62,21 @@ SET(HEADERS
+ handler_ername.h
+ )
+
++IF(FALSE)
+ INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
+ FOREACH(f ${HEADERS_GEN_CONFIGURE})
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
+ ENDFOREACH(f)
+ INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development FILES_MATCHING PATTERN "*.h")
++ENDIF()
+
+ STRING(REPLACE "." "\\." EXCL_RE "${HEADERS};${HEADERS_GEN_CONFIGURE}")
+ STRING(REPLACE ";" "|" EXCL_RE "${EXCL_RE}")
+
++IF(FALSE)
+ INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN CMakeFiles EXCLUDE
+ PATTERN mysql EXCLUDE
+ REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-libmysql_CMakeLists.txt b/databases/mariadb101-server/files/patch-libmysql_CMakeLists.txt
new file mode 100644
index 000000000000..32d51d33f642
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-libmysql_CMakeLists.txt
@@ -0,0 +1,41 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- libmysql/CMakeLists.txt.orig 2015-10-15 15:43:37 UTC
++++ libmysql/CMakeLists.txt
+@@ -410,7 +410,7 @@ SET(LIBS clientlib dbug strings vio mysy
+
+ # Merge several convenience libraries into one big mysqlclient
+ # and link them together into shared library.
+-MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development)
++MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development NOINSTALL)
+
+ # Visual Studio users need debug static library for debug projects
+ IF(MSVC)
+@@ -418,6 +418,7 @@ IF(MSVC)
+ INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug)
+ ENDIF()
+
++IF(FALSE)
+ IF(UNIX)
+ MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME)
+ SET(DOT_VERSION ".${VERSION}")
+@@ -432,11 +433,13 @@ IF(UNIX)
+ ENDMACRO()
+ INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
+ ENDIF()
++ENDIF()
+
+ IF(NOT DISABLE_SHARED)
+ MERGE_LIBRARIES(libmysql SHARED ${LIBS}
+ EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_5_1_EXTRA} ${CLIENT_API_5_5_EXTRA}
+- COMPONENT SharedLibraries)
++ COMPONENT SharedLibraries NOINSTALL)
++IF(FALSE)
+ IF(UNIX)
+ # libtool compatability
+ IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
+@@ -484,3 +487,4 @@ IF(NOT DISABLE_SHARED)
+ ENDFOREACH()
+ ENDIF()
+ ENDIF()
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-libservices_CMakeLists.txt b/databases/mariadb101-server/files/patch-libservices_CMakeLists.txt
new file mode 100644
index 000000000000..8148d781f343
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-libservices_CMakeLists.txt
@@ -0,0 +1,11 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- libservices/CMakeLists.txt.orig 2015-10-15 15:43:37 UTC
++++ libservices/CMakeLists.txt
+@@ -34,4 +34,6 @@ SET(MYSQLSERVICES_SOURCES
+ logger_service.c)
+
+ ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
++IF(FALSE)
+ INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-man_CMakeLists.txt b/databases/mariadb101-server/files/patch-man_CMakeLists.txt
new file mode 100644
index 000000000000..df8956925052
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-man_CMakeLists.txt
@@ -0,0 +1,14 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- man/CMakeLists.txt.orig 2015-10-15 15:43:37 UTC
++++ man/CMakeLists.txt
+@@ -34,7 +34,8 @@ SET(MAN1_TEST mysql-stress-test.pl.1 mys
+
+ INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer)
+ INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)
++IF(FALSE)
+ INSTALL(FILES ${MAN1_CLIENT} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesClient)
+ INSTALL(FILES ${MAN1_DEVEL} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesDevelopment)
+ INSTALL(FILES ${MAN1_TEST} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesTest)
+-
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-mysys_my__default.c b/databases/mariadb101-server/files/patch-mysys_my__default.c
new file mode 100644
index 000000000000..cb478ffdac4c
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-mysys_my__default.c
@@ -0,0 +1,63 @@
+Obey hier(7)
+
+--- mysys/my_default.c.orig 2015-10-15 15:43:45 UTC
++++ mysys/my_default.c
+@@ -90,7 +90,7 @@ static my_bool defaults_already_read= FA
+
+ /* Which directories are searched for options (and in which order) */
+
+-#define MAX_DEFAULT_DIRS 6
++#define MAX_DEFAULT_DIRS 7
+ #define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1) /* Terminate with NULL */
+ static const char **default_directories = NULL;
+
+@@ -784,7 +784,7 @@ static int search_default_file_with_ext(
+ {
+ MY_STAT stat_info;
+ if (!my_stat(name,&stat_info,MYF(0)))
+- return 1;
++ return 0;
+ /*
+ Ignore world-writable regular files.
+ This is mainly done to protect us to not read a file created by
+@@ -802,6 +802,14 @@ static int search_default_file_with_ext(
+ if (!(fp= mysql_file_fopen(key_file_cnf, name, O_RDONLY, MYF(0))))
+ return 1; /* Ignore wrong files */
+
++ if (strstr(name, "/etc") == name)
++ {
++ fprintf(stderr,
++ "error: Config file %s in invalid location, please move to or merge with /usr/local%s\n",
++ name,name);
++ goto err;
++ }
++
+ while (mysql_file_fgets(buff, sizeof(buff) - 1, fp))
+ {
+ line++;
+@@ -1066,7 +1074,8 @@ void my_print_default_files(const char *
+ if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
+ *end++= '.';
+ strxmov(end, conf_file, *ext, " ", NullS);
+- fputs(name, stdout);
++ if (strstr(name, "/etc") != name)
++ fputs(name, stdout);
+ }
+ }
+ }
+@@ -1222,13 +1231,10 @@ static const char **init_default_directo
+
+ #else
+
+-#if defined(DEFAULT_SYSCONFDIR)
+- if (DEFAULT_SYSCONFDIR[0])
+- errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
+-#else
+ errors += add_directory(alloc, "/etc/", dirs);
+ errors += add_directory(alloc, "/etc/mysql/", dirs);
+-#endif /* DEFAULT_SYSCONFDIR */
++ errors += add_directory(alloc, "/usr/local/etc/", dirs);
++ errors += add_directory(alloc, "/usr/local/etc/mysql/", dirs);
+
+ #endif
+
diff --git a/databases/mariadb101-server/files/patch-pcre_CMakeLists.txt b/databases/mariadb101-server/files/patch-pcre_CMakeLists.txt
new file mode 100644
index 000000000000..ccc16dac9a0c
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-pcre_CMakeLists.txt
@@ -0,0 +1,13 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- pcre/CMakeLists.txt.orig 2015-10-15 15:43:45 UTC
++++ pcre/CMakeLists.txt
+@@ -513,6 +513,8 @@ IF(PCRE_SHOW_REPORT)
+ MESSAGE(STATUS "")
+ ENDIF(PCRE_SHOW_REPORT)
+
++IF(FALSE)
+ INSTALL(FILES ${CMAKE_BINARY_DIR}/pcre/pcre.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development)
++ENDIF()
+
+ # end CMakeLists.txt
diff --git a/databases/mariadb101-server/files/patch-scripts_CMakeLists.txt b/databases/mariadb101-server/files/patch-scripts_CMakeLists.txt
new file mode 100644
index 000000000000..bb7b160deb37
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-scripts_CMakeLists.txt
@@ -0,0 +1 @@
+# Intentionally empty
diff --git a/databases/mariadb101-server/files/patch-scripts_mysql__config.sh b/databases/mariadb101-server/files/patch-scripts_mysql__config.sh
new file mode 100644
index 000000000000..6ce75cd52079
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-scripts_mysql__config.sh
@@ -0,0 +1,12 @@
+--- scripts/mysql_config.sh.orig 2016-01-14 20:12:38 UTC
++++ scripts/mysql_config.sh
+@@ -106,7 +106,9 @@ fi
+
+ # Create options
+ libs="-L$pkglibdir @RPATH_OPTION@ @LIBS_FOR_CLIENTS@"
++libs="$libs -L%%LOCALBASE%%/lib "
+ embedded_libs="-L$pkglibdir @RPATH_OPTION@ @EMB_LIBS_FOR_CLIENTS@"
++embedded_libs="$embedded_libs -L%%LOCALBASE%%/lib "
+
+ include="-I$pkgincludedir"
+ if [ "$basedir" != "/usr" ]; then
diff --git a/databases/mariadb101-server/files/patch-scripts_mysqld__safe.sh b/databases/mariadb101-server/files/patch-scripts_mysqld__safe.sh
new file mode 100644
index 000000000000..789efacaeed2
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-scripts_mysqld__safe.sh
@@ -0,0 +1,26 @@
+Obey hier(7)
+
+--- scripts/mysqld_safe.sh.orig 2015-10-15 15:43:45 UTC
++++ scripts/mysqld_safe.sh
+@@ -558,10 +558,10 @@ fi
+
+ if test -z "$MYSQL_HOME"
+ then
+- if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
++ if test -r "$MY_BASEDIR_VERSION/etc/my.cnf" && test -r "$DATADIR/my.cnf"
+ then
+ log_error "WARNING: Found two instances of my.cnf -
+-$MY_BASEDIR_VERSION/my.cnf and
++$MY_BASEDIR_VERSION/etc/my.cnf and
+ $DATADIR/my.cnf
+ IGNORING $DATADIR/my.cnf"
+
+@@ -570,7 +570,7 @@ IGNORING $DATADIR/my.cnf"
+ then
+ log_error "WARNING: Found $DATADIR/my.cnf
+ The data directory is a deprecated location for my.cnf, please move it to
+-$MY_BASEDIR_VERSION/my.cnf"
++$MY_BASEDIR_VERSION/etc/my.cnf"
+ MYSQL_HOME=$DATADIR
+ else
+ MYSQL_HOME=$MY_BASEDIR_VERSION
diff --git a/databases/mariadb101-server/files/patch-sql_CMakeLists.txt b/databases/mariadb101-server/files/patch-sql_CMakeLists.txt
new file mode 100644
index 000000000000..168d4df691a6
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-sql_CMakeLists.txt
@@ -0,0 +1,30 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- sql/CMakeLists.txt.orig 2015-10-15 15:43:45 UTC
++++ sql/CMakeLists.txt
+@@ -340,6 +340,7 @@ ADD_CUSTOM_TARGET(distclean
+ VERBATIM
+ )
+
++IF(FALSE)
+ IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
+
+ # Copy db.opt into data/test/
+@@ -383,6 +384,7 @@ ELSE()
+ INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
+ ENDIF(WIN32 AND MYSQLD_EXECUTABLE)
+ ENDIF(INSTALL_LAYOUT STREQUAL "STANDALONE")
++ENDIF()
+
+ IF(WIN32)
+ SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql)
+@@ -425,7 +427,9 @@ IF(WIN32)
+ TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice)
+ ENDIF(WIN32)
+
++IF(FALSE)
+ INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN share EXCLUDE
+ PATTERN CMakeFiles EXCLUDE)
++ENDIF()
diff --git a/databases/mariadb101-server/files/patch-sql_sql__trigger.cc b/databases/mariadb101-server/files/patch-sql_sql__trigger.cc
new file mode 100644
index 000000000000..73958281577a
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-sql_sql__trigger.cc
@@ -0,0 +1,52 @@
+Fix clang build error
+
+--- sql/sql_trigger.cc.orig 2015-10-15 15:43:47 UTC
++++ sql/sql_trigger.cc
+@@ -192,32 +192,32 @@ static File_option triggers_file_paramet
+ {
+ {
+ { C_STRING_WITH_LEN("triggers") },
+- my_offsetof(class Table_triggers_list, definitions_list),
++ static_cast<int>(my_offsetof(class Table_triggers_list, definitions_list)),
+ FILE_OPTIONS_STRLIST
+ },
+ {
+ { C_STRING_WITH_LEN("sql_modes") },
+- my_offsetof(class Table_triggers_list, definition_modes_list),
++ static_cast<int>(my_offsetof(class Table_triggers_list, definition_modes_list)),
+ FILE_OPTIONS_ULLLIST
+ },
+ {
+ { C_STRING_WITH_LEN("definers") },
+- my_offsetof(class Table_triggers_list, definers_list),
++ static_cast<int>(my_offsetof(class Table_triggers_list, definers_list)),
+ FILE_OPTIONS_STRLIST
+ },
+ {
+ { C_STRING_WITH_LEN("client_cs_names") },
+- my_offsetof(class Table_triggers_list, client_cs_names),
++ static_cast<int>(my_offsetof(class Table_triggers_list, client_cs_names)),
+ FILE_OPTIONS_STRLIST
+ },
+ {
+ { C_STRING_WITH_LEN("connection_cl_names") },
+- my_offsetof(class Table_triggers_list, connection_cl_names),
++ static_cast<int>(my_offsetof(class Table_triggers_list, connection_cl_names)),
+ FILE_OPTIONS_STRLIST
+ },
+ {
+ { C_STRING_WITH_LEN("db_cl_names") },
+- my_offsetof(class Table_triggers_list, db_cl_names),
++ static_cast<int>(my_offsetof(class Table_triggers_list, db_cl_names)),
+ FILE_OPTIONS_STRLIST
+ },
+ { { 0, 0 }, 0, FILE_OPTIONS_STRING }
+@@ -226,7 +226,7 @@ static File_option triggers_file_paramet
+ File_option sql_modes_parameters=
+ {
+ { C_STRING_WITH_LEN("sql_modes") },
+- my_offsetof(class Table_triggers_list, definition_modes_list),
++ static_cast<int>(my_offsetof(class Table_triggers_list, definition_modes_list)),
+ FILE_OPTIONS_ULLLIST
+ };
+
diff --git a/databases/mariadb101-server/files/patch-sql_sql__view.cc b/databases/mariadb101-server/files/patch-sql_sql__view.cc
new file mode 100644
index 000000000000..41045967418c
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-sql_sql__view.cc
@@ -0,0 +1,65 @@
+Fix clang build error
+
+--- sql/sql_view.cc.orig 2015-10-15 15:43:47 UTC
++++ sql/sql_view.cc
+@@ -720,46 +720,46 @@ static const int required_view_parameter
+ */
+ static File_option view_parameters[]=
+ {{{ C_STRING_WITH_LEN("query")},
+- my_offsetof(TABLE_LIST, select_stmt),
++ static_cast<int>(my_offsetof(TABLE_LIST, select_stmt)),
+ FILE_OPTIONS_ESTRING},
+ {{ C_STRING_WITH_LEN("md5")},
+- my_offsetof(TABLE_LIST, md5),
++ static_cast<int>(my_offsetof(TABLE_LIST, md5)),
+ FILE_OPTIONS_STRING},
+ {{ C_STRING_WITH_LEN("updatable")},
+- my_offsetof(TABLE_LIST, updatable_view),
++ static_cast<int>(my_offsetof(TABLE_LIST, updatable_view)),
+ FILE_OPTIONS_ULONGLONG},
+ {{ C_STRING_WITH_LEN("algorithm")},
+- my_offsetof(TABLE_LIST, algorithm),
++ static_cast<int>(my_offsetof(TABLE_LIST, algorithm)),
+ FILE_OPTIONS_VIEW_ALGO},
+ {{ C_STRING_WITH_LEN("definer_user")},
+- my_offsetof(TABLE_LIST, definer.user),
++ static_cast<int>(my_offsetof(TABLE_LIST, definer.user)),
+ FILE_OPTIONS_STRING},
+ {{ C_STRING_WITH_LEN("definer_host")},
+- my_offsetof(TABLE_LIST, definer.host),
++ static_cast<int>(my_offsetof(TABLE_LIST, definer.host)),
+ FILE_OPTIONS_STRING},
+ {{ C_STRING_WITH_LEN("suid")},
+- my_offsetof(TABLE_LIST, view_suid),
++ static_cast<int>(my_offsetof(TABLE_LIST, view_suid)),
+ FILE_OPTIONS_ULONGLONG},
+ {{ C_STRING_WITH_LEN("with_check_option")},
+- my_offsetof(TABLE_LIST, with_check),
++ static_cast<int>(my_offsetof(TABLE_LIST, with_check)),
+ FILE_OPTIONS_ULONGLONG},
+ {{ C_STRING_WITH_LEN("timestamp")},
+- my_offsetof(TABLE_LIST, timestamp),
++ static_cast<int>(my_offsetof(TABLE_LIST, timestamp)),
+ FILE_OPTIONS_TIMESTAMP},
+ {{ C_STRING_WITH_LEN("create-version")},
+- my_offsetof(TABLE_LIST, file_version),
++ static_cast<int>(my_offsetof(TABLE_LIST, file_version)),
+ FILE_OPTIONS_ULONGLONG},
+ {{ C_STRING_WITH_LEN("source")},
+- my_offsetof(TABLE_LIST, source),
++ static_cast<int>(my_offsetof(TABLE_LIST, source)),
+ FILE_OPTIONS_ESTRING},
+ {{(char*) STRING_WITH_LEN("client_cs_name")},
+- my_offsetof(TABLE_LIST, view_client_cs_name),
++ static_cast<int>(my_offsetof(TABLE_LIST, view_client_cs_name)),
+ FILE_OPTIONS_STRING},
+ {{(char*) STRING_WITH_LEN("connection_cl_name")},
+- my_offsetof(TABLE_LIST, view_connection_cl_name),
++ static_cast<int>(my_offsetof(TABLE_LIST, view_connection_cl_name)),
+ FILE_OPTIONS_STRING},
+ {{(char*) STRING_WITH_LEN("view_body_utf8")},
+- my_offsetof(TABLE_LIST, view_body_utf8),
++ static_cast<int>(my_offsetof(TABLE_LIST, view_body_utf8)),
+ FILE_OPTIONS_ESTRING},
+ {{ C_STRING_WITH_LEN("mariadb-version")},
+ my_offsetof(TABLE_LIST, mariadb_version),
diff --git a/databases/mariadb101-server/files/patch-sql_sys__vars.cc b/databases/mariadb101-server/files/patch-sql_sys__vars.cc
new file mode 100644
index 000000000000..4f99a9c96e83
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-sql_sys__vars.cc
@@ -0,0 +1,40 @@
+Fix clang build error
+
+--- sql/sys_vars.cc.orig 2015-10-15 15:43:47 UTC
++++ sql/sys_vars.cc
+@@ -1040,7 +1040,7 @@ static Sys_var_ulong Sys_interactive_tim
+ "connection before closing it",
+ NO_SET_STMT SESSION_VAR(net_interactive_timeout),
+ CMD_LINE(REQUIRED_ARG),
+- VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
++ VALID_RANGE(1, INT_MAX32/1000), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
+
+ static Sys_var_ulonglong Sys_join_buffer_size(
+ "join_buffer_size",
+@@ -2214,7 +2214,7 @@ static Sys_var_ulong Sys_net_read_timeou
+ "Number of seconds to wait for more data from a connection before "
+ "aborting the read",
+ SESSION_VAR(net_read_timeout), CMD_LINE(REQUIRED_ARG),
+- VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_READ_TIMEOUT), BLOCK_SIZE(1),
++ VALID_RANGE(1, INT_MAX32/1000), DEFAULT(NET_READ_TIMEOUT), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(fix_net_read_timeout));
+
+@@ -2229,7 +2229,7 @@ static Sys_var_ulong Sys_net_write_timeo
+ "Number of seconds to wait for a block to be written to a connection "
+ "before aborting the write",
+ SESSION_VAR(net_write_timeout), CMD_LINE(REQUIRED_ARG),
+- VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WRITE_TIMEOUT), BLOCK_SIZE(1),
++ VALID_RANGE(1, INT_MAX32/1000), DEFAULT(NET_WRITE_TIMEOUT), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(fix_net_write_timeout));
+
+@@ -3424,7 +3424,7 @@ static Sys_var_ulong Sys_net_wait_timeou
+ "The number of seconds the server waits for activity on a "
+ "connection before closing it",
+ NO_SET_STMT SESSION_VAR(net_wait_timeout), CMD_LINE(REQUIRED_ARG),
+- VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
++ VALID_RANGE(1, INT_MAX32/1000),
+ DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
+
+ static Sys_var_plugin Sys_default_storage_engine(
diff --git a/databases/mariadb101-server/files/patch-storage_connect_json.cpp b/databases/mariadb101-server/files/patch-storage_connect_json.cpp
new file mode 100644
index 000000000000..bb7b160deb37
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-storage_connect_json.cpp
@@ -0,0 +1 @@
+# Intentionally empty
diff --git a/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_cmake__modules_TokuFeatureDetection.cmake b/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_cmake__modules_TokuFeatureDetection.cmake
new file mode 100644
index 000000000000..96a52556c11b
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_cmake__modules_TokuFeatureDetection.cmake
@@ -0,0 +1,19 @@
+Fix failing backtrace detection
+
+--- storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake.orig 2015-10-15 15:43:51 UTC
++++ storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake
+@@ -87,13 +87,7 @@ if (NOT HAVE_DLSYM_WITHOUT_DL)
+ endif ()
+ check_function_exists(backtrace HAVE_BACKTRACE_WITHOUT_EXECINFO)
+ if (NOT HAVE_BACKTRACE_WITHOUT_EXECINFO)
+- set(CMAKE_REQUIRED_LIBRARIES execinfo)
+- check_function_exists(backtrace HAVE_BACKTRACE_WITH_EXECINFO)
+- if (HAVE_BACKTRACE_WITH_EXECINFO)
+- list(APPEND EXTRA_SYSTEM_LIBS execinfo)
+- else ()
+- message(FATAL_ERROR "Cannot find backtrace(), even with -lexecinfo.")
+- endif ()
++ list(APPEND EXTRA_SYSTEM_LIBS execinfo)
+ endif ()
+
+ if(HAVE_CLOCK_REALTIME)
diff --git a/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_portability_memory.cc b/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_portability_memory.cc
new file mode 100644
index 000000000000..505eaa61928c
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-storage_tokudb_PerconaFT_portability_memory.cc
@@ -0,0 +1,16 @@
+Fix build error
+
+--- storage/tokudb/PerconaFT/portability/memory.cc.orig 2015-10-15 15:43:52 UTC
++++ storage/tokudb/PerconaFT/portability/memory.cc
+@@ -94,11 +94,6 @@ PATENT RIGHTS GRANT:
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#if defined(HAVE_MALLOC_H)
+-# include <malloc.h>
+-#elif defined(HAVE_SYS_MALLOC_H)
+-# include <sys/malloc.h>
+-#endif
+ #include <dlfcn.h>
+ #include <toku_race_tools.h>
+ #include "memory.h"
diff --git a/databases/mariadb101-server/files/patch-support-files_CMakeLists.txt b/databases/mariadb101-server/files/patch-support-files_CMakeLists.txt
new file mode 100644
index 000000000000..95efe8825ede
--- /dev/null
+++ b/databases/mariadb101-server/files/patch-support-files_CMakeLists.txt
@@ -0,0 +1,14 @@
+Fix up missing WITHOUT_DOCS, WITHOUT_CLIENT options
+
+--- support-files/CMakeLists.txt.orig 2015-10-15 15:44:15 UTC
++++ support-files/CMakeLists.txt
+@@ -64,7 +64,9 @@ IF(UNIX)
+ CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_SHAREDIR}/pkgconfig COMPONENT Development)
+
++IF(FALSE)
+ INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
++ENDIF()
+
+ SET(bindir ${prefix}/${INSTALL_BINDIR})
+ SET(sbindir ${prefix}/${INSTALL_SBINDIR})
diff --git a/databases/mariadb101-server/files/pkg-message.in b/databases/mariadb101-server/files/pkg-message.in
new file mode 100644
index 000000000000..b49d42074149
--- /dev/null
+++ b/databases/mariadb101-server/files/pkg-message.in
@@ -0,0 +1,15 @@
+************************************************************************
+
+Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
+the first time you start the MySQL server after an upgrade from an
+earlier version.
+
+MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
+my.cnf. Please move existing my.cnf files from those paths to
+%%PREFIX%%/etc and %%PREFIX%%/etc/mysql.
+
+This port does NOT include the mytop perl script, this is included in
+the MariaDB tarball but the most recent version can be found in the
+databases/mytop port
+
+************************************************************************
diff --git a/databases/mariadb101-server/pkg-descr b/databases/mariadb101-server/pkg-descr
new file mode 100644
index 000000000000..31c3ca1ce897
--- /dev/null
+++ b/databases/mariadb101-server/pkg-descr
@@ -0,0 +1,14 @@
+MariaDB is a database server that offers drop-in replacement functionality
+for MySQL. MariaDB is built by some of the original authors of MySQL, with
+assistance from the broader community of Free and open source software
+developers. In addition to the core functionality of MySQL, MariaDB offers
+a rich set of feature enhancements including alternate storage engines,
+server optimizations, and patches.
+
+MariaDB is primarily driven by developers at Monty Program, a company
+founded by Michael "Monty" Widenius, the original author of MySQL, but
+this is not the whole story about MariaDB. On the "About MariaDB" page you
+will find more information about all participants in the MariaDB community,
+including storage engines XtraDB and PBXT.
+
+WWW: http://mariadb.org/
diff --git a/databases/mariadb101-server/pkg-plist b/databases/mariadb101-server/pkg-plist
new file mode 100644
index 000000000000..d2942bc497d5
--- /dev/null
+++ b/databases/mariadb101-server/pkg-plist
@@ -0,0 +1,190 @@
+bin/aria_chk
+bin/aria_dump_log
+bin/aria_ftdump
+bin/aria_pack
+bin/aria_read_log
+bin/innochecksum
+bin/my_print_defaults
+bin/myisam_ftdump
+bin/myisamchk
+bin/myisamlog
+bin/myisampack
+bin/mysql_client_test
+bin/mysql_client_test_embedded
+bin/mysql_convert_table_format
+bin/mysql_embedded
+bin/mysql_fix_extensions
+bin/mysql_install_db
+bin/mysql_plugin
+bin/mysql_secure_installation
+bin/mysql_setpermission
+bin/mysql_tzinfo_to_sql
+bin/mysql_upgrade
+bin/mysql_zap
+bin/mysqlbug
+bin/mysqld_multi
+bin/mysqld_safe
+bin/mysqldumpslow
+bin/mysqlhotcopy
+bin/mysqltest
+bin/mysqltest_embedded
+@comment bin/mytop
+bin/perror
+bin/replace
+bin/resolve_stack_dump
+bin/resolveip
+bin/wsrep_sst_common
+bin/wsrep_sst_mysqldump
+bin/wsrep_sst_rsync
+bin/wsrep_sst_xtrabackup
+bin/wsrep_sst_xtrabackup-v2
+include/mysql/private/embedded_priv.h
+lib/mysql/libmysqld.a
+lib/mysql/libmysqld.so
+lib/mysql/libmysqld.so.18
+lib/mysql/plugin/adt_null.so
+lib/mysql/plugin/auth_0x0100.so
+lib/mysql/plugin/auth_gssapi.so
+lib/mysql/plugin/auth_gssapi_client.so
+lib/mysql/plugin/auth_pam.so
+lib/mysql/plugin/auth_socket.so
+lib/mysql/plugin/auth_test_plugin.so
+lib/mysql/plugin/daemon_example.ini
+lib/mysql/plugin/debug_key_management.so
+lib/mysql/plugin/dialog.so
+lib/mysql/plugin/dialog_examples.so
+lib/mysql/plugin/example_key_management.so
+lib/mysql/plugin/file_key_management.so
+lib/mysql/plugin/ha_archive.so
+lib/mysql/plugin/ha_blackhole.so
+lib/mysql/plugin/ha_connect.so
+lib/mysql/plugin/ha_federated.so
+lib/mysql/plugin/ha_federatedx.so
+%%INNOBASE%%lib/mysql/plugin/ha_innodb.so
+%%MROONGA%%lib/mysql/plugin/ha_mroonga.so
+%%OQGRAPH%%lib/mysql/plugin/ha_oqgraph.so
+%%SPHINX%%lib/mysql/plugin/ha_sphinx.so
+%%SPIDER%%lib/mysql/plugin/ha_spider.so
+%%TOKUDB%%lib/mysql/plugin/ha_tokudb.so
+lib/mysql/plugin/ha_test_sql_discovery.so
+lib/mysql/plugin/handlersocket.so
+lib/mysql/plugin/libdaemon_example.so
+lib/mysql/plugin/locales.so
+lib/mysql/plugin/metadata_lock_info.so
+lib/mysql/plugin/mypluglib.so
+lib/mysql/plugin/mysql_clear_password.so
+lib/mysql/plugin/qa_auth_client.so
+lib/mysql/plugin/qa_auth_interface.so
+lib/mysql/plugin/qa_auth_server.so
+lib/mysql/plugin/query_cache_info.so
+lib/mysql/plugin/query_response_time.so
+lib/mysql/plugin/semisync_master.so
+lib/mysql/plugin/semisync_slave.so
+lib/mysql/plugin/server_audit.so
+lib/mysql/plugin/simple_password_check.so
+lib/mysql/plugin/sql_errlog.so
+lib/mysql/plugin/wsrep_info.so
+libexec/mysqld
+man/man1/aria_chk.1.gz
+man/man1/aria_dump_log.1.gz
+man/man1/aria_ftdump.1.gz
+man/man1/aria_pack.1.gz
+man/man1/aria_read_log.1.gz
+man/man1/innochecksum.1.gz
+man/man1/my_print_defaults.1.gz
+man/man1/myisam_ftdump.1.gz
+man/man1/myisamchk.1.gz
+man/man1/myisamlog.1.gz
+man/man1/myisampack.1.gz
+man/man1/mysql.server.1.gz
+man/man1/mysql_convert_table_format.1.gz
+man/man1/mysql_fix_extensions.1.gz
+man/man1/mysql_install_db.1.gz
+man/man1/mysql_secure_installation.1.gz
+man/man1/mysql_setpermission.1.gz
+man/man1/mysql_tzinfo_to_sql.1.gz
+man/man1/mysql_upgrade.1.gz
+man/man1/mysql_zap.1.gz
+man/man1/mysqlbug.1.gz
+man/man1/mysqld_multi.1.gz
+man/man1/mysqld_safe.1.gz
+man/man1/mysqldumpslow.1.gz
+man/man1/mysqlhotcopy.1.gz
+man/man1/mysqltest.1.gz
+man/man1/perror.1.gz
+man/man1/replace.1.gz
+man/man1/resolve_stack_dump.1.gz
+man/man1/resolveip.1.gz
+man/man8/mysqld.8.gz
+%%DATADIR%%/binary-configure
+%%DATADIR%%/charsets/Index.xml
+%%DATADIR%%/charsets/README
+%%DATADIR%%/charsets/armscii8.xml
+%%DATADIR%%/charsets/ascii.xml
+%%DATADIR%%/charsets/cp1250.xml
+%%DATADIR%%/charsets/cp1251.xml
+%%DATADIR%%/charsets/cp1256.xml
+%%DATADIR%%/charsets/cp1257.xml
+%%DATADIR%%/charsets/cp850.xml
+%%DATADIR%%/charsets/cp852.xml
+%%DATADIR%%/charsets/cp866.xml
+%%DATADIR%%/charsets/dec8.xml
+%%DATADIR%%/charsets/geostd8.xml
+%%DATADIR%%/charsets/greek.xml
+%%DATADIR%%/charsets/hebrew.xml
+%%DATADIR%%/charsets/hp8.xml
+%%DATADIR%%/charsets/keybcs2.xml
+%%DATADIR%%/charsets/koi8r.xml
+%%DATADIR%%/charsets/koi8u.xml
+%%DATADIR%%/charsets/latin1.xml
+%%DATADIR%%/charsets/latin2.xml
+%%DATADIR%%/charsets/latin5.xml
+%%DATADIR%%/charsets/latin7.xml
+%%DATADIR%%/charsets/macce.xml
+%%DATADIR%%/charsets/macroman.xml
+%%DATADIR%%/charsets/swe7.xml
+%%DATADIR%%/czech/errmsg.sys
+%%DATADIR%%/danish/errmsg.sys
+%%DATADIR%%/dutch/errmsg.sys
+%%DATADIR%%/english/errmsg.sys
+%%DATADIR%%/errmsg-utf8.txt
+%%DATADIR%%/estonian/errmsg.sys
+%%DATADIR%%/fill_help_tables.sql
+%%DATADIR%%/french/errmsg.sys
+%%DATADIR%%/german/errmsg.sys
+%%DATADIR%%/greek/errmsg.sys
+%%DATADIR%%/hungarian/errmsg.sys
+%%DATADIR%%/install_spider.sql
+%%DATADIR%%/italian/errmsg.sys
+%%DATADIR%%/japanese/errmsg.sys
+%%DATADIR%%/korean/errmsg.sys
+%%DATADIR%%/magic
+%%DATADIR%%/maria_add_gis_sp.sql
+%%DATADIR%%/maria_add_gis_sp_bootstrap.sql
+%%MROONGA%%%%DATADIR%%/mroonga/install.sql
+%%MROONGA%%%%DATADIR%%/mroonga/uninstall.sql
+%%DATADIR%%/my-huge.cnf
+%%DATADIR%%/my-innodb-heavy-4G.cnf
+%%DATADIR%%/my-large.cnf
+%%DATADIR%%/my-medium.cnf
+%%DATADIR%%/my-small.cnf
+%%DATADIR%%/mysql-log-rotate
+%%DATADIR%%/mysql.server
+%%DATADIR%%/mysql_performance_tables.sql
+%%DATADIR%%/mysql_system_tables.sql
+%%DATADIR%%/mysql_system_tables_data.sql
+%%DATADIR%%/mysql_test_data_timezone.sql
+%%DATADIR%%/mysqld_multi.server
+%%DATADIR%%/norwegian-ny/errmsg.sys
+%%DATADIR%%/norwegian/errmsg.sys
+%%DATADIR%%/polish/errmsg.sys
+%%DATADIR%%/portuguese/errmsg.sys
+%%DATADIR%%/romanian/errmsg.sys
+%%DATADIR%%/russian/errmsg.sys
+%%DATADIR%%/serbian/errmsg.sys
+%%DATADIR%%/slovak/errmsg.sys
+%%DATADIR%%/spanish/errmsg.sys
+%%DATADIR%%/swedish/errmsg.sys
+%%DATADIR%%/ukrainian/errmsg.sys
+%%DATADIR%%/wsrep.cnf
+%%DATADIR%%/wsrep_notify