summaryrefslogtreecommitdiff
path: root/databases
diff options
context:
space:
mode:
Diffstat (limited to 'databases')
-rw-r--r--databases/mariadb55-client/DESCR4
-rw-r--r--databases/mariadb55-client/MESSAGE9
-rw-r--r--databases/mariadb55-client/Makefile42
-rw-r--r--databases/mariadb55-client/Makefile.common135
-rw-r--r--databases/mariadb55-client/PLIST205
-rw-r--r--databases/mariadb55-client/buildlink3.mk18
-rw-r--r--databases/mariadb55-client/distinfo53
-rw-r--r--databases/mariadb55-client/options.mk38
-rw-r--r--databases/mariadb55-client/patches/patch-BUILD_compile-pentium-gcov15
-rw-r--r--databases/mariadb55-client/patches/patch-CMakeLists.txt56
-rw-r--r--databases/mariadb55-client/patches/patch-client_completion_hash.cc17
-rw-r--r--databases/mariadb55-client/patches/patch-client_mysql.cc13
-rw-r--r--databases/mariadb55-client/patches/patch-client_mysqladmin.cc35
-rw-r--r--databases/mariadb55-client/patches/patch-client_mysqlbinlog.cc16
-rw-r--r--databases/mariadb55-client/patches/patch-client_mysqlshow.c16
-rw-r--r--databases/mariadb55-client/patches/patch-cmake_libutils.cmake15
-rw-r--r--databases/mariadb55-client/patches/patch-cmake_plugin.cmake56
-rw-r--r--databases/mariadb55-client/patches/patch-cmake_readline.cmake72
-rw-r--r--databases/mariadb55-client/patches/patch-include_CMakeLists.txt20
-rw-r--r--databases/mariadb55-client/patches/patch-include_my_compare.h15
-rw-r--r--databases/mariadb55-client/patches/patch-include_my_net.h22
-rw-r--r--databases/mariadb55-client/patches/patch-include_my_pthread.h13
-rw-r--r--databases/mariadb55-client/patches/patch-include_myisam.h15
-rw-r--r--databases/mariadb55-client/patches/patch-include_violite.h32
-rw-r--r--databases/mariadb55-client/patches/patch-libmysql_CMakeLists.txt23
-rw-r--r--databases/mariadb55-client/patches/patch-mysys_my__getopt.c16
-rw-r--r--databases/mariadb55-client/patches/patch-mysys_stacktrace.c13
-rw-r--r--databases/mariadb55-client/patches/patch-scripts_CMakeLists.txt29
-rw-r--r--databases/mariadb55-client/patches/patch-scripts_mysqld_safe.sh13
-rw-r--r--databases/mariadb55-client/patches/patch-sql-common_client__plugin.c41
-rw-r--r--databases/mariadb55-client/patches/patch-sql_CMakeLists.txt15
-rw-r--r--databases/mariadb55-client/patches/patch-sql_log_event.h17
-rw-r--r--databases/mariadb55-client/patches/patch-sql_mysqld.cc22
-rw-r--r--databases/mariadb55-client/patches/patch-sql_sql_string.h17
-rw-r--r--databases/mariadb55-client/patches/patch-storage_archive_CMakeLists.txt14
-rw-r--r--databases/mariadb55-client/patches/patch-storage_blackhole_CMakeLists.txt13
-rw-r--r--databases/mariadb55-client/patches/patch-storage_csv_CMakeLists.txt13
-rw-r--r--databases/mariadb55-client/patches/patch-storage_example_CMakeLists.txt12
-rw-r--r--databases/mariadb55-client/patches/patch-storage_federated_CMakeLists.txt13
-rw-r--r--databases/mariadb55-client/patches/patch-storage_heap_CMakeLists.txt16
-rw-r--r--databases/mariadb55-client/patches/patch-storage_innobase_include_os0sync.h22
-rw-r--r--databases/mariadb55-client/patches/patch-storage_myisam_CMakeLists.txt16
-rw-r--r--databases/mariadb55-client/patches/patch-storage_myisammrg_CMakeLists.txt13
-rw-r--r--databases/mariadb55-client/patches/patch-storage_ndb_include_util_Parser.hpp22
-rw-r--r--databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_portability.cc23
-rw-r--r--databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__portability.h31
-rw-r--r--databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.cc23
-rw-r--r--databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.h13
-rw-r--r--databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_src_ydb-internal.h12
-rw-r--r--databases/mariadb55-client/patches/patch-strings_decimal.c16
-rw-r--r--databases/mariadb55-client/patches/patch-strtoll.c163
-rw-r--r--databases/mariadb55-client/patches/patch-strtoull.c136
-rw-r--r--databases/mariadb55-client/patches/patch-vio_viosocket.c55
53 files changed, 1764 insertions, 0 deletions
diff --git a/databases/mariadb55-client/DESCR b/databases/mariadb55-client/DESCR
new file mode 100644
index 00000000000..1bcbb507f39
--- /dev/null
+++ b/databases/mariadb55-client/DESCR
@@ -0,0 +1,4 @@
+MariaDB is a fork of MySQL relational database management system.
+It is an enhanced, drop-in replacement for MySQL.
+
+This package contains client libraries.
diff --git a/databases/mariadb55-client/MESSAGE b/databases/mariadb55-client/MESSAGE
new file mode 100644
index 00000000000..f916a953c54
--- /dev/null
+++ b/databases/mariadb55-client/MESSAGE
@@ -0,0 +1,9 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+To use the ``mysqlhotcopy'' script, you'll have to install the following
+package:
+
+ databases/p5-DBD-mysql
+
+===========================================================================
diff --git a/databases/mariadb55-client/Makefile b/databases/mariadb55-client/Makefile
new file mode 100644
index 00000000000..a78fc075c80
--- /dev/null
+++ b/databases/mariadb55-client/Makefile
@@ -0,0 +1,42 @@
+# $NetBSD: Makefile,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+PKGNAME= ${DISTNAME:S/-/-client-/}
+COMMENT= MarisDB 5.5, a free SQL database (client)
+
+CONFLICTS= mysql3-client-[0-9]*
+CONFLICTS= mysql-client-[0-9]*
+
+.include "Makefile.common"
+
+CMAKE_ARGS+= -DWITHOUT_SERVER=ON
+CMAKE_ARGS+= -DWITH_UNIT_TESTS=OFF
+UNWRAP_FILES+= scripts/mysql_config
+INFO_FILES= yes
+INSTALL_DIRS+= client include libmysql man scripts tests
+
+REPLACE_PERL+= scripts/mysql_convert_table_format.sh
+REPLACE_PERL+= scripts/mysql_find_rows.sh
+REPLACE_PERL+= scripts/mysql_fix_extensions.sh
+REPLACE_PERL+= scripts/mysql_fix_privilege_tables.sh
+REPLACE_PERL+= scripts/mysql_setpermission.sh
+REPLACE_PERL+= scripts/mysql_zap.sh
+REPLACE_PERL+= scripts/mysqlaccess.sh
+REPLACE_PERL+= scripts/mysqld_multi.sh
+REPLACE_PERL+= scripts/mysqldumpslow.sh
+REPLACE_PERL+= scripts/mysqlhotcopy.sh
+REPLACE_PERL+= scripts/mytop.sh
+
+SUBST_CLASSES+= fixwrap
+SUBST_STAGE.fixwrap= post-build
+SUBST_FILES.fixwrap= scripts/mysqlbug
+SUBST_SED.fixwrap= -e "s,${WRAPPER_BINDIR}/,,g"
+
+# Replace manual pages which only include other ones with a symbolic link.
+# It is for manual compression is activated or mandoc(1) is used.
+post-install:
+.for mf in mysql_client_test_embedded.1 mysqltest_embedded.1
+ ${RM} -f ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/${mf}
+ ${LN} -s ${mf:S/_embedded//} ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/${mf}
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/databases/mariadb55-client/Makefile.common b/databases/mariadb55-client/Makefile.common
new file mode 100644
index 00000000000..d168f5ff4bc
--- /dev/null
+++ b/databases/mariadb55-client/Makefile.common
@@ -0,0 +1,135 @@
+# $NetBSD: Makefile.common,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+#
+# used by databases/mariadb55-client/Makefile
+# used by databases/mariadb55-server/Makefile
+
+DISTNAME= mariadb-5.5.42
+CATEGORIES= databases
+MASTER_SITES= https://downloads.mariadb.org/f/mariadb-5.5.42/source/
+
+MAINTAINER?= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://www.mariadb.org/
+LICENSE= gnu-gpl-v2
+
+DISTINFO_FILE?= ${.CURDIR}/../../databases/mariadb55-client/distinfo
+PATCHDIR?= ${.CURDIR}/../../databases/mariadb55-client/patches
+
+USE_CMAKE= yes
+USE_LANGUAGES= c c++
+USE_TOOLS+= bash gmake perl:run
+
+CXXFLAGS+= -fpermissive
+
+.include "../../mk/bsd.prefs.mk"
+
+.include "options.mk"
+
+# MYSQL_USER username of the database administrator
+# MYSQL_GROUP group of the database administrator
+# MYSQL_DATADIR home directory (location of the databases)
+# MYSQL_PIDFILE process ID file
+# MYSQL_CHARSET default character set
+# MYSQL_EXTRA_CHARSET additional character set to be compiled in
+MYSQL_USER?= mariadb
+MYSQL_GROUP?= mariadb
+MYSQL_DATADIR?= ${VARBASE}/mariadb
+MYSQL_PIDFILE?= ${MYSQL_DATADIR}/${HOST}.pid
+MYSQL_CHARSET?= latin1
+MYSQL_COLLATION?= latin1_swedish_ci
+MYSQL_EXTRA_CHARSET?= all
+
+PKG_USERS_VARS+= MYSQL_USER
+PKG_GROUPS_VARS+= MYSQL_GROUP
+
+CONFIG_SHELL= ${TOOLS_PATH.bash}
+
+.if ${OPSYS} == "IRIX"
+CFLAGS+= -DIRIX5 -DNEEDS_BSTRING_H
+.endif
+
+BUILD_DEFS+= VARBASE
+
+# paths
+CMAKE_ARGS+= -DINSTALL_DOCDIR="share/doc/mariadb"
+CMAKE_ARGS+= -DINSTALL_DOCREADMEDIR="share/doc/mariadb"
+CMAKE_ARGS+= -DINSTALL_INCLUDEDIR="include/mysql"
+CMAKE_ARGS+= -DINSTALL_INFODIR="info"
+CMAKE_ARGS+= -DINSTALL_MANDIR="${PKGMANDIR}"
+CMAKE_ARGS+= -DINSTALL_MYSQLSHAREDIR="share/mariadb"
+CMAKE_ARGS+= -DINSTALL_MYSQLTESTDIR="share/mariadb/test"
+CMAKE_ARGS+= -DINSTALL_PLUGINDIR="lib/mysql/plugin"
+CMAKE_ARGS+= -DINSTALL_SBINDIR="sbin"
+CMAKE_ARGS+= -DINSTALL_SCRIPTDIR="bin"
+CMAKE_ARGS+= -DINSTALL_SQLBENCHDIR="share/mariadb/sql-bench"
+CMAKE_ARGS+= -DINSTALL_SUPPORTFILESDIR="share/mariadb"
+CMAKE_ARGS+= -DMYSQL_DATADIR=${MYSQL_DATADIR}
+
+# always use our own readline, not MySQL bundled one
+CMAKE_ARGS+= -DWITH_LIBEDIT=OFF
+CMAKE_ARGS+= -DWITH_READLINE=OFF
+CMAKE_ARGS+= -DDEFAULT_CHARSET=${MYSQL_CHARSET:Q}
+CMAKE_ARGS+= -DDEFAULT_COLLATION=${MYSQL_COLLATION:Q}
+CMAKE_ARGS+= -DWITH_EXTRA_CHARSETS=${MYSQL_EXTRA_CHARSET:Q}
+BROKEN_READLINE_DETECTION= yes # At least on RHEL 5.6
+
+# MySQL 5 depends on builtin functions enabled with i486 and later with GCC.
+.if ${OPSYS} == "NetBSD" && !empty(MACHINE_ARCH:Mi386)
+GNU_ARCH.i386= i486
+CFLAGS+= -march=i486
+.endif
+
+# Ensure the correct DTrace ABI is used.
+.if !empty(ABI)
+CMAKE_ARGS+= -DDTRACE_FLAGS="-${ABI}"
+.endif
+
+CPPFLAGS+= -Dunix
+CFLAGS+= -DUSE_OLD_FUNCTIONS # 3.23.x compat
+
+.if ${OPSYS} != "Interix"
+CFLAGS+= -fPIC -DPIC
+CXXFLAGS+= -fPIC -DPIC
+.endif
+
+# force HAVE_CURSES_H on Solaris since the configure script is broken
+# and does not properly detect this, breaking the build later on.
+.if ${OPSYS} == "SunOS"
+CFLAGS+= -DHAVE_CURSES_H
+CXXFLAGS+= -DHAVE_CURSES_H
+.endif
+
+# SCO OpenServer 5.0.7/3.2's readdir_r has 2 arguments and return struct dirent.
+.if ${OS_VARIANT} == "SCOOSR5"
+CMAKE_ARGS+= -DHAVE_READDIR_R=OFF
+.endif
+
+.include "../../mk/pthread.buildlink3.mk"
+
+.if (defined(PTHREAD_TYPE) && (${PTHREAD_TYPE} == "pth")) || \
+ ${OS_VARIANT} == "SCOOSR5"
+CFLAGS+= -DSIGNALS_DONT_BREAK_READ
+CXXFLAGS+= -DSIGNALS_DONT_BREAK_READ
+.endif
+
+LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/mariadb
+
+SUBST_CLASSES+= scr
+SUBST_STAGE.scr= pre-configure
+SUBST_FILES.scr= scripts/mariadb_install_db.sh scripts/mariadb_safe.sh \
+ scripts/mariadb_secure_installation.sh \
+ support-files/mariadb.server.sh
+SUBST_SED.scr= -e "s,chown,${CHOWN},g"
+SUBST_SED.scr+= -e "s,/bin/sh,${RCD_SCRIPTS_SHELL},g"
+SUBST_MESSAGE.scr= Fixing scripts.
+
+.include "../../mk/readline.buildlink3.mk"
+.if !empty(READLINE_TYPE:Mreadline)
+CMAKE_ARGS+= -DREADLINE_FOUND=system
+LDFLAGS+= -lreadline
+.else
+CMAKE_ARGS+= -DLIBEDIT_FOUND=system
+LDFLAGS+= -ledit
+.endif
+CMAKE_ARGS+= -DREADLINE_INCLUDE_DIR=${BUILDLINK_PREFIX.editlinereadline}/include/readline
+
+.include "../../devel/zlib/buildlink3.mk"
diff --git a/databases/mariadb55-client/PLIST b/databases/mariadb55-client/PLIST
new file mode 100644
index 00000000000..88a4b3d9d20
--- /dev/null
+++ b/databases/mariadb55-client/PLIST
@@ -0,0 +1,205 @@
+@comment $NetBSD: PLIST,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+bin/msql2mysql
+bin/mysql
+bin/mysql_client_test
+bin/mysql_config
+bin/mysql_convert_table_format
+bin/mysql_find_rows
+bin/mysql_fix_extensions
+bin/mysql_install_db
+bin/mysql_plugin
+bin/mysql_secure_installation
+bin/mysql_setpermission
+bin/mysql_upgrade
+bin/mysql_zap
+bin/mysqlaccess
+bin/mysqladmin
+bin/mysqlbinlog
+bin/mysqlbug
+bin/mysqlcheck
+bin/mysqld_multi
+bin/mysqld_safe
+bin/mysqldump
+bin/mysqldumpslow
+bin/mysqlhotcopy
+bin/mysqlimport
+bin/mysqlshow
+bin/mysqlslap
+bin/mysqltest
+bin/mytop
+include/mysql/auth_dialog_client.h
+include/mysql/client_plugin.h
+include/mysql/decimal.h
+include/mysql/errmsg.h
+include/mysql/handler_ername.h
+include/mysql/handler_state.h
+include/mysql/keycache.h
+include/mysql/m_ctype.h
+include/mysql/m_string.h
+include/mysql/ma_dyncol.h
+include/mysql/my_alloc.h
+include/mysql/my_attribute.h
+include/mysql/my_compiler.h
+include/mysql/my_config.h
+include/mysql/my_dbug.h
+include/mysql/my_decimal_limits.h
+include/mysql/my_dir.h
+include/mysql/my_getopt.h
+include/mysql/my_global.h
+include/mysql/my_list.h
+include/mysql/my_net.h
+include/mysql/my_pthread.h
+include/mysql/my_sys.h
+include/mysql/my_valgrind.h
+include/mysql/my_xml.h
+include/mysql/mysql.h
+include/mysql/mysql_com.h
+include/mysql/mysql_embed.h
+include/mysql/mysql_time.h
+include/mysql/mysql_version.h
+include/mysql/mysqld_ername.h
+include/mysql/mysqld_error.h
+include/mysql/plugin.h
+include/mysql/plugin_audit.h
+include/mysql/plugin_auth.h
+include/mysql/plugin_auth_common.h
+include/mysql/plugin_ftparser.h
+include/mysql/private/atomic/gcc_builtins.h
+include/mysql/private/atomic/generic-msvc.h
+include/mysql/private/atomic/nolock.h
+include/mysql/private/atomic/rwlock.h
+include/mysql/private/atomic/solaris.h
+include/mysql/private/atomic/x86-gcc.h
+include/mysql/private/base64.h
+include/mysql/private/config.h
+include/mysql/private/ft_global.h
+include/mysql/private/hash.h
+include/mysql/private/heap.h
+include/mysql/private/lf.h
+include/mysql/private/maria.h
+include/mysql/private/my_aes.h
+include/mysql/private/my_alarm.h
+include/mysql/private/my_atomic.h
+include/mysql/private/my_base.h
+include/mysql/private/my_bit.h
+include/mysql/private/my_bitmap.h
+include/mysql/private/my_check_opt.h
+include/mysql/private/my_compare.h
+include/mysql/private/my_context.h
+include/mysql/private/my_cpu.h
+include/mysql/private/my_libwrap.h
+include/mysql/private/my_md5.h
+include/mysql/private/my_nosys.h
+include/mysql/private/my_rdtsc.h
+include/mysql/private/my_stacktrace.h
+include/mysql/private/my_time.h
+include/mysql/private/my_tree.h
+include/mysql/private/my_uctype.h
+include/mysql/private/my_user.h
+include/mysql/private/myisam.h
+include/mysql/private/myisamchk.h
+include/mysql/private/myisammrg.h
+include/mysql/private/myisampack.h
+include/mysql/private/mysql_async.h
+include/mysql/private/mysqld_default_groups.h
+include/mysql/private/mysys_err.h
+include/mysql/private/password.h
+include/mysql/private/probes_mysql.h
+include/mysql/private/probes_mysql_dtrace.h
+include/mysql/private/probes_mysql_nodtrace.h
+include/mysql/private/queues.h
+include/mysql/private/rijndael.h
+include/mysql/private/service_versions.h
+include/mysql/private/sha1.h
+include/mysql/private/sha2.h
+include/mysql/private/t_ctype.h
+include/mysql/private/thr_alarm.h
+include/mysql/private/thr_lock.h
+include/mysql/private/thread_pool_priv.h
+include/mysql/private/violite.h
+include/mysql/private/waiting_threads.h
+include/mysql/private/welcome_copyright_notice.h
+include/mysql/private/wqueue.h
+include/mysql/psi/mysql_file.h
+include/mysql/psi/mysql_thread.h
+include/mysql/psi/psi.h
+include/mysql/psi/psi_abi_v1.h
+include/mysql/psi/psi_abi_v2.h
+include/mysql/service_debug_sync.h
+include/mysql/service_kill_statement.h
+include/mysql/service_logger.h
+include/mysql/service_my_snprintf.h
+include/mysql/service_progress_report.h
+include/mysql/service_thd_alloc.h
+include/mysql/service_thd_wait.h
+include/mysql/service_thread_scheduler.h
+include/mysql/services.h
+include/mysql/sql_common.h
+include/mysql/sql_state.h
+include/mysql/sslopt-case.h
+include/mysql/sslopt-longopts.h
+include/mysql/sslopt-vars.h
+include/mysql/typelib.h
+lib/libmysqlclient.a
+lib/libmysqlclient.so
+lib/libmysqlclient.so.18
+lib/libmysqlclient.so.18.0.0
+lib/libmysqlclient_r.a
+lib/libmysqlclient_r.so
+lib/libmysqlclient_r.so.18
+lib/libmysqlclient_r.so.18.0.0
+man/man1/aria_chk.1
+man/man1/aria_dump_log.1
+man/man1/aria_ftdump.1
+man/man1/aria_pack.1
+man/man1/aria_read_log.1
+man/man1/innochecksum.1
+man/man1/msql2mysql.1
+man/man1/my_print_defaults.1
+man/man1/myisam_ftdump.1
+man/man1/myisamchk.1
+man/man1/myisamlog.1
+man/man1/myisampack.1
+man/man1/mysql-stress-test.pl.1
+man/man1/mysql-test-run.pl.1
+man/man1/mysql.1
+man/man1/mysql.server.1
+man/man1/mysql_client_test.1
+man/man1/mysql_client_test_embedded.1
+man/man1/mysql_config.1
+man/man1/mysql_convert_table_format.1
+man/man1/mysql_find_rows.1
+man/man1/mysql_fix_extensions.1
+man/man1/mysql_install_db.1
+man/man1/mysql_plugin.1
+man/man1/mysql_secure_installation.1
+man/man1/mysql_setpermission.1
+man/man1/mysql_tzinfo_to_sql.1
+man/man1/mysql_upgrade.1
+man/man1/mysql_waitpid.1
+man/man1/mysql_zap.1
+man/man1/mysqlaccess.1
+man/man1/mysqladmin.1
+man/man1/mysqlbinlog.1
+man/man1/mysqlbug.1
+man/man1/mysqlcheck.1
+man/man1/mysqld_multi.1
+man/man1/mysqld_safe.1
+man/man1/mysqldump.1
+man/man1/mysqldumpslow.1
+man/man1/mysqlhotcopy.1
+man/man1/mysqlimport.1
+man/man1/mysqlshow.1
+man/man1/mysqlslap.1
+man/man1/mysqltest.1
+man/man1/mysqltest_embedded.1
+man/man1/perror.1
+man/man1/replace.1
+man/man1/resolve_stack_dump.1
+man/man1/resolveip.1
+man/man8/mysqld.8
+share/mariadb/fill_help_tables.sql
+share/mariadb/mysql_performance_tables.sql
+share/mariadb/mysql_system_tables.sql
+share/mariadb/mysql_system_tables_data.sql
+share/mariadb/mysql_test_data_timezone.sql
diff --git a/databases/mariadb55-client/buildlink3.mk b/databases/mariadb55-client/buildlink3.mk
new file mode 100644
index 00000000000..8d6f8b3a841
--- /dev/null
+++ b/databases/mariadb55-client/buildlink3.mk
@@ -0,0 +1,18 @@
+# $NetBSD: buildlink3.mk,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+BUILDLINK_TREE+= mariadb-client
+
+.if !defined(MARIADB_CLIENT_BUILDLINK3_MK)
+MARIADB_CLIENT_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.mariadb-client+= mariadb-client>=5.5.42
+BUILDLINK_PKGSRCDIR.mariadb-client?= ../../databases/mariadb55-client
+BUILDLINK_PKGSRCDIR.mariadb-client?= ../../databases/mariadb55-client
+BUILDLINK_INCDIRS.mariadb-client?= include/mysql
+BUILDLINK_LIBDIRS.mariadb-client?= lib
+
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.endif # MARIADB_CLIENT_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -mariadb-client
diff --git a/databases/mariadb55-client/distinfo b/databases/mariadb55-client/distinfo
new file mode 100644
index 00000000000..f15d7f155e7
--- /dev/null
+++ b/databases/mariadb55-client/distinfo
@@ -0,0 +1,53 @@
+$NetBSD: distinfo,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+SHA1 (mariadb-5.5.42.tar.gz) = df5164df0ff3f21fac4400932dc075864b0fac98
+RMD160 (mariadb-5.5.42.tar.gz) = d9633171d9184498dba14837d1cf307fd4342079
+Size (mariadb-5.5.42.tar.gz) = 45586372 bytes
+SHA1 (sphinx-2.2.7-release.tar.gz) = dedae28c0deafda90109745230dacbe0dc441e1a
+RMD160 (sphinx-2.2.7-release.tar.gz) = d9f0150f6779b43457e30c77be50aa9bc658b03a
+Size (sphinx-2.2.7-release.tar.gz) = 2969037 bytes
+SHA1 (patch-BUILD_compile-pentium-gcov) = 02b414235a2cdfc1d5c95946010e0cdbada76c5d
+SHA1 (patch-CMakeLists.txt) = cc69f38e761ee5956dde27745377acde1728d63b
+SHA1 (patch-client_completion_hash.cc) = 810dab31e17a19804323059d38f5ec7f0d55c3ab
+SHA1 (patch-client_mysql.cc) = a5296801f6960f77da12eeb749cc32a86f6bc545
+SHA1 (patch-client_mysqladmin.cc) = ab05c6944d50c9b22365426656f0b61a5906d632
+SHA1 (patch-client_mysqlbinlog.cc) = 00146dfd7d0a6e0bb1a8c30395bc707af3b4a6c7
+SHA1 (patch-client_mysqlshow.c) = 82ddfb98ab85b3e96e56b5ecc0df25cc315b8dbc
+SHA1 (patch-cmake_libutils.cmake) = 0c3f25f8e73ab0a062b539a8d551342a6ddf57c4
+SHA1 (patch-cmake_plugin.cmake) = b7566d25c80c2492a96c5617b96f9b6212b0fe93
+SHA1 (patch-cmake_readline.cmake) = 5b975b817c5c62712e061b121056816425368e92
+SHA1 (patch-include_CMakeLists.txt) = 9ce9db088fda6ed76039b818c27b74d584bae151
+SHA1 (patch-include_my_compare.h) = 9d04f444d56d705f3a57add7ad5f8fc5c7ce8341
+SHA1 (patch-include_my_net.h) = b6361a0871afdf66feabc82c5ad3559ff5b34c37
+SHA1 (patch-include_my_pthread.h) = 6d4ec91f90e717b0a075133fea535ee62d64d3ef
+SHA1 (patch-include_myisam.h) = 4cc8fd0bcba5ae8fdc4882048351b6225f00d2c5
+SHA1 (patch-include_violite.h) = 89c21f49751e06324fd32773e03561bd9cce33d7
+SHA1 (patch-libmysql_CMakeLists.txt) = bca5243b76ea783e5b39e619528b28095aa1392a
+SHA1 (patch-mysys_my__getopt.c) = 76ed2ffb774a7171bb547b3098db148329cbe21d
+SHA1 (patch-mysys_stacktrace.c) = 9f18875126208c30d41f896f0e6edc7000df0c73
+SHA1 (patch-scripts_CMakeLists.txt) = 5e30442df51009fd253b0f3c99526b587b2626ff
+SHA1 (patch-scripts_mysqld_safe.sh) = 5ce94ea8ebce4041fe9ba4753a18b378052aab4d
+SHA1 (patch-sql-common_client__plugin.c) = 507fb154013dc66218f36fe12e8b28eb8774d090
+SHA1 (patch-sql_CMakeLists.txt) = fd2bfb8cbb74ea806b95a6c02b282197c3f8c04c
+SHA1 (patch-sql_log_event.h) = 8d2700e370e77d3f6cb441b67b3d19f13d77e600
+SHA1 (patch-sql_mysqld.cc) = fa0f827f18f667788fc63f8eda60e87281b10ece
+SHA1 (patch-sql_sql_string.h) = a452b9ec57c8706fe42c7982cb9996a07c57761a
+SHA1 (patch-storage_archive_CMakeLists.txt) = 1ca57fce7224d57d1e57596b29ff26d1cc578005
+SHA1 (patch-storage_blackhole_CMakeLists.txt) = 9eb54080ad2911d19f2d9b0643397de8e5292d4a
+SHA1 (patch-storage_csv_CMakeLists.txt) = d24d5ca563cb3b7294942639015609f8212ff5bf
+SHA1 (patch-storage_example_CMakeLists.txt) = dd2f5f8fcb8c7d81f3c627f67d4af48488f8a815
+SHA1 (patch-storage_federated_CMakeLists.txt) = 422498972e3e6716f785d37d0a4cf9ef4954564d
+SHA1 (patch-storage_heap_CMakeLists.txt) = 3aa82a8ff12b4ab5d844ee56621569fb70616802
+SHA1 (patch-storage_innobase_include_os0sync.h) = 6eb85db54783267f78aac6197a9c6829282f249d
+SHA1 (patch-storage_myisam_CMakeLists.txt) = 3fa24fc137286ce4a607ced5a169ad075239d2ac
+SHA1 (patch-storage_myisammrg_CMakeLists.txt) = d988f23723b67cbaa227d1f4d2f10e76e171115d
+SHA1 (patch-storage_ndb_include_util_Parser.hpp) = 1b5d243127356d5985f096d5e0dd44c344e57e2c
+SHA1 (patch-storage_tokudb_ft-index_portability_portability.cc) = 336e915b9d1cdbdffb5317d0a825b54aedb762d7
+SHA1 (patch-storage_tokudb_ft-index_portability_toku__portability.h) = 48a128b6a0c49e88df556da9bdf13d4a906b14ef
+SHA1 (patch-storage_tokudb_ft-index_portability_toku__pthread.cc) = 24d90b5f1ccd1eb6fb7e9233b11ccee1f90e1512
+SHA1 (patch-storage_tokudb_ft-index_portability_toku__pthread.h) = e82634121c27fb3920d44c3bf38eeedffc3d8c1f
+SHA1 (patch-storage_tokudb_ft-index_src_ydb-internal.h) = bbcf912fe329ef85c4ac5c6803fb5cb1aaa9d01d
+SHA1 (patch-strings_decimal.c) = 4b22180d1766352673a648f76302780b1c06bca5
+SHA1 (patch-strtoll.c) = 53a3c0172487ee68f621328b16aa1742af4ae737
+SHA1 (patch-strtoull.c) = 7126be697036a588d29e21a6e1a472863d285f4a
+SHA1 (patch-vio_viosocket.c) = bf6d57ee04db57b7ac508b18653b0955ef8a6a2b
diff --git a/databases/mariadb55-client/options.mk b/databases/mariadb55-client/options.mk
new file mode 100644
index 00000000000..7d8596a2701
--- /dev/null
+++ b/databases/mariadb55-client/options.mk
@@ -0,0 +1,38 @@
+# $NetBSD: options.mk,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.mariadb55
+
+# ndb-cluster does not configure with cmake
+PKG_SUPPORTED_OPTIONS+= dtrace embedded-server ndb-cluster sphinx ssl
+PKG_SUGGESTED_OPTIONS+= embedded-server ssl
+
+.include "../../mk/bsd.options.mk"
+
+# Enable OpenSSL support
+.if !empty(PKG_OPTIONS:Mssl)
+. include "../../security/openssl/buildlink3.mk"
+CMAKE_ARGS+= -DWITH_SSL=system
+.else
+CMAKE_ARGS+= -DWITH_SSL=no
+.endif
+
+# Enable DTrace support
+.if !empty(PKG_OPTIONS:Mdtrace)
+CMAKE_ARGS+= -DENABLE_DTRACE=ON
+.endif
+
+# Enable Sphinx SE support
+# http://sphinxsearch.com/docs/current.html#sphinxse-overview
+PLIST_VARS+= sphinx
+.if !empty(PKG_OPTIONS:Msphinx) || make(distinfo) || make(makesum) || make(mdi)
+SPHINX_VER= 2.2.7
+DISTFILES= ${DEFAULT_DISTFILES} sphinx-${SPHINX_VER}-release${EXTRACT_SUFX}
+SITES.sphinx-2.2.7-release.tar.gz= http://sphinxsearch.com/files/
+.if !empty(PKGPATH:Mdatabases/mariadb55-server)
+MESSAGE_SRC= ${PKGDIR}/MESSAGE ${PKGDIR}/MESSAGE.sphinx
+.endif
+PLIST.sphinx= yes
+
+post-extract:
+ ${CP} -R ${WRKDIR}/sphinx-${SPHINX_VER}-release/mysqlse ${WRKSRC}/storage/sphinx
+.endif
diff --git a/databases/mariadb55-client/patches/patch-BUILD_compile-pentium-gcov b/databases/mariadb55-client/patches/patch-BUILD_compile-pentium-gcov
new file mode 100644
index 00000000000..fe05d09fe47
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-BUILD_compile-pentium-gcov
@@ -0,0 +1,15 @@
+$NetBSD: patch-BUILD_compile-pentium-gcov,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+* Don't use "==" in test(1).
+
+--- BUILD/compile-pentium-gcov.orig 2015-02-13 12:07:00.000000000 +0000
++++ BUILD/compile-pentium-gcov
+@@ -22,7 +22,7 @@ CCACHE_GCOV_VERSION_ENABLED=0
+ if ccache -V > /dev/null 2>&1
+ then
+ CCACHE_VER=`ccache -V | head -1 | sed s/"ccache version "//`
+- if test "$CCACHE_VER" == "2.4-gcov"
++ if test "$CCACHE_VER" = "2.4-gcov"
+ then
+ CCACHE_GCOV_VERSION_ENABLED=1
+ else
diff --git a/databases/mariadb55-client/patches/patch-CMakeLists.txt b/databases/mariadb55-client/patches/patch-CMakeLists.txt
new file mode 100644
index 00000000000..ce0d5edf249
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-CMakeLists.txt
@@ -0,0 +1,56 @@
+$NetBSD: patch-CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Split configuration between mysql-client and mysql-server.
+Build with newer DTrace.
+
+--- CMakeLists.txt.orig 2015-02-13 12:07:00.000000000 +0000
++++ CMakeLists.txt
+@@ -154,6 +154,7 @@ IF(DISABLE_SHARED)
+ SET(WITHOUT_DYNAMIC_PLUGINS 1)
+ ENDIF()
+ OPTION(ENABLED_PROFILING "Enable profiling" ON)
++OPTION(ENABLED_DTRACE "Include support for DTrace probes" OFF)
+ OPTION(CYBOZU "" OFF)
+ OPTION(BACKUP_TEST "" OFF)
+ OPTION(WITHOUT_SERVER OFF)
+@@ -380,22 +381,24 @@ IF(NOT WITHOUT_SERVER)
+ CONFIGURE_PLUGINS()
+ ENDIF()
+
+-ADD_SUBDIRECTORY(include)
+ ADD_SUBDIRECTORY(dbug)
+ ADD_SUBDIRECTORY(strings)
+ ADD_SUBDIRECTORY(vio)
+ ADD_SUBDIRECTORY(regex)
+ ADD_SUBDIRECTORY(mysys)
+-ADD_SUBDIRECTORY(libmysql)
+-ADD_SUBDIRECTORY(client)
+ ADD_SUBDIRECTORY(extra)
+ ADD_SUBDIRECTORY(libservices)
+-ADD_SUBDIRECTORY(scripts)
+ ADD_SUBDIRECTORY(sql/share)
+ ADD_SUBDIRECTORY(support-files)
+
+-IF(NOT WITHOUT_SERVER)
++IF(WITHOUT_SERVER)
++ ADD_SUBDIRECTORY(include)
++ ADD_SUBDIRECTORY(libmysql)
++ ADD_SUBDIRECTORY(client)
++ ADD_SUBDIRECTORY(scripts)
++ ADD_SUBDIRECTORY(man)
+ ADD_SUBDIRECTORY(tests)
++ELSE()
+ ADD_SUBDIRECTORY(sql)
+ OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
+ IF(WITH_EMBEDDED_SERVER)
+@@ -413,10 +416,6 @@ IF(NOT WITHOUT_SERVER)
+ ADD_SUBDIRECTORY(packaging/rpm-oel)
+ ENDIF()
+
+-IF(UNIX)
+- ADD_SUBDIRECTORY(man)
+-ENDIF()
+-
+ INCLUDE(cmake/abi_check.cmake)
+ INCLUDE(cmake/tags.cmake)
+
diff --git a/databases/mariadb55-client/patches/patch-client_completion_hash.cc b/databases/mariadb55-client/patches/patch-client_completion_hash.cc
new file mode 100644
index 00000000000..ae49a6180f5
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-client_completion_hash.cc
@@ -0,0 +1,17 @@
+$NetBSD: patch-client_completion_hash.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Portability: include <bstring.h> if exists.
+
+--- client/completion_hash.cc.orig 2015-02-13 12:07:00.000000000 +0000
++++ client/completion_hash.cc
+@@ -22,6 +22,10 @@
+
+ #include <my_global.h>
+ #include <m_string.h>
++#ifdef NEEDS_BSTRING_H // defines bzero()
++#include <bstring.h>
++#endif
++
+ #include <my_sys.h>
+ #include "completion_hash.h"
+
diff --git a/databases/mariadb55-client/patches/patch-client_mysql.cc b/databases/mariadb55-client/patches/patch-client_mysql.cc
new file mode 100644
index 00000000000..0f929e87dfd
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-client_mysql.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-client_mysql.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- client/mysql.cc.orig 2015-02-13 12:07:00.000000000 +0000
++++ client/mysql.cc
+@@ -89,7 +89,7 @@ extern "C" {
+ #if defined(__WIN__)
+ #include <conio.h>
+ #else
+-#include <readline.h>
++#include <readline/readline.h>
+ #define HAVE_READLINE
+ #define USE_POPEN
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-client_mysqladmin.cc b/databases/mariadb55-client/patches/patch-client_mysqladmin.cc
new file mode 100644
index 00000000000..64187514252
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-client_mysqladmin.cc
@@ -0,0 +1,35 @@
+$NetBSD: patch-client_mysqladmin.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Redefine signals for Irix.
+
+--- client/mysqladmin.cc.orig 2015-02-13 12:07:00.000000000 +0000
++++ client/mysqladmin.cc
+@@ -30,6 +30,11 @@
+ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
+ #define MAX_TRUNC_LENGTH 3
+
++#if defined(_SCO_DS)
++#include "../strtoull.c"
++#define strtoull pkgsrc_strtoull
++#endif
++
+ char *host= NULL, *user= 0, *opt_password= 0,
+ *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
+ char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
+@@ -334,8 +339,14 @@ int main(int argc,char *argv[])
+ if (tty_password)
+ opt_password = get_tty_password(NullS);
+
+- (void) signal(SIGINT,endprog); /* Here if abort */
+- (void) signal(SIGTERM,endprog); /* Here if abort */
++#ifdef IRIX5
++#define _MYSQL_END_TYPE (void (*)(...))
++#else
++#define _MYSQL_END_TYPE
++#endif
++
++ (void) signal(SIGINT,_MYSQL_END_TYPE endprog); /* Here if abort */
++ (void) signal(SIGTERM,_MYSQL_END_TYPE endprog);/* Here if abort */
+
+ sf_leaking_memory=0; /* from now on we cleanup properly */
+
diff --git a/databases/mariadb55-client/patches/patch-client_mysqlbinlog.cc b/databases/mariadb55-client/patches/patch-client_mysqlbinlog.cc
new file mode 100644
index 00000000000..ae5b2f892e4
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-client_mysqlbinlog.cc
@@ -0,0 +1,16 @@
+$NetBSD: patch-client_mysqlbinlog.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Portability: include <bstring.h> if exists.
+
+--- client/mysqlbinlog.cc.orig 2015-02-13 12:07:00.000000000 +0000
++++ client/mysqlbinlog.cc
+@@ -40,6 +40,9 @@
+ #include "sql_common.h"
+ #include "my_dir.h"
+ #include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
++#ifdef NEEDS_BSTRING_H
++#include <bstring.h> /* defines bzero() */
++#endif
+
+
+ #include "sql_string.h" // needed for Rpl_filter
diff --git a/databases/mariadb55-client/patches/patch-client_mysqlshow.c b/databases/mariadb55-client/patches/patch-client_mysqlshow.c
new file mode 100644
index 00000000000..49e30408312
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-client_mysqlshow.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-client_mysqlshow.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- client/mysqlshow.c.orig 2015-02-13 12:07:00.000000000 +0000
++++ client/mysqlshow.c
+@@ -30,6 +30,11 @@
+ #include <sslopt-vars.h>
+ #include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
+
++#if defined(_SCO_DS)
++#include "../strtoull.c"
++#define strtoull pkgsrc_strtoull
++#endif
++
+ static char * host=0, *opt_password=0, *user=0;
+ static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
+ static my_bool tty_password= 0, opt_table_type= 0;
diff --git a/databases/mariadb55-client/patches/patch-cmake_libutils.cmake b/databases/mariadb55-client/patches/patch-cmake_libutils.cmake
new file mode 100644
index 00000000000..76ebf51ae99
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-cmake_libutils.cmake
@@ -0,0 +1,15 @@
+$NetBSD: patch-cmake_libutils.cmake,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+On Mac OS X, use PkgSrc libtool.
+
+--- cmake/libutils.cmake.orig 2015-02-13 12:07:00.000000000 +0000
++++ cmake/libutils.cmake
+@@ -178,7 +178,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NA
+ "${LINKER_EXTRA_FLAGS}")
+ ELSE()
+ GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION)
+- IF(APPLE)
++ IF(0)
+ # Use OSX's libtool to merge archives (ihandles universal
+ # binaries properly)
+ ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
diff --git a/databases/mariadb55-client/patches/patch-cmake_plugin.cmake b/databases/mariadb55-client/patches/patch-cmake_plugin.cmake
new file mode 100644
index 00000000000..057d1b3eda8
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-cmake_plugin.cmake
@@ -0,0 +1,56 @@
+$NetBSD: patch-cmake_plugin.cmake,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- cmake/plugin.cmake.orig 2015-02-13 12:07:00.000000000 +0000
++++ cmake/plugin.cmake
+@@ -21,6 +21,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_
+ # [STORAGE_ENGINE]
+ # [MANDATORY|DEFAULT]
+ # [STATIC_ONLY|DYNAMIC_ONLY]
++# [DTRACE_INSTRUMENTED]
+ # [MODULE_OUTPUT_NAME module_name]
+ # [STATIC_OUTPUT_NAME static_name]
+ # [RECOMPILE_FOR_EMBEDDED]
+@@ -30,7 +31,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_
+ MACRO(MYSQL_ADD_PLUGIN)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT"
+- "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
++ "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;DTRACE_INSTRUMENTED"
+ ${ARGN}
+ )
+
+@@ -117,7 +118,9 @@ MACRO(MYSQL_ADD_PLUGIN)
+ ENDIF()
+
+ ADD_LIBRARY(${target} STATIC ${SOURCES})
+- DTRACE_INSTRUMENT(${target})
++ IF (ARG_DTRACE_INSTRUMENTED)
++ DTRACE_INSTRUMENT(${target})
++ ENDIF()
+ ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
+ RESTRICT_SYMBOL_EXPORTS(${target})
+ IF(WITH_EMBEDDED_SERVER)
+@@ -126,7 +129,9 @@ MACRO(MYSQL_ADD_PLUGIN)
+ IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC)
+ # Recompile some plugins for embedded
+ ADD_CONVENIENCE_LIBRARY(${target}_embedded ${SOURCES})
+- DTRACE_INSTRUMENT(${target}_embedded)
++ IF (ARG_DTRACE_INSTRUMENTED)
++ DTRACE_INSTRUMENT(${target}_embedded)
++ ENDIF()
+ IF(ARG_RECOMPILE_FOR_EMBEDDED)
+ SET_TARGET_PROPERTIES(${target}_embedded
+ PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY")
+@@ -165,7 +170,9 @@ MACRO(MYSQL_ADD_PLUGIN)
+
+ ADD_VERSION_INFO(${target} MODULE SOURCES)
+ ADD_LIBRARY(${target} MODULE ${SOURCES})
+- DTRACE_INSTRUMENT(${target})
++ IF (ARG_DTRACE_INSTRUMENTED)
++ DTRACE_INSTRUMENT(${target})
++ ENDIF()
+ SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
+ COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
+ TARGET_LINK_LIBRARIES (${target} mysqlservices)
diff --git a/databases/mariadb55-client/patches/patch-cmake_readline.cmake b/databases/mariadb55-client/patches/patch-cmake_readline.cmake
new file mode 100644
index 00000000000..d549bc39986
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-cmake_readline.cmake
@@ -0,0 +1,72 @@
+$NetBSD: patch-cmake_readline.cmake,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+* Fix cmake's check build error. Borrowed from mysql56's readline.cmake.
+
+--- cmake/readline.cmake.orig 2015-02-13 12:07:00.000000000 +0000
++++ cmake/readline.cmake
+@@ -132,7 +132,7 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE)
+ SET(CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <stdio.h>
+- #include <readline.h>
++ #include <readline/readline.h>
+ int main(int argc, char **argv)
+ {
+ rl_completion_func_t *func1= (rl_completion_func_t*)0;
+@@ -142,7 +142,7 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE)
+
+ CHECK_C_SOURCE_COMPILES("
+ #include <stdio.h>
+- #include <readline.h>
++ #include <readline/readline.h>
+ #if RL_VERSION_MAJOR > 5
+ #error
+ #endif
+@@ -180,8 +180,11 @@ MACRO (MYSQL_FIND_SYSTEM_LIBEDIT)
+ #include <readline.h>
+ int main(int argc, char **argv)
+ {
+- int res= (*rl_completion_entry_function)(0,0);
++ typedef int MYFunction(const char*, int);
++ MYFunction* myf= rl_completion_entry_function;
++ int res= (myf)(NULL, 0);
+ completion_matches(0,0);
++ return res;
+ }"
+ LIBEDIT_INTERFACE)
+ SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE})
+@@ -195,32 +198,13 @@ MACRO (MYSQL_CHECK_READLINE)
+ SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline")
+ FIND_CURSES()
+
+- IF(WITH_READLINE)
+- MYSQL_USE_BUNDLED_READLINE()
+- ELSE()
+- # OSX includes incompatible readline lib
+- IF (NOT APPLE)
+- MYSQL_FIND_SYSTEM_READLINE()
+- ENDIF()
+- IF(USE_NEW_READLINE_INTERFACE)
+- SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR})
+- SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY})
+- ELSE()
+- MYSQL_FIND_SYSTEM_LIBEDIT()
+- IF(USE_LIBEDIT_INTERFACE)
+- SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR})
+- SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY})
+- ELSE()
+- MYSQL_USE_BUNDLED_READLINE()
+- ENDIF()
+- ENDIF()
+- ENDIF()
++ MYSQL_FIND_SYSTEM_READLINE()
+
+ SET(CMAKE_REQUIRED_LIBRARIES ${MY_READLINE_LIBRARY})
+ SET(CMAKE_REQUIRED_INCLUDES ${MY_READLINE_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <stdio.h>
+- #include <readline.h>
++ #include <readline/readline.h>
+ int main(int argc, char **argv)
+ {
+ HIST_ENTRY entry;
diff --git a/databases/mariadb55-client/patches/patch-include_CMakeLists.txt b/databases/mariadb55-client/patches/patch-include_CMakeLists.txt
new file mode 100644
index 00000000000..707777dbb66
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_CMakeLists.txt
@@ -0,0 +1,20 @@
+$NetBSD: patch-include_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Only mysql-client installs includes.
+
+--- include/CMakeLists.txt.orig 2015-02-13 12:07:00.000000000 +0000
++++ include/CMakeLists.txt
+@@ -55,11 +55,13 @@ SET(HEADERS
+ handler_ername.h
+ )
+
++IF(WITHOUT_SERVER)
+ 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}")
diff --git a/databases/mariadb55-client/patches/patch-include_my_compare.h b/databases/mariadb55-client/patches/patch-include_my_compare.h
new file mode 100644
index 00000000000..9e70d78c5c4
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_my_compare.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-include_my_compare.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Adjust HA_MAX_KEY_LENGTH x4.
+
+--- include/my_compare.h.orig 2015-02-13 12:07:01.000000000 +0000
++++ include/my_compare.h
+@@ -40,7 +40,7 @@ extern "C" {
+ 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/mariadb55-client/patches/patch-include_my_net.h b/databases/mariadb55-client/patches/patch-include_my_net.h
new file mode 100644
index 00000000000..c0dc75bb085
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_my_net.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-include_my_net.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+* Define SHUT_RDWR for Irix 5.
+
+--- include/my_net.h.orig 2015-02-13 12:07:01.000000000 +0000
++++ include/my_net.h
+@@ -64,6 +64,15 @@ C_MODE_START
+
+ #endif
+
++#if defined(__sgi) && !defined(SHUT_RDWR)
++
++/*
++ IRIX 5 does not define SHUT_RDWR
++*/
++
++#define SHUT_RDWR 2
++#endif
++
+ /*
+ On OSes which don't have the in_addr_t, we guess that using uint32 is the best
+ possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit
diff --git a/databases/mariadb55-client/patches/patch-include_my_pthread.h b/databases/mariadb55-client/patches/patch-include_my_pthread.h
new file mode 100644
index 00000000000..a85ef3b6fb1
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_my_pthread.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-include_my_pthread.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- include/my_pthread.h.orig 2015-02-13 12:07:01.000000000 +0000
++++ include/my_pthread.h
+@@ -21,6 +21,8 @@
+
+ #include "my_global.h" /* myf */
+
++#include <signal.h>
++
+ #ifndef ETIME
+ #define ETIME ETIMEDOUT /* For FreeBSD */
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-include_myisam.h b/databases/mariadb55-client/patches/patch-include_myisam.h
new file mode 100644
index 00000000000..075b54ec9fb
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_myisam.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-include_myisam.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Adjust MI_MAX_KEY_LENGTH x4.
+
+--- include/myisam.h.orig 2015-02-13 12:07:01.000000000 +0000
++++ include/myisam.h
+@@ -44,7 +44,7 @@ extern "C" {
+ The following defines can be increased if necessary.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.
+ */
+-#define MI_MAX_KEY_LENGTH 1000 /* Max length in bytes */
++#define MI_MAX_KEY_LENGTH 4000 /* Max length in bytes */
+ #define MI_MAX_KEY_SEG 16 /* Max segments for key */
+
+ #define MI_NAME_IEXT ".MYI"
diff --git a/databases/mariadb55-client/patches/patch-include_violite.h b/databases/mariadb55-client/patches/patch-include_violite.h
new file mode 100644
index 00000000000..db3c745895e
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-include_violite.h
@@ -0,0 +1,32 @@
+$NetBSD: patch-include_violite.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- include/violite.h.orig 2015-02-13 12:07:01.000000000 +0000
++++ include/violite.h
+@@ -212,8 +212,14 @@ struct st_vio
+ HANDLE hPipe;
+ my_bool localhost; /* Are we from localhost? */
+ int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
++#if defined(_SCO_DS)
++/* SCO OpenServer 5.0.7/3.2 has no sockaddr_storage. */
++ struct sockaddr_in local; /* Local internet address */
++ struct sockaddr_in remote; /* Remote internet address */
++#else
+ struct sockaddr_storage local; /* Local internet address */
+ struct sockaddr_storage remote; /* Remote internet address */
++#endif
+ int addrLen; /* Length of remote address */
+ enum enum_vio_type type; /* Type of connection */
+ char desc[30]; /* String description */
+@@ -233,7 +239,12 @@ struct st_vio
+ int (*viokeepalive)(Vio*, my_bool);
+ int (*fastsend)(Vio*);
+ my_bool (*peer_addr)(Vio*, char *, uint16*, size_t);
++/* SCO OpenServer 5.0.7/3.2 has no sockaddr_storage. */
++#if defined(_SCO_DS)
++ void (*in_addr)(Vio*, struct sockaddr_in*);
++#else
+ void (*in_addr)(Vio*, struct sockaddr_storage*);
++#endif
+ my_bool (*should_retry)(Vio*);
+ my_bool (*was_interrupted)(Vio*);
+ int (*vioclose)(Vio*);
diff --git a/databases/mariadb55-client/patches/patch-libmysql_CMakeLists.txt b/databases/mariadb55-client/patches/patch-libmysql_CMakeLists.txt
new file mode 100644
index 00000000000..e4da8876925
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-libmysql_CMakeLists.txt
@@ -0,0 +1,23 @@
+$NetBSD: patch-libmysql_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Use uniform shared library names to avoid packaging list divergence.
+
+--- libmysql/CMakeLists.txt.orig 2015-02-13 12:07:01.000000000 +0000
++++ libmysql/CMakeLists.txt
+@@ -415,14 +415,8 @@ IF(NOT DISABLE_SHARED)
+ EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_5_1_EXTRA} ${CLIENT_API_5_5_EXTRA}
+ COMPONENT SharedLibraries)
+ IF(UNIX)
+- # libtool compatability
+- IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
+- SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
+- ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+- SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0")
+- ELSE()
+- SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0")
+- ENDIF()
++ SET(OS_SHARED_LIB_VERSION
++ "${SHARED_LIB_MAJOR_VERSION}.0.0")
+ # Name of shared library is mysqlclient on Unix
+ SET_TARGET_PROPERTIES(libmysql PROPERTIES
+ OUTPUT_NAME mysqlclient
diff --git a/databases/mariadb55-client/patches/patch-mysys_my__getopt.c b/databases/mariadb55-client/patches/patch-mysys_my__getopt.c
new file mode 100644
index 00000000000..518cc940362
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-mysys_my__getopt.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-mysys_my__getopt.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- mysys/my_getopt.c.orig 2015-02-13 12:07:04.000000000 +0000
++++ mysys/my_getopt.c
+@@ -24,6 +24,11 @@
+ #include <errno.h>
+ #include <m_string.h>
+
++#if defined(_SCO_DS)
++#include "../strtoll.c"
++#define strtoll pkgsrc_strtoll
++#endif
++
+ typedef void (*init_func_p)(const struct my_option *option, void *variable,
+ longlong value);
+
diff --git a/databases/mariadb55-client/patches/patch-mysys_stacktrace.c b/databases/mariadb55-client/patches/patch-mysys_stacktrace.c
new file mode 100644
index 00000000000..bd791b47bd5
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-mysys_stacktrace.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-mysys_stacktrace.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- mysys/stacktrace.c.orig 2015-02-13 12:07:04.000000000 +0000
++++ mysys/stacktrace.c
+@@ -455,7 +455,7 @@ void my_write_core(int sig)
+ __gcov_flush();
+ #endif
+ pthread_kill(pthread_self(), sig);
+-#if defined(P_MYID) && !defined(SCO)
++#if HAVE_SIGSEND && defined(P_MYID) && !defined(SCO)
+ /* On Solaris, the above kill is not enough */
+ sigsend(P_PID,P_MYID,sig);
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-scripts_CMakeLists.txt b/databases/mariadb55-client/patches/patch-scripts_CMakeLists.txt
new file mode 100644
index 00000000000..9239b7726b6
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-scripts_CMakeLists.txt
@@ -0,0 +1,29 @@
+$NetBSD: patch-scripts_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Fix paths.
+
+--- scripts/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ scripts/CMakeLists.txt
+@@ -180,22 +180,14 @@ ENDIF(UNIX)
+ # i.e. makes access relative the current directory. This matches
+ # the documentation, so better not change this.
+
+-IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+- SET(prefix ".")
+-ELSE()
+ SET(prefix "${CMAKE_INSTALL_PREFIX}")
+-ENDIF()
+
+ SET(bindir ${prefix}/${INSTALL_BINDIR})
+ SET(sbindir ${prefix}/${INSTALL_SBINDIR})
+ SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+ SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+ SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+-IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+- SET(localstatedir ${prefix}/data)
+-ELSE()
+ SET(localstatedir ${MYSQL_DATADIR})
+-ENDIF()
+
+ IF(UNIX)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
diff --git a/databases/mariadb55-client/patches/patch-scripts_mysqld_safe.sh b/databases/mariadb55-client/patches/patch-scripts_mysqld_safe.sh
new file mode 100644
index 00000000000..493fb0deb4a
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-scripts_mysqld_safe.sh
@@ -0,0 +1,13 @@
+$NetBSD: patch-scripts_mysqld_safe.sh,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- scripts/mysqld_safe.sh.orig 2015-02-13 12:07:04.000000000 +0000
++++ scripts/mysqld_safe.sh
+@@ -820,7 +820,7 @@ fi
+ # Alternatively, you can start mysqld with the "myisam-recover" option. See
+ # the manual for details.
+ #
+-# echo "Checking tables in $DATADIR"
++# log_notice "Checking tables in $DATADIR"
+ # $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI
+ # $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM
+
diff --git a/databases/mariadb55-client/patches/patch-sql-common_client__plugin.c b/databases/mariadb55-client/patches/patch-sql-common_client__plugin.c
new file mode 100644
index 00000000000..77865816b98
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-sql-common_client__plugin.c
@@ -0,0 +1,41 @@
+$NetBSD: patch-sql-common_client__plugin.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- sql-common/client_plugin.c.orig 2015-02-13 12:07:04.000000000 +0000
++++ sql-common/client_plugin.c
+@@ -190,6 +190,18 @@ err1:
+ DBUG_RETURN(NULL);
+ }
+
++static struct st_mysql_client_plugin *
++add_plugin_no_args(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
++ int argc, ...)
++{
++ va_list args;
++ struct st_mysql_client_plugin *rv;
++ va_start(args, argc);
++ rv = add_plugin(mysql, plugin, dlhandle, argc, args);
++ va_end(args);
++ return rv;
++}
++
+ /**
+ Loads plugins which are specified in the environment variable
+ LIBMYSQL_PLUGINS.
+@@ -260,7 +272,7 @@ int mysql_client_plugin_init()
+ pthread_mutex_lock(&LOCK_load_client_plugin);
+
+ for (builtin= mysql_client_builtins; *builtin; builtin++)
+- add_plugin(&mysql, *builtin, 0, 0, unused);
++ add_plugin_no_args(&mysql, *builtin, 0, 0, unused);
+
+ pthread_mutex_unlock(&LOCK_load_client_plugin);
+
+@@ -324,7 +336,7 @@ mysql_client_register_plugin(MYSQL *mysq
+ plugin= NULL;
+ }
+ else
+- plugin= add_plugin(mysql, plugin, 0, 0, unused);
++ plugin= add_plugin_no_args(mysql, plugin, 0, 0, unused);
+
+ pthread_mutex_unlock(&LOCK_load_client_plugin);
+ DBUG_RETURN(plugin);
diff --git a/databases/mariadb55-client/patches/patch-sql_CMakeLists.txt b/databases/mariadb55-client/patches/patch-sql_CMakeLists.txt
new file mode 100644
index 00000000000..63c00bf75a9
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-sql_CMakeLists.txt
@@ -0,0 +1,15 @@
+$NetBSD: patch-sql_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Do not install files in MYSQL_DATADIR.
+
+--- sql/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ sql/CMakeLists.txt
+@@ -276,7 +276,7 @@ ADD_CUSTOM_TARGET(distclean
+ VERBATIM
+ )
+
+-IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
++IF(FALSE)
+
+ # Copy db.opt into data/test/
+ SET(DBOPT_FILE ${CMAKE_SOURCE_DIR}/support-files/db.opt )
diff --git a/databases/mariadb55-client/patches/patch-sql_log_event.h b/databases/mariadb55-client/patches/patch-sql_log_event.h
new file mode 100644
index 00000000000..b95ea9650b5
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-sql_log_event.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-sql_log_event.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Portability: include <bstring.h> if exists.
+
+--- sql/log_event.h.orig 2015-02-13 12:07:04.000000000 +0000
++++ sql/log_event.h
+@@ -28,6 +28,10 @@
+ #ifndef _log_event_h
+ #define _log_event_h
+
++#ifdef NEEDS_BSTRING_H
++#include <bstring.h> /* defines bzero() */
++#endif
++
+ #if defined(USE_PRAGMA_INTERFACE) && defined(MYSQL_SERVER)
+ #pragma interface /* gcc class implementation */
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-sql_mysqld.cc b/databases/mariadb55-client/patches/patch-sql_mysqld.cc
new file mode 100644
index 00000000000..f580425c49e
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-sql_mysqld.cc
@@ -0,0 +1,22 @@
+$NetBSD: patch-sql_mysqld.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- sql/mysqld.cc.orig 2015-02-13 12:07:04.000000000 +0000
++++ sql/mysqld.cc
+@@ -166,7 +166,7 @@ extern int memcntl(caddr_t, size_t, int,
+ int initgroups(const char *,unsigned int);
+ #endif
+
+-#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
++#if (defined(__FreeBSD__) || defined(__DragonFly__)) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
+ #include <ieeefp.h>
+ #ifdef HAVE_FP_EXCEPT // Fix type conflict
+ typedef fp_except fp_except_t;
+@@ -201,7 +201,7 @@ extern "C" my_bool reopen_fstreams(const
+
+ inline void setup_fpu()
+ {
+-#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
++#if (defined(__FreeBSD__) || defined(__DragonFly__)) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
+ /* We can't handle floating point exceptions with threads, so disable
+ this on freebsd
+ Don't fall for overflow, underflow,divide-by-zero or loss of precision.
diff --git a/databases/mariadb55-client/patches/patch-sql_sql_string.h b/databases/mariadb55-client/patches/patch-sql_sql_string.h
new file mode 100644
index 00000000000..97d4f373b2c
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-sql_sql_string.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-sql_sql_string.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Portability: include <bstring.h> if exists.
+
+--- sql/sql_string.h.orig 2015-02-13 12:07:04.000000000 +0000
++++ sql/sql_string.h
+@@ -20,6 +20,10 @@
+
+ /* This file is originally from the mysql distribution. Coded by monty */
+
++#ifdef NEEDS_BSTRING_H
++#include <bstring.h> /* defines bzero() */
++#endif
++
+ #ifdef USE_PRAGMA_INTERFACE
+ #pragma interface /* gcc class implementation */
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-storage_archive_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_archive_CMakeLists.txt
new file mode 100644
index 00000000000..6c090aa8f0b
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_archive_CMakeLists.txt
@@ -0,0 +1,14 @@
+$NetBSD: patch-storage_archive_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/archive/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/archive/CMakeLists.txt
+@@ -14,5 +14,6 @@
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h)
+-MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY})
++MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE
++ LINK_LIBRARIES ${ZLIB_LIBRARY} DTRACE_INSTRUMENTED)
+
diff --git a/databases/mariadb55-client/patches/patch-storage_blackhole_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_blackhole_CMakeLists.txt
new file mode 100644
index 00000000000..c92586da969
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_blackhole_CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD: patch-storage_blackhole_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/blackhole/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/blackhole/CMakeLists.txt
+@@ -14,4 +14,5 @@
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ SET(BLACKHOLE_SOURCES ha_blackhole.cc ha_blackhole.h)
+-MYSQL_ADD_PLUGIN(blackhole ${BLACKHOLE_SOURCES} STORAGE_ENGINE)
++MYSQL_ADD_PLUGIN(blackhole ${BLACKHOLE_SOURCES} STORAGE_ENGINE
++ DTRACE_INSTRUMENTED)
diff --git a/databases/mariadb55-client/patches/patch-storage_csv_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_csv_CMakeLists.txt
new file mode 100644
index 00000000000..577ff386d59
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_csv_CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD: patch-storage_csv_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/csv/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/csv/CMakeLists.txt
+@@ -14,4 +14,5 @@
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ SET(CSV_SOURCES ha_tina.cc ha_tina.h transparent_file.cc transparent_file.h)
+-MYSQL_ADD_PLUGIN(csv ${CSV_SOURCES} STORAGE_ENGINE MANDATORY)
++MYSQL_ADD_PLUGIN(csv ${CSV_SOURCES} STORAGE_ENGINE
++ MANDATORY DTRACE_INSTRUMENTED)
diff --git a/databases/mariadb55-client/patches/patch-storage_example_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_example_CMakeLists.txt
new file mode 100644
index 00000000000..51fbd42dca4
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_example_CMakeLists.txt
@@ -0,0 +1,12 @@
+$NetBSD: patch-storage_example_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/example/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/example/CMakeLists.txt
+@@ -14,4 +14,4 @@
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ SET(EXAMPLE_SOURCES ha_example.cc)
+-MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE MODULE_ONLY COMPONENT Test)
++MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE MODULE_ONLY COMPONENT Test DTRACE_INSTRUMENTED)
diff --git a/databases/mariadb55-client/patches/patch-storage_federated_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_federated_CMakeLists.txt
new file mode 100644
index 00000000000..0abedb438fe
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_federated_CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD: patch-storage_federated_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/federated/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/federated/CMakeLists.txt
+@@ -19,4 +19,5 @@ IF(NOT WITH_FEDERATED AND NOT WITH_FEDER
+ # mysqld and are optimized away by the linker.
+ SET(FEDERATED_SOURCES ${FEDERATED_SOURCES} ${CMAKE_SOURCE_DIR}/mysys/string.c)
+ ENDIF()
+-MYSQL_ADD_PLUGIN(federated ${FEDERATED_SOURCES} STORAGE_ENGINE MODULE_ONLY)
++MYSQL_ADD_PLUGIN(federated ${FEDERATED_SOURCES} STORAGE_ENGINE
++ DTRACE_INSTRUMENTED)
diff --git a/databases/mariadb55-client/patches/patch-storage_heap_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_heap_CMakeLists.txt
new file mode 100644
index 00000000000..56b4f792044
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_heap_CMakeLists.txt
@@ -0,0 +1,16 @@
+$NetBSD: patch-storage_heap_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/heap/CMakeLists.txt.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/heap/CMakeLists.txt
+@@ -19,7 +19,8 @@ SET(HEAP_SOURCES _check.c _rectest.c hp
+ hp_rename.c hp_rfirst.c hp_rkey.c hp_rlast.c hp_rnext.c hp_rprev.c
+ hp_rrnd.c hp_rsame.c hp_scan.c hp_static.c hp_update.c hp_write.c)
+
+-MYSQL_ADD_PLUGIN(heap ${HEAP_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)
++MYSQL_ADD_PLUGIN(heap ${HEAP_SOURCES} STORAGE_ENGINE MANDATORY
++ RECOMPILE_FOR_EMBEDDED DTRACE_INSTRUMENTED)
+
+ IF(WITH_UNIT_TESTS)
+ ADD_EXECUTABLE(hp_test1 hp_test1.c)
diff --git a/databases/mariadb55-client/patches/patch-storage_innobase_include_os0sync.h b/databases/mariadb55-client/patches/patch-storage_innobase_include_os0sync.h
new file mode 100644
index 00000000000..d09c66fd48a
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_innobase_include_os0sync.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-storage_innobase_include_os0sync.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/innobase/include/os0sync.h.orig 2015-02-13 12:07:04.000000000 +0000
++++ storage/innobase/include/os0sync.h
+@@ -364,7 +364,7 @@ compare to, new_val is the value to swap
+ (atomic_cas_ulong(ptr, old_val, new_val) == old_val)
+
+ # define os_compare_and_swap_lint(ptr, old_val, new_val) \
+- ((lint)atomic_cas_ulong((ulong_t*) ptr, old_val, new_val) == old_val)
++ ((lint)atomic_cas_ulong((unsigned long*) ptr, old_val, new_val) == old_val)
+
+ # ifdef HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS
+ # if SIZEOF_PTHREAD_T == 4
+@@ -389,7 +389,7 @@ Returns the resulting value, ptr is poin
+ amount of increment. */
+
+ # define os_atomic_increment_lint(ptr, amount) \
+- atomic_add_long_nv((ulong_t*) ptr, amount)
++ atomic_add_long_nv((unsigned long *) ptr, amount)
+
+ # define os_atomic_increment_ulint(ptr, amount) \
+ atomic_add_long_nv(ptr, amount)
diff --git a/databases/mariadb55-client/patches/patch-storage_myisam_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_myisam_CMakeLists.txt
new file mode 100644
index 00000000000..b37bb848885
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_myisam_CMakeLists.txt
@@ -0,0 +1,16 @@
+$NetBSD: patch-storage_myisam_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/myisam/CMakeLists.txt.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/myisam/CMakeLists.txt
+@@ -30,7 +30,8 @@ SET(MYISAM_SOURCES ft_boolean_search.c
+ MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES}
+ STORAGE_ENGINE
+ MANDATORY
+- RECOMPILE_FOR_EMBEDDED)
++ RECOMPILE_FOR_EMBEDDED
++ DTRACE_INSTRUMENTED)
+
+ TARGET_LINK_LIBRARIES(myisam mysys)
+
diff --git a/databases/mariadb55-client/patches/patch-storage_myisammrg_CMakeLists.txt b/databases/mariadb55-client/patches/patch-storage_myisammrg_CMakeLists.txt
new file mode 100644
index 00000000000..4cc873b8f0f
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_myisammrg_CMakeLists.txt
@@ -0,0 +1,13 @@
+$NetBSD: patch-storage_myisammrg_CMakeLists.txt,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Build with newer DTrace.
+
+--- storage/myisammrg/CMakeLists.txt.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/myisammrg/CMakeLists.txt
+@@ -20,4 +20,5 @@ SET(MYISAMMRG_SOURCES myrg_close.c myrg
+ myrg_rprev.c myrg_rrnd.c myrg_rsame.c myrg_static.c myrg_update.c
+ myrg_write.c myrg_records.c)
+
+-MYSQL_ADD_PLUGIN(myisammrg ${MYISAMMRG_SOURCES} STORAGE_ENGINE MANDATORY RECOMPILE_FOR_EMBEDDED)
++MYSQL_ADD_PLUGIN(myisammrg ${MYISAMMRG_SOURCES} STORAGE_ENGINE MANDATORY
++ RECOMPILE_FOR_EMBEDDED DTRACE_INSTRUMENTED)
diff --git a/databases/mariadb55-client/patches/patch-storage_ndb_include_util_Parser.hpp b/databases/mariadb55-client/patches/patch-storage_ndb_include_util_Parser.hpp
new file mode 100644
index 00000000000..528a828427f
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_ndb_include_util_Parser.hpp
@@ -0,0 +1,22 @@
+$NetBSD: patch-storage_ndb_include_util_Parser.hpp,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Avoid C++ error (needed for Clang).
+
+--- storage/ndb/include/util/Parser.hpp.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/ndb/include/util/Parser.hpp
+@@ -149,12 +149,12 @@ public:
+ static const DummyRow* matchArg(Context*, const char *, const DummyRow *);
+ static bool parseArg(Context*, char*, const DummyRow*, Properties*);
+ static bool checkMandatory(Context*, const Properties*);
+-private:
+- const DummyRow * const m_rows;
+- class ParseInputStream & input;
+ bool m_breakOnEmpty;
+ bool m_breakOnCmd;
+ bool m_breakOnInvalidArg;
++private:
++ const DummyRow * const m_rows;
++ class ParseInputStream & input;
+ };
+
+ template<class T>
diff --git a/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_portability.cc b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_portability.cc
new file mode 100644
index 00000000000..8137469cdd1
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_portability.cc
@@ -0,0 +1,23 @@
+$NetBSD: patch-storage_tokudb_ft-index_portability_portability.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/tokudb/ft-index/portability/portability.cc.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/tokudb/ft-index/portability/portability.cc
+@@ -130,6 +130,9 @@ PATENT RIGHTS GRANT:
+ #include "memory.h"
+ #include <portability/toku_atomic.h>
+ #include <util/partitioned_counter.h>
++#if defined(__NetBSD__)
++#include <lwp.h>
++#endif
+
+ int
+ toku_portability_init(void) {
+@@ -160,6 +163,8 @@ toku_os_gettid(void) {
+ return syscall(SYS_gettid);
+ #elif defined(HAVE_PTHREAD_GETTHREADID_NP)
+ return pthread_getthreadid_np();
++#elif defined(__NetBSD__)
++ return (int)_lwp_self();
+ #else
+ # error "no implementation of gettid available"
+ #endif
diff --git a/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__portability.h b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__portability.h
new file mode 100644
index 00000000000..95beca6db87
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__portability.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-storage_tokudb_ft-index_portability_toku__portability.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/tokudb/ft-index/portability/toku_portability.h.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/tokudb/ft-index/portability/toku_portability.h
+@@ -187,7 +187,7 @@ int creat(const char *pathname, mod
+ int fstat(int fd, struct stat *buf) __attribute__((__deprecated__));
+ int stat(const char *path, struct stat *buf) __attribute__((__deprecated__));
+ int getpid(void) __attribute__((__deprecated__));
+-# if defined(__FreeBSD__) || defined(__APPLE__)
++# if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
+ int syscall(int __sysno, ...) __attribute__((__deprecated__));
+ # else
+ long int syscall(long int __sysno, ...) __attribute__((__deprecated__));
+@@ -200,7 +200,7 @@ int _dup2(int fd, int fd2)
+ #undef strdup
+ # if defined(__FreeBSD__)
+ char* strdup(const char *) __malloc_like __attribute__((__deprecated__));
+-# elif defined(__APPLE__)
++# elif defined(__APPLE__) || defined(__NetBSD__)
+ char* strdup(const char *) __attribute__((__deprecated__));
+ # else
+ char* strdup(const char *) __THROW __attribute_malloc__ __nonnull ((1)) __attribute__((__deprecated__));
+@@ -216,7 +216,7 @@ ssize_t pwrite(int, const void *, size_
+ extern void *malloc(size_t) __malloc_like __attribute__((__deprecated__));
+ extern void free(void*) __attribute__((__deprecated__));
+ extern void *realloc(void*, size_t) __malloc_like __attribute__((__deprecated__));
+-# elif defined(__APPLE__)
++# elif defined(__APPLE__) || defined(__NetBSD__)
+ extern void *malloc(size_t) __attribute__((__deprecated__));
+ extern void free(void*) __attribute__((__deprecated__));
+ extern void *realloc(void*, size_t) __attribute__((__deprecated__));
diff --git a/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.cc b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.cc
new file mode 100644
index 00000000000..895c308f1f0
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.cc
@@ -0,0 +1,23 @@
+$NetBSD: patch-storage_tokudb_ft-index_portability_toku__pthread.cc,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/tokudb/ft-index/portability/toku_pthread.cc.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/tokudb/ft-index/portability/toku_pthread.cc
+@@ -91,6 +91,9 @@ PATENT RIGHTS GRANT:
+ #define _GNU_SOURCE 1
+ #include <portability/toku_config.h>
+ #include <toku_pthread.h>
++#if defined(__NetBSD__)
++#include <sched.h>
++#endif
+
+ int toku_pthread_yield(void) {
+ #if defined(HAVE_PTHREAD_YIELD)
+@@ -102,6 +105,8 @@ int toku_pthread_yield(void) {
+ # else
+ # error "don't know what pthread_yield() returns"
+ # endif
++#elif defined(__NetBSD__)
++ return sched_yield();
+ #elif defined(HAVE_PTHREAD_YIELD_NP)
+ pthread_yield_np();
+ return 0;
diff --git a/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.h b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.h
new file mode 100644
index 00000000000..8496ff6b7e2
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_portability_toku__pthread.h
@@ -0,0 +1,13 @@
+$NetBSD: patch-storage_tokudb_ft-index_portability_toku__pthread.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/tokudb/ft-index/portability/toku_pthread.h.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/tokudb/ft-index/portability/toku_pthread.h
+@@ -142,7 +142,7 @@ typedef struct toku_mutex_aligned {
+ #endif
+
+ // Darwin doesn't provide adaptive mutexes
+-#if defined(__APPLE__)
++#if defined(__APPLE__) || defined(__NetBSD__)
+ # define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT
+ # if TOKU_PTHREAD_DEBUG
+ # define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true }
diff --git a/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_src_ydb-internal.h b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_src_ydb-internal.h
new file mode 100644
index 00000000000..10cdc728cee
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-storage_tokudb_ft-index_src_ydb-internal.h
@@ -0,0 +1,12 @@
+$NetBSD: patch-storage_tokudb_ft-index_src_ydb-internal.h,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- storage/tokudb/ft-index/src/ydb-internal.h.orig 2015-02-13 12:07:05.000000000 +0000
++++ storage/tokudb/ft-index/src/ydb-internal.h
+@@ -108,6 +108,7 @@ PATENT RIGHTS GRANT:
+ #include <locktree/range_buffer.h>
+
+ #include <toku_list.h>
++#include <stdarg.h>
+
+ struct __toku_db_internal {
+ int opened;
diff --git a/databases/mariadb55-client/patches/patch-strings_decimal.c b/databases/mariadb55-client/patches/patch-strings_decimal.c
new file mode 100644
index 00000000000..e4454819391
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-strings_decimal.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-strings_decimal.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+Portability: include <bstring.h> if exists.
+
+--- strings/decimal.c.orig 2015-02-13 12:07:15.000000000 +0000
++++ strings/decimal.c
+@@ -103,6 +103,9 @@
+ #include <myisampack.h>
+ #include <my_sys.h> /* for my_alloca */
+ #include <decimal.h>
++#ifdef NEEDS_BSTRING_H
++#include <bstring.h> /* defines bzero() */
++#endif
+
+ /*
+ Internally decimal numbers are stored base 10^9 (see DIG_BASE below)
diff --git a/databases/mariadb55-client/patches/patch-strtoll.c b/databases/mariadb55-client/patches/patch-strtoll.c
new file mode 100644
index 00000000000..44bc36a1839
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-strtoll.c
@@ -0,0 +1,163 @@
+$NetBSD: patch-strtoll.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- strtoll.c.orig 2015-04-15 18:31:25.000000000 +0000
++++ strtoll.c
+@@ -0,0 +1,158 @@
++#if !defined(LLONG_MAX)
++#define LLONG_MAX 0x7fffffffffffffffLL
++#endif
++
++#if !defined(LLONG_MIN)
++#define LLONG_MIN -0x7fffffffffffffffLL-1
++#endif
++
++#if !defined(ULLONG_MAX)
++#define ULLONG_MAX 0xffffffffffffffffULL
++#endif
++
++/*-
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#if 0
++#if defined(LIBC_SCCS) && !defined(lint)
++static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
++#endif /* LIBC_SCCS and not lint */
++
++#ifndef lint
++static const char rcsid[] =
++ "$FreeBSD$";
++#endif
++#endif
++
++#include <sys/types.h>
++
++#include <limits.h>
++#include <errno.h>
++#include <ctype.h>
++#include <stdlib.h>
++
++/*
++ * Convert a string to a long long integer.
++ *
++ * Ignores `locale' stuff. Assumes that the upper and lower case
++ * alphabets and digits are each contiguous.
++ */
++long long
++pkgsrc_strtoll(nptr, endptr, base)
++ const char *nptr;
++ char **endptr;
++ register int base;
++{
++ register const char *s;
++ register unsigned long long acc;
++ register unsigned char c;
++ register unsigned long long qbase, cutoff;
++ register int neg, any, cutlim;
++
++ /*
++ * Skip white space and pick up leading +/- sign if any.
++ * If base is 0, allow 0x for hex and 0 for octal, else
++ * assume decimal; if base is already 16, allow 0x.
++ */
++ s = nptr;
++ do {
++ c = *s++;
++ } while (isspace(c));
++ if (c == '-') {
++ neg = 1;
++ c = *s++;
++ } else {
++ neg = 0;
++ if (c == '+')
++ c = *s++;
++ }
++ if ((base == 0 || base == 16) &&
++ c == '0' && (*s == 'x' || *s == 'X')) {
++ c = s[1];
++ s += 2;
++ base = 16;
++ }
++ if (base == 0)
++ base = c == '0' ? 8 : 10;
++
++ /*
++ * Compute the cutoff value between legal numbers and illegal
++ * numbers. That is the largest legal value, divided by the
++ * base. An input number that is greater than this value, if
++ * followed by a legal input character, is too big. One that
++ * is equal to this value may be valid or not; the limit
++ * between valid and invalid numbers is then based on the last
++ * digit. For instance, if the range for quads is
++ * [-9223372036854775808..9223372036854775807] and the input base
++ * is 10, cutoff will be set to 922337203685477580 and cutlim to
++ * either 7 (neg==0) or 8 (neg==1), meaning that if we have
++ * accumulated a value > 922337203685477580, or equal but the
++ * next digit is > 7 (or 8), the number is too big, and we will
++ * return a range error.
++ *
++ * Set any if any `digits' consumed; make it negative to indicate
++ * overflow.
++ */
++ qbase = (unsigned)base;
++ cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
++ : LLONG_MAX;
++ cutlim = cutoff % qbase;
++ cutoff /= qbase;
++ for (acc = 0, any = 0;; c = *s++) {
++ if (!isascii(c))
++ break;
++ if (isdigit(c))
++ c -= '0';
++ else if (isalpha(c))
++ c -= isupper(c) ? 'A' - 10 : 'a' - 10;
++ else
++ break;
++ if (c >= base)
++ break;
++ if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
++ any = -1;
++ else {
++ any = 1;
++ acc *= qbase;
++ acc += c;
++ }
++ }
++ if (any < 0) {
++ acc = neg ? LLONG_MIN : LLONG_MAX;
++ errno = ERANGE;
++ } else if (neg)
++ acc = -acc;
++ if (endptr != 0)
++ *endptr = (char *)(any ? s - 1 : nptr);
++ return (acc);
++}
diff --git a/databases/mariadb55-client/patches/patch-strtoull.c b/databases/mariadb55-client/patches/patch-strtoull.c
new file mode 100644
index 00000000000..c9cf8a637b2
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-strtoull.c
@@ -0,0 +1,136 @@
+$NetBSD: patch-strtoull.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- strtoull.c.orig 2015-04-15 18:31:28.000000000 +0000
++++ strtoull.c
+@@ -0,0 +1,131 @@
++/*-
++ * Copyright (c) 1992, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#if defined(LIBC_SCCS) && !defined(lint)
++static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
++#endif /* LIBC_SCCS and not lint */
++#include <sys/cdefs.h>
++/*__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp $"); */
++
++#include <limits.h>
++#include <errno.h>
++#include <ctype.h>
++#include <stdlib.h>
++
++#if !defined(LLONG_MAX)
++#define LLONG_MAX 0x7fffffffffffffffLL
++#endif
++
++#if !defined(LLONG_MIN)
++#define LLONG_MIN -0x7fffffffffffffffLL-1
++#endif
++
++#if !defined(ULLONG_MAX)
++#define ULLONG_MAX 0xffffffffffffffffULL
++#endif
++
++/*
++ * Convert a string to an unsigned long long integer.
++ *
++ * Assumes that the upper and lower case
++ * alphabets and digits are each contiguous.
++ */
++unsigned long long
++pkgsrc_strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
++{
++ const char *s;
++ unsigned long long acc;
++ char c;
++ unsigned long long cutoff;
++ int neg, any, cutlim;
++
++ /*
++ * See strtoq for comments as to the logic used.
++ */
++ s = nptr;
++ do {
++ c = *s++;
++ } while (isspace((unsigned char)c));
++ if (c == '-') {
++ neg = 1;
++ c = *s++;
++ } else {
++ neg = 0;
++ if (c == '+')
++ c = *s++;
++ }
++ if ((base == 0 || base == 16) &&
++ c == '0' && (*s == 'x' || *s == 'X')) {
++ c = s[1];
++ s += 2;
++ base = 16;
++ }
++ if (base == 0)
++ base = c == '0' ? 8 : 10;
++ acc = any = 0;
++ if (base < 2 || base > 36)
++ goto noconv;
++
++ cutoff = ULLONG_MAX / base;
++ cutlim = ULLONG_MAX % base;
++ for ( ; ; c = *s++) {
++ if (c >= '0' && c <= '9')
++ c -= '0';
++ else if (c >= 'A' && c <= 'Z')
++ c -= 'A' - 10;
++ else if (c >= 'a' && c <= 'z')
++ c -= 'a' - 10;
++ else
++ break;
++ if (c >= base)
++ break;
++ if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
++ any = -1;
++ else {
++ any = 1;
++ acc *= base;
++ acc += c;
++ }
++ }
++ if (any < 0) {
++ acc = ULLONG_MAX;
++ errno = ERANGE;
++ } else if (!any) {
++noconv:
++ errno = EINVAL;
++ } else if (neg)
++ acc = -acc;
++ if (endptr != NULL)
++ *endptr = (char *)(any ? s - 1 : nptr);
++ return (acc);
++}
diff --git a/databases/mariadb55-client/patches/patch-vio_viosocket.c b/databases/mariadb55-client/patches/patch-vio_viosocket.c
new file mode 100644
index 00000000000..2726dd60b8c
--- /dev/null
+++ b/databases/mariadb55-client/patches/patch-vio_viosocket.c
@@ -0,0 +1,55 @@
+$NetBSD: patch-vio_viosocket.c,v 1.1 2015/04/16 20:20:15 ryoon Exp $
+
+--- vio/viosocket.c.orig 2015-02-13 12:07:16.000000000 +0000
++++ vio/viosocket.c
+@@ -37,6 +37,12 @@
+ # include <sys/filio.h>
+ #endif
+
++#if defined(_SCO_DS)
++/* SCO OpenServer 5.0.7/3.2 has no SHUT_* macros.
++ See http://osr507doc.sco.com/en/netguide/disockD.system_calls.html */
++#define SHUT_RDWR 2
++#endif
++
+ int vio_errno(Vio *vio __attribute__((unused)))
+ {
+ return socket_errno; /* On Win32 this mapped to WSAGetLastError() */
+@@ -552,7 +558,12 @@ my_bool vio_get_normalized_ip_string(con
+ char *ip_string,
+ size_t ip_string_size)
+ {
++/* SCO OpenServer 5.0.7/3.2 has no sockaddr_storage. */
++#if defined(_SCO_DS)
++ struct sockaddr_in norm_addr_storage;
++#else
+ struct sockaddr_storage norm_addr_storage;
++#endif
+ struct sockaddr *norm_addr= (struct sockaddr *) &norm_addr_storage;
+ int norm_addr_length;
+ int err_code;
+@@ -596,7 +607,11 @@ my_bool vio_peer_addr(Vio *vio, char *ip
+ */
+ struct in_addr *ip4= &((struct sockaddr_in *) &(vio->remote))->sin_addr;
+
++/* SCO OpenServer 5.0.7/3.2 has no sockaddr_storage, and use sockaddr_in.
++ So there is no ss_family in sockaddr_in. */
++#if !defined(_SCO_DS)
+ vio->remote.ss_family= AF_INET;
++#endif
+ vio->addrLen= sizeof (struct sockaddr_in);
+
+ ip4->s_addr= htonl(INADDR_LOOPBACK);
+@@ -611,7 +626,12 @@ my_bool vio_peer_addr(Vio *vio, char *ip
+ int err_code;
+ char port_buffer[NI_MAXSERV];
+
++/* SCO OpenServer 5.0.7/3.2 has no sockaddr_storage. */
++#if defined(_SCO_DS)
++ struct sockaddr_in addr_storage;
++#else
+ struct sockaddr_storage addr_storage;
++#endif
+ struct sockaddr *addr= (struct sockaddr *) &addr_storage;
+ size_socket addr_length= sizeof (addr_storage);
+