diff --git a/dev-cpp/yaml-cpp/Manifest b/dev-cpp/yaml-cpp/Manifest
new file mode 100644
index 0000000..379a001
--- /dev/null
+++ b/dev-cpp/yaml-cpp/Manifest
@@ -0,0 +1,4 @@
+AUX yaml-cpp-0.6.2-CVE-2017-5950.patch 1697 SHA256 4c1ce904f7738390983fe7f788eeac107675b878bc2df558e0e40a8743b5f0ed SHA512 0ba8bb8d81a98b77cde3dd386fe237dd11aae53011419042ff0b72b643ac2c1fdb7753ff524d0c5d319f7d601b417d1c6ab2419c728c4015197f83ce3eaa34b2 WHIRLPOOL 97f052d3041b073fa9e7c10acbeca4e1bd47fc131120ed6ccacf9a607ad959e23a54a55ee693f13c02310c754349168a3829169fc14714e740522d108f62ec07
+AUX yaml-cpp-0.6.2-unbundle-gtest.patch 2204 SHA256 e230366f645ec62d09e5aeac751713f8cee7922d85cc00158460aa4507bba141 SHA512 8cb227c2e156bd642be29b15ae7a7de9e4839d6f4b5e0132982659eaab442347d3ef3eedd1bfb8f936a5a1dc98b6d41be915f7da53fd6764f8b6becbaf6cff98 WHIRLPOOL 6edab8423883ef171454a2138b6b37cb48773421b9a4c4541496696abef80d5fbb24d3b393d72a07c11e1d9851287f2ba4e4ebfac6d4eb1bbe3af4b9f68be7e2
+DIST yaml-cpp-0.6.2.tar.gz 1396250 SHA256 e4d8560e163c3d875fd5d9e5542b5fd5bec810febdcba61481fe5fc4e6b1fd05 SHA512 fea8ce0a20a00cbc75023d1db442edfcd32d0ac57a3c41b32ec8d56f87cc1d85d7dd7a923ce662f5d3a315f91a736d6be0d649997acd190915c1d68cc93795e4 WHIRLPOOL f3c80b3670c5dd3ed38d48f83e0aef62d4dc844bd94ce831c63d1da76c3986725b5d9c49567ca6cdaeac82abafc30ca166582f4a6e0fd3ed8f9bbf61ffcf068e
+EBUILD yaml-cpp-0.6.2.ebuild 901 SHA256 7b70e528f2b67b5d566843cdbaf7bccfb50668bfb5b7260c4a7bfda27088598d SHA512 562ffa3c2fe1f5aff2f7e3058f1280457e6f1480c6f97c1d7fb1d576327fd42390321cd4984c377d3736492fc808fdedafed8cac374d2422d4f8bcc4643b5c33 WHIRLPOOL be5a815fa6e1745e4e4c2cb551eb9cc79d2642367a39dd6a668ebf70abb7ff2677d40e850c72487b76f9db320669d88bd034f5986b7f54944f793a4aa3737c9f
diff --git a/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-CVE-2017-5950.patch b/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-CVE-2017-5950.patch
new file mode 100644
index 0000000..2892108
--- /dev/null
+++ b/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-CVE-2017-5950.patch
@@ -0,0 +1,45 @@
+From d540476e31b080aa1f903ad20ec0426dd3838be7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@debian.org>
+Date: Tue, 25 Apr 2017 20:10:20 -0400
+Subject: [PATCH] fix stack overflow in HandleNode() (CVE-2017-5950)
+
+simply set a hardcoded recursion limit to 2000 (inspired by Python's)
+to avoid infinitely recursing into arbitrary data structures
+
+assert() the depth. unsure if this is the right approach, but given
+that HandleNode() is "void", I am not sure how else to return an
+error. the problem with this approach of course is that it will still
+crash the caller, unless they have proper exception handling in place.
+
+Closes: #459
+---
+ src/singledocparser.cpp | 2 ++
+ src/singledocparser.h   | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/src/singledocparser.cpp b/src/singledocparser.cpp
+index a27c1c3b..1b4262ee 100644
+--- a/src/singledocparser.cpp
++++ b/src/singledocparser.cpp
+@@ -46,6 +46,8 @@ void SingleDocParser::HandleDocument(EventHandler& eventHandler) {
+ }
+ 
+ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
++  assert(depth < depth_limit);
++  depth++;
+   // an empty node *is* a possibility
+   if (m_scanner.empty()) {
+     eventHandler.OnNull(m_scanner.mark(), NullAnchor);
+diff --git a/src/singledocparser.h b/src/singledocparser.h
+index 2b92067c..7046f1e2 100644
+--- a/src/singledocparser.h
++++ b/src/singledocparser.h
+@@ -51,6 +51,8 @@ class SingleDocParser : private noncopyable {
+   anchor_t LookupAnchor(const Mark& mark, const std::string& name) const;
+ 
+  private:
++  int depth = 0;
++  int depth_limit = 2000;
+   Scanner& m_scanner;
+   const Directives& m_directives;
+   std::unique_ptr<CollectionStack> m_pCollectionStack;
diff --git a/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-unbundle-gtest.patch b/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-unbundle-gtest.patch
new file mode 100644
index 0000000..671bde3
--- /dev/null
+++ b/dev-cpp/yaml-cpp/files/yaml-cpp-0.6.2-unbundle-gtest.patch
@@ -0,0 +1,70 @@
+From 259f944bc3e45420f5891737101260f07ab3030a Mon Sep 17 00:00:00 2001
+From: "Azamat H. Hackimov" <azamat.hackimov@gmail.com>
+Date: Tue, 27 Feb 2018 14:17:49 +0500
+Subject: [PATCH] Externalize googletest project
+
+Externalize gtest to avoid installation, fixes #539.
+---
+ test/CMakeLists.txt | 35 ++++++++++++++++++++++++++---------
+ 1 file changed, 26 insertions(+), 9 deletions(-)
+
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 3633da5..7b39dd4 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -1,16 +1,27 @@
++include(ExternalProject)
++
++ExternalProject_Add(
++	googletest_project
++	SOURCE_DIR "${CMAKE_SOURCE_DIR}/test/gtest-1.8.0"
++	INSTALL_DIR "${CMAKE_BINARY_DIR}/prefix"
++	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DBUILD_GMOCK=ON
++)
++
++add_library(gmock UNKNOWN IMPORTED)
++set_target_properties(gmock PROPERTIES
++	IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/prefix/lib/libgmock.a
++)
++
++find_package(Threads)
++
++include_directories(SYSTEM "${PROJECT_BINARY_DIR}/prefix/include")
++
+ set(gtest_force_shared_crt ${MSVC_SHARED_RT} CACHE BOOL
+   "Use shared (DLL) run-time lib even when Google Test built as a static lib.")
+-add_subdirectory(gtest-1.8.0)
+-include_directories(SYSTEM gtest-1.8.0/googlemock/include)
+-include_directories(SYSTEM gtest-1.8.0/googletest/include)
+-
+-if(WIN32 AND BUILD_SHARED_LIBS)
+-  add_definitions("-DGTEST_LINKED_AS_SHARED_LIBRARY")
+-endif()
+ 
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
+    CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+-  set(yaml_test_flags "-Wno-variadic-macros -Wno-sign-compare")
++	set(yaml_test_flags "-Wno-variadic-macros -Wno-sign-compare")
+ 
+   if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+     set(yaml_test_flags "${yaml_test_flags} -Wno-c99-extensions")
+@@ -36,9 +47,15 @@ add_executable(run-tests
+ 	${test_sources}
+ 	${test_headers}
+ )
++
++add_dependencies(run-tests googletest_project)
++
+ set_target_properties(run-tests PROPERTIES
+   COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags} ${yaml_test_flags}"
+ )
+-target_link_libraries(run-tests yaml-cpp gmock)
++target_link_libraries(run-tests
++	yaml-cpp
++	gmock
++	${CMAKE_THREAD_LIBS_INIT})
+ 
+ add_test(yaml-test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/run-tests)
+-- 
+2.16.1
+
diff --git a/dev-cpp/yaml-cpp/yaml-cpp-0.6.2.ebuild b/dev-cpp/yaml-cpp/yaml-cpp-0.6.2.ebuild
new file mode 100644
index 0000000..ea71d30
--- /dev/null
+++ b/dev-cpp/yaml-cpp/yaml-cpp-0.6.2.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit cmake-multilib
+
+DESCRIPTION="YAML parser and emitter in C++"
+HOMEPAGE="https://github.com/jbeder/yaml-cpp"
+SRC_URI="https://github.com/jbeder/${PN}/archive/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/0.6"
+KEYWORDS="amd64 ~arm ~arm64 ~hppa ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux"
+IUSE="test"
+
+DEPEND="test? ( dev-cpp/gtest )"
+
+S="${WORKDIR}/${PN}-${P}"
+
+PATCHES=(
+	"${FILESDIR}/${P}-CVE-2017-5950.patch"
+	"${FILESDIR}/${P}-unbundle-gtest.patch"
+)
+
+src_prepare() {
+	sed -i \
+		-e 's:INCLUDE_INSTALL_ROOT_DIR:INCLUDE_INSTALL_DIR:g' \
+		yaml-cpp.pc.cmake || die
+
+	cmake-utils_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DBUILD_SHARED_LIBS=ON
+		-DYAML_CPP_BUILD_TOOLS=OFF # Don't have install rule
+		-DYAML_CPP_BUILD_TESTS=$(usex test)
+	)
+	cmake-multilib_src_configure
+}
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
new file mode 100644
index 0000000..8caf904
--- /dev/null
+++ b/dev-db/mysql/Manifest
@@ -0,0 +1,6 @@
+AUX my.cnf-5.7 138 SHA256 d58cb51c3f2e171927b38aa9e4f89dd41fd2d5970cdd676701b6a342c63ea22a SHA512 1d7250689005c948f4a849959baf33f5f0fda099f230611651919ed053fb563daa19d996b7ca6714e224174172fb504f4d7d08e9d449a7e1203e32cf3fdec782 WHIRLPOOL 10bca8f4727d2ea0f3ecb45a58fab2ca2b1d18931c1c8b00626d24b65c650211fd635252b91c27e97c22c6580b6c4dae383ad4bea7737b05146dea7b20cc3a0e
+AUX my.cnf.distro-client 631 SHA256 194ffb775b541c59f907c0503d748325c846d5086fd26648ddfffa7062b3d6b7 SHA512 f40539a56afe79b7c0dff14de46690fd67e8350755b27fbb490d914001c01836cdf9f851aa461bd8b60943ef2ca084b70e48d995f5c18bcc241309f3473c610c WHIRLPOOL f8cd465c1d1e48532a62e67aba2f24f202bab2c98da5a243f9c22934edf53afc97ada6750ca5734ec66520b187bf7f725221635fcd9ace1d8c98dfc3b440e3d7
+AUX my.cnf.distro-server 994 SHA256 f8ddc0d14e4164071d4a75e7de0cab0fe3b1193d2d6ae4a7d7671285fa112094 SHA512 cf172edc23d3dda49c21af6b8adef8aa13694d8ceecddf1d612d4ae34d00ba53c51ae4ae7ca4d11083eeacb5d862f59a855a9d80e9e448ab8bbf17f42aac2650 WHIRLPOOL ac4e599b7b6eb53c6b2a7246c3f37147c9f6e58f96c06d1b8d17ecd4fea46f5e8a5c3da1530f45c2f26e084a0195804870eec389c74e7c725c316d4c9cfc3dc8
+DIST mysql-boost-5.7.23.tar.gz 49025014 SHA256 d05700ec5c1c6dae9311059dc1713206c29597f09dbd237bf0679b3c6438e87a SHA512 e4317f89d108a68652cd95e41ffd670c37b6663aabd6af3985d18052fb7e8d8879b5822399caf9091cecc0a949ec588c121c87cfd60d69941f68d0ecbedd0953 WHIRLPOOL a9f3b8db00c335cd5925c1697ddd59b8717ef51bfc44e6f07fb44470e6d5e25bc410a653cea4d7a5eab045ea43b0aca6e47c04d70a1ee2a1c4260cb05a00a2ee
+DIST mysql-extras-20180804-2323Z.tar.bz2 322215 SHA256 fa962215d2dba8f781f25351a1f8f70c79d4ab92eef438ec14824aadf12a9b34 SHA512 efd9d416f394cc61b977ab76f05ab3acc5803ff8bdee8e1dbc65cc5b3f07e4f9742140d9586c028908b10fcc44f21c98ebffdebcc5c3578acbe05b07526bcb3d WHIRLPOOL 175407174870609128c502a9843d2c3f3f40acdd24d3263bbe98b30d6b0586821f642ba57c0519ae5e795a883bf7eb736a4da6de5a6590407a3db560105d5140
+EBUILD mysql-5.7.23.ebuild 27020 SHA256 0e892fd71eb30f9ed06a8682eaf9af3602a5755bd11c816a64f49b9a287978c6 SHA512 f1284dc26df2fee22d8f3dcdcbe3a0c34da350849fa99fcd30e661310eb51dc09ad18cdf2b65d2527d91a9bc37f96f6553b9c3994f8110b4f134bd8656711430 WHIRLPOOL 09a844b65b8c6ae529d5c61739f71a0d9fce1b6442e5f5800f7c6c8b5d7ad730a2a590d49a6a077dbf4e340e00bfcc3190d19548786d725f82d1f91200975037
diff --git a/dev-db/mysql/files/my.cnf-5.7 b/dev-db/mysql/files/my.cnf-5.7
new file mode 100644
index 0000000..571ebf0
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf-5.7
@@ -0,0 +1,3 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file.
+
+!includedir @GENTOO_PORTAGE_EPREFIX@/etc/mysql/mysql.d
diff --git a/dev-db/mysql/files/my.cnf.distro-client b/dev-db/mysql/files/my.cnf.distro-client
new file mode 100644
index 0000000..8bf1836
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf.distro-client
@@ -0,0 +1,21 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-client.cnf: The global mysql configuration file.
+
+# The following options will be passed to all MySQL clients
+[client]
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+character-sets-dir				= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+default-character-set=utf8
+
+[mysql]
+# uncomment the next directive if you are not familiar with SQL
+#safe-updates
+
+[mysqldump]
+quick
+max_allowed_packet			= 16M
+
+[myisamchk]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+
+[myisampack]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
diff --git a/dev-db/mysql/files/my.cnf.distro-server b/dev-db/mysql/files/my.cnf.distro-server
new file mode 100644
index 0000000..d4ed30c
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf.distro-server
@@ -0,0 +1,28 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-server.cnf: The global mysql configuration file.
+
+# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
+[mysqld]
+character-set-server				= utf8
+user						= mysql
+port						= 3306
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+pid-file					= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysql.pid
+log-error					= @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
+basedir						= @GENTOO_PORTAGE_EPREFIX@/usr
+datadir						= @DATADIR@
+skip-external-locking
+lc_messages_dir					= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
+#Set this to your desired error message language
+lc_messages					= en_US
+
+# security:
+# using "localhost" in connects uses sockets by default
+# skip-networking
+bind-address					= 127.0.0.1
+
+log-bin
+server-id					= 1
+
+# point the following paths to different dedicated disks
+tmpdir						= @GENTOO_PORTAGE_EPREFIX@/tmp/
+#log-update					= @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname
diff --git a/dev-db/mysql/mysql-5.7.23.ebuild b/dev-db/mysql/mysql-5.7.23.ebuild
new file mode 100644
index 0000000..aad033f
--- /dev/null
+++ b/dev-db/mysql/mysql-5.7.23.ebuild
@@ -0,0 +1,845 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+MY_EXTRAS_VER="20180804-2323Z"
+
+CMAKE_MAKEFILE_GENERATOR=emake
+
+# Keeping eutils in EAPI=6 for emktemp in pkg_config
+
+inherit eutils flag-o-matic prefix toolchain-funcs \
+	user cmake-utils multilib-minimal
+
+SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz
+	https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz
+	http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz"
+
+# Gentoo patches to MySQL
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
+	SRC_URI="${SRC_URI}
+		mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
+fi
+
+HOMEPAGE="https://www.mysql.com/"
+DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
+LICENSE="GPL-2"
+SLOT="0/18"
+IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux
+	+server static static-libs systemtap tcmalloc test yassl"
+
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
+RESTRICT="libressl? ( test )"
+
+REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
+	EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
+	EGIT_CLONE_TYPE=shallow
+	MY_PATCH_DIR="${WORKDIR}/mysql-extras"
+else
+	MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
+fi
+
+PATCHES=(
+	"${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
+	"${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
+#	"${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.7.6.patch
+	"${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
+	"${MY_PATCH_DIR}"/20018_all_mysql-5.7.21-without-clientlibs-tools.patch
+)
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+# MULTILIB_USEDEP only set for libraries used by the client library
+COMMON_DEPEND="
+	kernel_linux? (
+		sys-process/procps:0=
+		dev-libs/libaio:0=
+	)
+	net-misc/curl
+	>=sys-apps/sed-4
+	>=sys-apps/texinfo-4.7-r1
+	jemalloc? ( dev-libs/jemalloc:0= )
+	tcmalloc? ( dev-util/google-perftools:0= )
+	systemtap? ( >=dev-util/systemtap-1.3:0= )
+	!yassl? (
+		client-libs? (
+			!libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
+			libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
+		)
+		!client-libs? (
+			!libressl? ( >=dev-libs/openssl-1.0.0:0= )
+			libressl? ( dev-libs/libressl:0= )
+		)
+	)
+	client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
+	!client-libs? ( >=sys-libs/zlib-1.2.3:0= )
+	sys-libs/ncurses:0=
+	server? (
+		>=app-arch/lz4-0_p131:=
+		>=dev-libs/boost-1.65.0:=
+		numa? ( sys-process/numactl )
+	)
+	!client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
+"
+DEPEND="virtual/yacc
+	dev-libs/protobuf
+	static? ( sys-libs/ncurses[static-libs] )
+	|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
+	${COMMON_DEPEND}"
+RDEPEND="selinux? ( sec-policy/selinux-mysql )
+	client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c dev-libs/protobuf:= )
+	!dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
+	server? ( !prefix? ( dev-db/mysql-init-scripts ) )
+	${COMMON_DEPEND}
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+pkg_setup() {
+	if [[ ${MERGE_TYPE} != binary ]] ; then
+		local GCC_MAJOR_SET=$(gcc-major-version)
+		local GCC_MINOR_SET=$(gcc-minor-version)
+		# Bug 565584.  InnoDB now requires atomic functions introduced with gcc-4.7 on
+		# non x86{,_64} arches
+		if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
+			${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
+			eerror "${PN} needs to be built with gcc-4.7 or later."
+			eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+			die
+		fi
+	fi
+	if has test ${FEATURES} && \
+		use server && ! has userpriv ${FEATURES} ; then
+			eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+	fi
+
+	# This should come after all of the die statements
+	enewgroup mysql 60 || die "problem adding 'mysql' group"
+	enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
+}
+
+pkg_preinst() {
+	# Here we need to see if the implementation switched client libraries
+	# We check if this is a new instance of the package and a client library already exists
+	local SHOW_ABI_MESSAGE libpath
+	if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
+		libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
+		elog "Due to ABI changes when switching between different client libraries,"
+		elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
+		elog "Please run: revdep-rebuild --library ${libpath}"
+		ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
+	fi
+}
+
+pkg_postinst() {
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Create log directory securely if it does not exist
+	[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
+
+	if use server ; then
+		if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+			einfo
+			elog "You might want to run:"
+			elog "\"emerge --config =${CATEGORY}/${PF}\""
+			elog "if this is a new install."
+			elog
+			elog "If you are switching server implentations, you should run the"
+			elog "mysql_upgrade tool."
+			einfo
+		else
+			einfo
+			elog "If you are upgrading major versions, you should run the"
+			elog "mysql_upgrade tool."
+			einfo
+		fi
+	fi
+
+	# Note about configuration change
+	einfo
+	elog "This version of mysql reorganizes the configuration from a single my.cnf"
+	elog "to several files in /etc/mysql/${PN}.d."
+	elog "Please backup any changes you made to /etc/mysql/my.cnf"
+	elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+	elog "You may have as many files as needed and they are read alphabetically."
+	elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
+	einfo
+}
+
+src_unpack() {
+	unpack ${A}
+	# Grab the patches
+	[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
+
+	mv -f "${WORKDIR}/${P}" "${S}" || die
+}
+
+src_prepare() {
+	if use jemalloc ; then
+		echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
+	fi
+	if use tcmalloc; then
+		echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
+	fi
+	# Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
+	if [[ -d "${S}/support-files/SELinux" ]] ; then
+		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
+	fi
+
+	if use libressl ; then
+		sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
+			"${S}/cmake/ssl.cmake" || die
+	fi
+
+	sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
+
+	cmake-utils_src_prepare
+}
+
+src_configure(){
+	# bug 508724 mariadb cannot use ld.gold
+	tc-ld-disable-gold
+	# Bug #114895, bug #110149
+	filter-flags "-O" "-O[01]"
+
+	append-cxxflags -felide-constructors
+
+	# bug #283926, with GCC4.4, this is required to get correct behavior.
+	append-flags -fno-strict-aliasing
+
+	if use client-libs ; then
+		multilib-minimal_src_configure
+	else
+		multilib_src_configure
+	fi
+}
+
+multilib_src_configure() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if ! multilib_is_native_abi && ! use client-libs ; then
+		return
+	fi
+
+	CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+	# debug hack wrt #497532
+	mycmakeargs=(
+		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+		-DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+		-DSYSCONFDIR="${EPREFIX}/etc/mysql"
+		-DINSTALL_BINDIR=bin
+		-DINSTALL_DOCDIR=share/doc/${PF}
+		-DINSTALL_DOCREADMEDIR=share/doc/${PF}
+		-DINSTALL_INCLUDEDIR=include/mysql
+		-DINSTALL_INFODIR=share/info
+		-DINSTALL_LIBDIR=$(get_libdir)
+		-DINSTALL_MANDIR=share/man
+		-DINSTALL_MYSQLSHAREDIR=share/mysql
+		-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
+		-DINSTALL_SCRIPTDIR=share/mysql/scripts
+		-DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+		-DINSTALL_SBINDIR=sbin
+		-DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
+		-DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
+		-DWITH_UNIT_TESTS=$(usex test ON OFF)
+		### TODO: make this system but issues with UTF-8 prevent it
+		-DWITH_EDITLINE=bundled
+		-DWITH_ZLIB=system
+		-DWITH_LIBWRAP=0
+		-DENABLED_LOCAL_INFILE=1
+		-DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+		-DWITH_DEFAULT_COMPILER_OPTIONS=0
+		-DWITH_DEFAULT_FEATURE_SET=0
+		# The build forces this to be defined when cross-compiling.  We pass it
+		# all the time for simplicity and to make sure it is actually correct.
+		-DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+		-DWITH_RAPID=OFF
+		-DWITH_LIBEVENT=NO
+		-DWITH_CURL=system
+		-DWITH_BOOST="${S}/boost"
+		-DWITH_PROTOBUF=system
+	)
+	if use test ; then
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
+	else
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+	fi
+
+	if ! use yassl ; then
+		mycmakeargs+=( -DWITH_SSL=system )
+	else
+		mycmakeargs+=( -DWITH_SSL=bundled )
+	fi
+
+	if ! use client-libs ; then
+		mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
+	fi
+
+	# bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+	# systemtap only works on native ABI  bug 530132
+	if multilib_is_native_abi; then
+		mycmakeargs+=(
+			-DENABLE_DTRACE=$(usex systemtap)
+		)
+	else
+		mycmakeargs+=(
+			-DWITHOUT_TOOLS=1
+			-DWITH_READLINE=1
+			-DENABLE_DTRACE=0
+		)
+	fi
+
+	if multilib_is_native_abi && use server ; then
+
+		mycmakeargs+=(
+			-DWITH_LZ4=system
+			-DWITH_NUMA=$(usex numa ON OFF)
+		)
+
+		if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+			ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+			ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+			ewarn "You MUST file bugs without these variables set."
+
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+				-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+			)
+
+		elif ! use latin1 ; then
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=utf8
+				-DDEFAULT_COLLATION=utf8_general_ci
+			)
+		else
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=latin1
+				-DDEFAULT_COLLATION=latin1_swedish_ci
+			)
+		fi
+		mycmakeargs+=(
+			-DEXTRA_CHARSETS=all
+			-DDISABLE_SHARED=$(usex static YES NO)
+			-DWITH_DEBUG=$(usex debug)
+			-DWITH_EMBEDDED_SERVER=OFF
+			-DENABLED_PROFILING=$(usex profiling)
+		)
+
+		if use static; then
+			mycmakeargs+=( -DWITH_PIC=1 )
+		fi
+
+		# Storage engines
+		mycmakeargs+=(
+			-DWITH_EXAMPLE_STORAGE_ENGINE=0
+			-DWITH_ARCHIVE_STORAGE_ENGINE=1
+			-DWITH_BLACKHOLE_STORAGE_ENGINE=1
+			-DWITH_CSV_STORAGE_ENGINE=1
+			-DWITH_HEAP_STORAGE_ENGINE=1
+			-DWITH_INNOBASE_STORAGE_ENGINE=1
+			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
+			-DWITH_MYISAM_STORAGE_ENGINE=1
+			-DWITH_PARTITION_STORAGE_ENGINE=1
+			-DWITH_INNODB_MEMCACHED=0
+		)
+
+	else
+		mycmakeargs+=(
+			-DWITHOUT_SERVER=1
+			-DWITH_EMBEDDED_SERVER=OFF
+			-DEXTRA_CHARSETS=none
+		)
+	fi
+
+	cmake-utils_src_configure
+}
+
+src_compile() {
+	if use client-libs ; then
+		multilib-minimal_src_compile
+	else
+		multilib_src_compile
+	fi
+}
+
+multilib_src_compile() {
+	cmake-utils_src_compile
+}
+
+src_install() {
+	local MULTILIB_WRAPPED_HEADERS
+	local MULTILIB_CHOST_TOOLS
+	if use client-libs ; then
+		# headers with ABI specific data
+		MULTILIB_WRAPPED_HEADERS=(
+			/usr/include/mysql/server/my_config.h
+			/usr/include/mysql/server/mysql_version.h )
+
+		# wrap the config scripts
+		MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
+		multilib-minimal_src_install
+	else
+		multilib_src_install
+		multilib_src_install_all
+	fi
+}
+
+# Intentionally override eclass function
+multilib_src_install() {
+
+	cmake-utils_src_install
+
+	# Kill old libmysqclient_r symlinks if they exist.  Time to fix what depends on them.
+	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
+}
+
+multilib_src_install_all() {
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Convenience links
+	einfo "Making Convenience links for mysqlcheck multi-call binary"
+	dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+	dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+	dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+	# INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+	if [[ -d "${ED}/usr/data" ]] ; then
+		rm -Rf "${ED}/usr/data" || die
+	fi
+
+	# Unless they explicitly specific USE=test, then do not install the
+	# testsuite. It DOES have a use to be installed, esp. when you want to do a
+	# validation of your database configuration after tuning it.
+	if ! use test ; then
+		rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+	fi
+
+	# Configuration stuff
+	einfo "Building default configuration ..."
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+	[[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+	cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
+	eprefixify "${TMPDIR}/my.cnf"
+	doins "${TMPDIR}/my.cnf"
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
+	cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+	eprefixify "${TMPDIR}/50-distro-client.cnf"
+	doins "${TMPDIR}/50-distro-client.cnf"
+
+	if use server ; then
+		mycnf_src="my.cnf.distro-server"
+		sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+			"${FILESDIR}/${mycnf_src}" \
+			> "${TMPDIR}/my.cnf.ok" || die
+		if use prefix ; then
+			sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+				"${TMPDIR}/my.cnf.ok" || die
+		fi
+		if use latin1 ; then
+			sed -i \
+				-e "/character-set/s|utf8|latin1|g" \
+				"${TMPDIR}/my.cnf.ok" || die
+		fi
+		eprefixify "${TMPDIR}/my.cnf.ok"
+		newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+		einfo "Including support files and sample configurations"
+		docinto "support-files"
+		local script
+		for script in \
+			"${S}"/support-files/magic
+		do
+			[[ -f "$script" ]] && dodoc "${script}"
+		done
+
+		docinto "scripts"
+		for script in "${S}"/scripts/mysql* ; do
+			[[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+		done
+	fi
+
+	#Remove mytop if perl is not selected
+	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
+}
+
+# Official test instructions:
+# USE='perl server' \
+# FEATURES='test userpriv -usersandbox' \
+# ebuild mysql-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+
+	_disable_test() {
+		local rawtestname reason
+		rawtestname="${1}" ; shift
+		reason="${@}"
+		ewarn "test '${rawtestname}' disabled: '${reason}'"
+		echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
+	}
+
+	local TESTDIR="${BUILD_DIR}/mysql-test"
+	local retstatus_unit
+	local retstatus_tests
+
+	if ! use server ; then
+		einfo "Skipping server tests due to minimal build."
+		return 0
+	fi
+
+	# Bug #213475 - MySQL _will_ object strenously if your machine is named
+	# localhost. Also causes weird failures.
+	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+	if [[ $UID -eq 0 ]]; then
+		die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+	fi
+	has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
+
+	einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+	# Run CTest (test-units)
+	cmake-utils_src_test
+	retstatus_unit=$?
+
+	# Ensure that parallel runs don't die
+	export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+	# Enable parallel testing, auto will try to detect number of cores
+	# You may set this by hand.
+	# The default maximum is 8 unless MTR_MAX_PARALLEL is increased
+	export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
+
+	# create directories because mysqladmin might run out of order
+	mkdir -p "${T}"/var-tests{,/log} || die
+
+	# Run mysql tests
+	pushd "${TESTDIR}" > /dev/null || die
+
+	touch "${T}/disabled.def"
+	# These are failing in MySQL 5.7 for now and are believed to be
+	# false positives:
+	#
+	local t
+
+	for t in auth_sec.keyring_udf federated.federated_plugin ; do
+			_disable_test  "$t" "False positives in Gentoo"
+	done
+
+	# run mysql-test tests
+	perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
+	retstatus_tests=$?
+
+	popd > /dev/null || die
+
+	# Cleanup is important for these testcases.
+	pkill -9 -f "${S}/ndb" 2>/dev/null
+	pkill -9 -f "${S}/sql" 2>/dev/null
+
+	local failures=""
+	[[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
+	[[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
+
+	[[ -z "$failures" ]] || die "Test failures: $failures"
+	einfo "Tests successfully completed"
+}
+
+mysql_init_vars() {
+	MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX%/}/usr/share/mysql"}
+	MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX%/}/etc/mysql"}
+	MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX%/}/var/lib/mysql"}
+	MY_LOGDIR=${MY_LOGDIR="${EPREFIX%/}/var/log/mysql"}
+
+	if [[ -z "${MY_DATADIR}" ]] ; then
+		MY_DATADIR=""
+		if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+			MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
+				| sed -ne '/datadir/s|^--datadir=||p' \
+				| tail -n1`
+			if [[ -z "${MY_DATADIR}" ]] ; then
+				MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+				| sed -e 's/.*=\s*//' \
+				| tail -n1`
+			fi
+		fi
+		if [[ -z "${MY_DATADIR}" ]] ; then
+			MY_DATADIR="${MY_LOCALSTATEDIR}"
+			einfo "Using default MY_DATADIR"
+		fi
+		elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+		if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+			if [[ -e "${MY_DATADIR}" ]] ; then
+				# If you get this and you're wondering about it, see bug #207636
+				elog "MySQL datadir found in ${MY_DATADIR}"
+				elog "A new one will not be created."
+				PREVIOUS_DATADIR="yes"
+			else
+				PREVIOUS_DATADIR="no"
+			fi
+			export PREVIOUS_DATADIR
+		fi
+	else
+		if [[ ${EBUILD_PHASE} == "config" ]]; then
+			local new_MY_DATADIR
+			new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
+				| sed -ne '/datadir/s|^--datadir=||p' \
+				| tail -n1`
+
+			if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+				ewarn "MySQL MY_DATADIR has changed"
+				ewarn "from ${MY_DATADIR}"
+				ewarn "to ${new_MY_DATADIR}"
+				MY_DATADIR="${new_MY_DATADIR}"
+			fi
+		fi
+	fi
+
+	export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+	export MY_LOCALSTATEDIR MY_LOGDIR
+	export MY_DATADIR
+}
+
+pkg_config() {
+	_getoptval() {
+		local mypd="${EROOT%/}"/usr/bin/my_print_defaults
+		local section="$1"
+		local flag="--${2}="
+		local extra_options="${3}"
+		"${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
+	}
+	local old_MY_DATADIR="${MY_DATADIR}"
+	local old_HOME="${HOME}"
+	# my_print_defaults needs to read stuff in $HOME/.my.cnf
+	export HOME=${EPREFIX%/}/root
+
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	[[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
+	if [[ ! -x "${EROOT%/}/usr/sbin/mysqld" ]] ; then
+		die "Minimal builds do NOT include the MySQL server"
+	fi
+
+	if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
+		local MY_DATADIR_s="${ROOT%/}/${MY_DATADIR}"
+		MY_DATADIR_s="${MY_DATADIR_s%%/}"
+		local old_MY_DATADIR_s="${ROOT%/}/${old_MY_DATADIR}"
+		old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
+
+		if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
+			if [[ -d "${MY_DATADIR_s}" ]]; then
+				ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
+				ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
+			else
+				elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
+				mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
+				|| die "Moving MY_DATADIR failed"
+			fi
+		else
+			ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
+			if [[ -d "${MY_DATADIR_s}" ]]; then
+				ewarn "Attempting to use ${MY_DATADIR_s}"
+			else
+				eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
+				die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
+			fi
+		fi
+	fi
+
+	local pwd1="a"
+	local pwd2="b"
+	local maxtry=15
+
+	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
+		local tmp_mysqld_password_source=
+
+		for tmp_mysqld_password_source in mysql client; do
+			einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+			if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
+				if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
+					ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+					MYSQL_ROOT_PASSWORD=
+					continue
+				fi
+
+				einfo "Found password in '${tmp_mysqld_password_source}' section!"
+				break
+			fi
+		done
+
+		# Sometimes --show is required to display passwords in some implementations of my_print_defaults
+		if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+		fi
+
+		unset tmp_mysqld_password_source
+	fi
+	MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
+	# These are dir+prefix
+	MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
+	MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+	MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
+	MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+
+	if [[ ! -d "${EROOT%/}/$MYSQL_TMPDIR" ]]; then
+		einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
+		install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_TMPDIR"
+	fi
+	if [[ ! -d "${EROOT%/}/$MYSQL_LOG_BIN" ]]; then
+		einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
+		install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_LOG_BIN"
+	fi
+	if [[ ! -d "${EROOT%/}/$MYSQL_RELAY_LOG" ]]; then
+		einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
+		install -d -m 770 -o mysql -g mysql "${EROOT%/}/$MYSQL_RELAY_LOG"
+	fi
+
+	if [[ -d "${ROOT%/}/${MY_DATADIR}/mysql" ]] ; then
+		ewarn "You have already a MySQL database in place."
+		ewarn "(${ROOT%/}/${MY_DATADIR}/*)"
+		ewarn "Please rename or delete it if you wish to replace it."
+		die "MySQL database already exists!"
+	fi
+
+	# Bug #213475 - MySQL _will_ object strenously if your machine is named
+	# localhost. Also causes weird failures.
+	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
+
+		einfo "Please provide a password for the mysql 'root' user now"
+		einfo "or through the ${HOME}/.my.cnf file."
+		ewarn "Avoid [\"'\\_%] characters in the password"
+		read -rsp "    >" pwd1 ; echo
+
+		einfo "Retype the password"
+		read -rsp "    >" pwd2 ; echo
+
+		if [[ "x$pwd1" != "x$pwd2" ]] ; then
+			die "Passwords are not the same"
+		fi
+		MYSQL_ROOT_PASSWORD="${pwd1}"
+		unset pwd1 pwd2
+	fi
+
+	local options
+	local sqltmp="$(emktemp)"
+
+	# Fix bug 446200. Don't reference host my.cnf, needs to come first,
+	# see http://bugs.mysql.com/bug.php?id=31312
+	use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
+
+	# Figure out which options we need to disable to do the setup
+	local helpfile="${TMPDIR%/}/mysqld-help"
+	"${EROOT%/}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+	for opt in host-cache name-resolve networking slave-start \
+		federated ssl log-bin relay-log slow-query-log external-locking \
+		log-slave-updates \
+		; do
+		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+		egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
+	done
+
+	einfo "Creating the mysql database and setting proper permissions on it ..."
+
+	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
+	PID_DIR="${EROOT%/}/var/run/mysqld"
+	if [[ ! -d "${PID_DIR}" ]]; then
+		install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
+	fi
+
+	if [[ ! -d "${MY_DATADIR}" ]]; then
+		install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
+	fi
+
+	pushd "${TMPDIR}" &>/dev/null || die
+
+	# Filling timezones, see
+	# http://dev.mysql.com/doc/mysql/en/time-zone-support.html
+	echo "USE mysql;" >"${sqltmp}"
+	"${EROOT%/}/usr/bin/mysql_tzinfo_to_sql" "${EROOT%/}/usr/share/zoneinfo" >> "${sqltmp}" 2>/dev/null
+	chown mysql "${sqltmp}" || die
+
+	# --initialize-insecure will not set root password
+	# --initialize would set a random one in the log which we don't need as we set it ourselves
+	local cmd=( "${EROOT%/}/usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
+	cmd+=( "--basedir=${EPREFIX%/}/usr" ${options} "--datadir=${ROOT%/}${MY_DATADIR}" "--tmpdir=${ROOT%/}${MYSQL_TMPDIR}" )
+	einfo "Command: ${cmd[*]}"
+	su -s /bin/sh -c "${cmd[*]}" mysql \
+		>"${TMPDIR%/}"/mysql_install_db.log 2>&1
+	if [ $? -ne 0 ]; then
+		grep -B5 -A999 -i "ERROR" "${TMPDIR%/}"/mysql_install_db.log 1>&2
+		die "Failed to initialize mysqld. Please review ${EPREFIX%/}/var/log/mysql/mysqld.err AND ${TMPDIR%/}/mysql_install_db.log"
+	fi
+	popd &>/dev/null || die
+	[[ -f "${ROOT%/}/${MY_DATADIR}/mysql/user.frm" ]] \
+	|| die "MySQL databases not installed"
+
+	use prefix || options="${options} --user=mysql"
+
+	local socket="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.sock"
+	local pidfile="${EROOT%/}/var/run/mysqld/mysqld${RANDOM}.pid"
+	local mysqld="${EROOT%/}/usr/sbin/mysqld \
+		${options} \
+		$(use prefix || echo --user=mysql) \
+		--log-warnings=0 \
+		--basedir=${EROOT%/}/usr \
+		--datadir=${ROOT%/}/${MY_DATADIR} \
+		--max_allowed_packet=8M \
+		--net_buffer_length=16K \
+		--socket=${socket} \
+		--pid-file=${pidfile}
+		--tmpdir=${ROOT}/${MYSQL_TMPDIR}"
+	#einfo "About to start mysqld: ${mysqld}"
+	ebegin "Starting mysqld"
+	einfo "Command ${mysqld}"
+	${mysqld} &
+	rc=$?
+	while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
+		maxtry=$((${maxtry}-1))
+		echo -n "."
+		sleep 1
+	done
+	eend $rc
+
+	if ! [[ -S "${socket}" ]]; then
+		die "Completely failed to start up mysqld with: ${mysqld}"
+	fi
+
+	ebegin "Setting root password"
+	# Do this from memory, as we don't want clear text passwords in temp files
+	local sql="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_ROOT_PASSWORD}'"
+	"${EROOT%/}/usr/bin/mysql" \
+		--no-defaults \
+		"--socket=${socket}" \
+		-hlocalhost \
+		-e "${sql}"
+	eend $?
+
+	# Stop the server and cleanup
+	einfo "Stopping the server ..."
+	kill $(< "${pidfile}" )
+	rm -f "${sqltmp}"
+	wait %1
+	einfo "Done"
+}
diff --git a/dev-libs/boost/Manifest b/dev-libs/boost/Manifest
new file mode 100644
index 0000000..897721d
--- /dev/null
+++ b/dev-libs/boost/Manifest
@@ -0,0 +1,8 @@
+AUX boost-1.48.0-disable_icu_rpath.patch 1077 SHA512 013503fd16bcb609c624c9952a5448e612b81150db9ce60b5a51acbb57b62ce1cf0e7c5dd4a58c110ca7895c86effef24d8fe55ea3f316c9e47d5c549a33180c
+AUX boost-1.55.0-context-x32.patch 1077 SHA512 0e2e45abe5833396508666355e26bafe114fa4ada628b24d8d9953268edddcb2f8e3dcfe8bc7f27d6c1794418990dc9ef914c936dfa64ed6e5e647a40e3f8a73
+AUX boost-1.56.0-build-auto_index-tool.patch 412 SHA512 9fe245adddf76375d0ee8066952c46d229c9e37fdce83ff608fcc1fb5942b1c226a0fba6e28f859bbcd58863dc49a356f32c7fcc3b90baca4069c6bdc9c0f203
+AUX boost-1.63.0-fix-python.patch 4210 SHA512 0f390cae5a53f48f548e65149aaca4b1191ca6610863e7e471686556107c8ac398eb4bcad71a92849e941cad031cec9cbd543c646ee122238579ca881c420aad
+AUX boost-1.65.0-fix-python.patch 9210 SHA512 df2e8841b3415724b2920230da36e3e3aa610a5d7ee7dcada847cb4d6c921405ef4f0c034f96d1ac078d33bb3f32408b748cf7835f173b6e7692c76c6135e2f2
+AUX boost-1.67.0-fix-python.patch 6017 SHA512 bcd0c5fad2dc5ca4964f6b366fb5bb2d5e016b0d67480a3abebee03743d337c8514b580d610e9cbe215bd1602a6846963aeab7f04ac72cbc0ed146c7869b4f32
+DIST boost_1_65_0.tar.bz2 82597718 SHA512 7142650fb8d61e3ef16ba066fc918e087f19e9bc2ad1d6a11fb10bf0d6b1b5ad05ab032f076a5233a1624b3669e952b2cc38b7dc074bbf53018e2970ee90fcdd
+EBUILD boost-1.65.0.ebuild 12442 SHA512 e11e282a61f07cdfa1bd24d3032baacf064518f1fbd65c432d04ebf1e1f890879302f64e800cb005bda5c3cee015cf86c327fa546ef8f7bd7f937871f6129fef
diff --git a/dev-libs/boost/boost-1.65.0.ebuild b/dev-libs/boost/boost-1.65.0.ebuild
new file mode 100644
index 0000000..837f83b
--- /dev/null
+++ b/dev-libs/boost/boost-1.65.0.ebuild
@@ -0,0 +1,439 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
+
+inherit eutils flag-o-matic multiprocessing python-r1 toolchain-funcs versionator multilib-minimal
+
+MY_P="${PN}_$(replace_all_version_separators _)"
+MAJOR_V="$(get_version_component_range 1-2)"
+
+DESCRIPTION="Boost Libraries for C++"
+HOMEPAGE="https://www.boost.org/"
+SRC_URI="https://downloads.sourceforge.net/project/boost/${PN}/${PV}/${MY_P}.tar.bz2"
+
+LICENSE="Boost-1.0"
+SLOT="0/${PV}" # ${PV} instead ${MAJOR_V} due to bug 486122
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris ~x86-winnt"
+
+IUSE="context debug doc icu +nls mpi python static-libs +threads tools"
+
+RDEPEND="icu? ( >=dev-libs/icu-3.6:=[${MULTILIB_USEDEP}] )
+	!icu? ( virtual/libiconv[${MULTILIB_USEDEP}] )
+	mpi? ( >=virtual/mpi-2.0-r4[${MULTILIB_USEDEP},cxx,threads] )
+	python? ( ${PYTHON_DEPS} )
+	app-arch/bzip2[${MULTILIB_USEDEP}]
+	sys-libs/zlib[${MULTILIB_USEDEP}]
+	!app-admin/eselect-boost"
+DEPEND="${RDEPEND}
+	=dev-util/boost-build-${MAJOR_V}*"
+REQUIRED_USE="
+	mpi? ( threads )
+	python? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/${MY_P}"
+
+# the tests will never fail because these are not intended as sanity
+# tests at all. They are more a way for upstream to check their own code
+# on new compilers. Since they would either be completely unreliable
+# (failing for no good reason) or completely useless (never failing)
+# there is no point in having them in the ebuild to begin with.
+RESTRICT="test"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-1.48.0-disable_icu_rpath.patch"
+	"${FILESDIR}/${PN}-1.55.0-context-x32.patch"
+	"${FILESDIR}/${PN}-1.56.0-build-auto_index-tool.patch"
+	"${FILESDIR}/${PN}-1.65.0-fix-python.patch"
+)
+
+python_bindings_needed() {
+	multilib_is_native_abi && use python
+}
+
+tools_needed() {
+	multilib_is_native_abi && use tools
+}
+
+create_user-config.jam() {
+	local compiler compiler_version compiler_executable
+
+	if [[ ${CHOST} == *-darwin* ]]; then
+		compiler="darwin"
+		compiler_version="$(gcc-fullversion)"
+		compiler_executable="$(tc-getCXX)"
+	else
+		compiler="gcc"
+		compiler_version="$(gcc-version)"
+		compiler_executable="$(tc-getCXX)"
+	fi
+	local mpi_configuration python_configuration
+
+	if use mpi; then
+		mpi_configuration="using mpi ;"
+	fi
+
+	if python_bindings_needed; then
+		# boost expects libpython$(pyver) and doesn't allow overrides
+		# and the build system is so creepy that it's easier just to
+		# provide a symlink (linker's going to use SONAME anyway)
+		# TODO: replace it with proper override one day
+		ln -f -s "$(python_get_library_path)" "${T}/lib${EPYTHON}$(get_libname)" || die
+
+		if tc-is-cross-compiler; then
+			python_configuration="using python : ${EPYTHON#python} : : ${SYSROOT:-${EROOT}}/usr/include/${EPYTHON} : ${SYSROOT:-${EROOT}}/usr/$(get_libdir) ;"
+		else
+			# note: we need to provide version explicitly because of
+			# a bug in the build system:
+			# https://github.com/boostorg/build/pull/104
+			python_configuration="using python : ${EPYTHON#python} : ${PYTHON} : $(python_get_includedir) : ${T} ;"
+		fi
+	fi
+
+	cat > "${BOOST_ROOT}/user-config.jam" << __EOF__ || die
+using ${compiler} : ${compiler_version} : ${compiler_executable} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;
+${mpi_configuration}
+${python_configuration}
+__EOF__
+}
+
+pkg_setup() {
+	# Bail out on unsupported build configuration, bug #456792
+	if [[ -f "${EROOT%/}/etc/site-config.jam" ]]; then
+		grep -q gentoorelease "${EROOT%/}/etc/site-config.jam" && grep -q gentoodebug "${EROOT%/}/etc/site-config.jam" ||
+		(
+			eerror "You are using custom ${EROOT%/}/etc/site-config.jam without defined gentoorelease/gentoodebug targets."
+			eerror "Boost can not be built in such configuration."
+			eerror "Please, either remove this file or add targets from ${EROOT%/}/usr/share/boost-build/site-config.jam to it."
+			die
+		)
+	fi
+}
+
+src_prepare() {
+	default
+
+	# Do not try to build missing 'wave' tool, bug #522682
+	# Upstream bugreport - https://svn.boost.org/trac/boost/ticket/10507
+	sed -i -e 's:wave/build//wave::' tools/Jamfile.v2 || die
+
+	multilib_copy_sources
+}
+
+ejam() {
+	local b2_opts=(
+		"--user-config=${BOOST_ROOT}/user-config.jam"
+		"$@"
+	)
+	echo b2 "${b2_opts[@]}"
+	b2 "${b2_opts[@]}"
+}
+
+src_configure() {
+	# Workaround for too many parallel processes requested, bug #506064
+	[[ "$(makeopts_jobs)" -gt 64 ]] && MAKEOPTS="${MAKEOPTS} -j64"
+
+	OPTIONS=(
+		$(usex debug gentoodebug gentoorelease)
+		"-j$(makeopts_jobs)"
+		-q
+		-d+2
+	)
+
+	if [[ ${CHOST} == *-darwin* ]]; then
+		# We need to add the prefix, and in two cases this exceeds, so prepare
+		# for the largest possible space allocation.
+		append-ldflags -Wl,-headerpad_max_install_names
+	elif [[ ${CHOST} == *-winnt* ]]; then
+		compiler=parity
+		if [[ $($(tc-getCXX) -v) == *trunk* ]]; then
+			compilerVersion=trunk
+		else
+			compilerVersion=$($(tc-getCXX) -v | sed '1q' \
+				| sed -e 's,\([a-z]*\) \([0-9]\.[0-9]\.[0-9][^ \t]*\) .*,\2,')
+		fi
+		compilerExecutable=$(tc-getCXX)
+	fi
+
+	# bug 298489
+	if use ppc || use ppc64; then
+		[[ $(gcc-version) > 4.3 ]] && append-flags -mno-altivec
+	fi
+
+	# Use C++14 globally as of 1.62
+	append-cxxflags -std=c++14
+
+	use icu && OPTIONS+=(
+			"-sICU_PATH=${EPREFIX}/usr"
+		)
+	use icu || OPTIONS+=(
+			--disable-icu
+			boost.locale.icu=off
+		)
+	use mpi || OPTIONS+=(
+			--without-mpi
+		)
+	use nls || OPTIONS+=(
+			--without-locale
+		)
+	use context || OPTIONS+=(
+			--without-context
+			--without-coroutine
+			--without-fiber
+		)
+	use threads || OPTIONS+=(
+			--without-thread
+		)
+
+	OPTIONS+=(
+		pch=off
+		--boost-build="${EPREFIX}"/usr/share/boost-build
+		--prefix="${ED%/}/usr"
+		--layout=system
+		# building with threading=single is currently not possible
+		# https://svn.boost.org/trac/boost/ticket/7105
+		threading=multi
+		link=$(usex static-libs shared,static shared)
+	)
+
+	[[ ${CHOST} == *-winnt* ]] && OPTIONS+=(
+			-sNO_BZIP2=1
+		)
+}
+
+multilib_src_compile() {
+	local -x BOOST_ROOT="${BUILD_DIR}"
+	PYTHON_DIRS=""
+	MPI_PYTHON_MODULE=""
+
+	building() {
+		create_user-config.jam
+
+		local PYTHON_OPTIONS
+		if python_bindings_needed; then
+			PYTHON_OPTIONS=" --python-buildid=${EPYTHON#python}"
+		else
+			PYTHON_OPTIONS=" --without-python"
+		fi
+
+		ejam \
+			"${OPTIONS[@]}" \
+			${PYTHON_OPTIONS} \
+			|| die "Building of Boost libraries failed"
+
+		if python_bindings_needed; then
+			if [[ -z "${PYTHON_DIRS}" ]]; then
+				PYTHON_DIRS="$(find bin.v2/libs -name python | sort)"
+			else
+				if [[ "${PYTHON_DIRS}" != "$(find bin.v2/libs -name python | sort)" ]]; then
+					die "Inconsistent structure of build directories"
+				fi
+			fi
+
+			local dir
+			for dir in ${PYTHON_DIRS}; do
+				mv ${dir} ${dir}-${EPYTHON} \
+					|| die "Renaming of '${dir}' to '${dir}-${EPYTHON}' failed"
+			done
+
+			if use mpi; then
+				if [[ -z "${MPI_PYTHON_MODULE}" ]]; then
+					MPI_PYTHON_MODULE="$(find bin.v2/libs/mpi/build/*/gentoo* -name mpi.so)"
+					if [[ "$(echo "${MPI_PYTHON_MODULE}" | wc -l)" -ne 1 ]]; then
+						die "Multiple mpi.so files found"
+					fi
+				else
+					if [[ "${MPI_PYTHON_MODULE}" != "$(find bin.v2/libs/mpi/build/*/gentoo* -name mpi.so)" ]]; then
+						die "Inconsistent structure of build directories"
+					fi
+				fi
+
+				mv stage/lib/mpi.so stage/lib/mpi.so-${EPYTHON} \
+					|| die "Renaming of 'stage/lib/mpi.so' to 'stage/lib/mpi.so-${EPYTHON}' failed"
+			fi
+		fi
+	}
+	if python_bindings_needed; then
+		python_foreach_impl building
+	else
+		building
+	fi
+
+	if tools_needed; then
+		pushd tools >/dev/null || die
+
+		ejam \
+			"${OPTIONS[@]}" \
+			${PYTHON_OPTIONS} \
+			|| die "Building of Boost tools failed"
+		popd >/dev/null || die
+	fi
+}
+
+multilib_src_install_all() {
+	if ! use python; then
+		rm -r "${ED%/}"/usr/include/boost/python* || die
+	fi
+
+	if ! use nls; then
+		rm -r "${ED%/}"/usr/include/boost/locale || die
+	fi
+
+	if ! use context; then
+		rm -r "${ED%/}"/usr/include/boost/context || die
+		rm -r "${ED%/}"/usr/include/boost/coroutine{,2} || die
+		rm "${ED%/}"/usr/include/boost/asio/spawn.hpp || die
+	fi
+
+	if use doc; then
+		# find extraneous files that shouldn't be installed
+		# as part of the documentation and remove them.
+		find libs/*/* \( -iname 'test' -o -iname 'src' \) -exec rm -rf '{}' + || die
+		find doc \( -name 'Jamfile.v2' -o -name 'build' -o -name '*.manifest' \) -exec rm -rf '{}' + || die
+		find tools \( -name 'Jamfile.v2' -o -name 'src' -o -name '*.cpp' -o -name '*.hpp' \) -exec rm -rf '{}' + || die
+
+		docinto html
+		dodoc *.{htm,html,png,css}
+		dodoc -r doc libs more tools
+
+		# To avoid broken links
+		dodoc LICENSE_1_0.txt
+
+		dosym /usr/include/boost /usr/share/doc/${PF}/html/boost
+	fi
+}
+
+multilib_src_install() {
+	local -x BOOST_ROOT="${BUILD_DIR}"
+	installation() {
+		create_user-config.jam
+
+		local PYTHON_OPTIONS
+		if python_bindings_needed; then
+			local dir
+			for dir in ${PYTHON_DIRS}; do
+				cp -pr ${dir}-${EPYTHON} ${dir} \
+					|| die "Copying of '${dir}-${EPYTHON}' to '${dir}' failed"
+			done
+
+			if use mpi; then
+				cp -p stage/lib/mpi.so-${EPYTHON} "${MPI_PYTHON_MODULE}" \
+					|| die "Copying of 'stage/lib/mpi.so-${EPYTHON}' to '${MPI_PYTHON_MODULE}' failed"
+				cp -p stage/lib/mpi.so-${EPYTHON} stage/lib/mpi.so \
+					|| die "Copying of 'stage/lib/mpi.so-${EPYTHON}' to 'stage/lib/mpi.so' failed"
+			fi
+			PYTHON_OPTIONS=" --python-buildid=${EPYTHON#python}"
+		else
+			PYTHON_OPTIONS=" --without-python"
+		fi
+
+		ejam \
+			"${OPTIONS[@]}" \
+			${PYTHON_OPTIONS} \
+			--includedir="${ED%/}/usr/include" \
+			--libdir="${ED%/}/usr/$(get_libdir)" \
+			install || die "Installation of Boost libraries failed"
+
+		if python_bindings_needed; then
+			rm -r ${PYTHON_DIRS} || die
+
+			# Move mpi.so Python module to Python site-packages directory.
+			# https://svn.boost.org/trac/boost/ticket/2838
+			if use mpi; then
+				local moddir=$(python_get_sitedir)/boost
+				# moddir already includes eprefix
+				mkdir -p "${D}${moddir}" || die
+				mv "${ED%/}/usr/$(get_libdir)/mpi.so" "${D}${moddir}" || die
+				cat << EOF > "${D}${moddir}/__init__.py" || die
+import sys
+if sys.platform.startswith('linux'):
+	import DLFCN
+	flags = sys.getdlopenflags()
+	sys.setdlopenflags(DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL)
+	from . import mpi
+	sys.setdlopenflags(flags)
+	del DLFCN, flags
+else:
+	from . import mpi
+del sys
+EOF
+			fi
+
+			python_optimize
+		fi
+	}
+	if python_bindings_needed; then
+		python_foreach_impl installation
+	else
+		installation
+	fi
+
+	pushd "${ED%/}/usr/$(get_libdir)" >/dev/null || die
+
+	local ext=$(get_libname)
+	if use threads; then
+		local f
+		for f in *${ext}; do
+			dosym ${f} /usr/$(get_libdir)/${f/${ext}/-mt${ext}}
+		done
+	fi
+
+	popd >/dev/null || die
+
+	if tools_needed; then
+		dobin dist/bin/*
+
+		insinto /usr/share
+		doins -r dist/share/boostbook
+	fi
+
+	# boost's build system truely sucks for not having a destdir.  Because for
+	# this reason we are forced to build with a prefix that includes the
+	# DESTROOT, dynamic libraries on Darwin end messed up, referencing the
+	# DESTROOT instread of the actual EPREFIX.  There is no way out of here
+	# but to do it the dirty way of manually setting the right install_names.
+	if [[ ${CHOST} == *-darwin* ]]; then
+		einfo "Working around completely broken build-system(tm)"
+		local d
+		for d in "${ED%/}"/usr/lib/*.dylib; do
+			if [[ -f ${d} ]]; then
+				# fix the "soname"
+				ebegin "  correcting install_name of ${d#${ED}}"
+				install_name_tool -id "/${d#${D}}" "${d}"
+				eend $?
+				# fix references to other libs
+				refs=$(otool -XL "${d}" | \
+					sed -e '1d' -e 's/^\t//' | \
+					grep "^libboost_" | \
+					cut -f1 -d' ')
+				local r
+				for r in ${refs}; do
+					ebegin "    correcting reference to ${r}"
+					install_name_tool -change \
+						"${r}" \
+						"${EPREFIX}/usr/lib/${r}" \
+						"${d}"
+					eend $?
+				done
+			fi
+		done
+	fi
+}
+
+pkg_preinst() {
+	# Yai for having symlinks that are nigh-impossible to remove without
+	# resorting to dirty hacks like these. Removes lingering symlinks
+	# from the slotted versions.
+	local symlink
+	for symlink in "${EROOT%/}/usr/include/boost" "${EROOT%/}/usr/share/boostbook"; do
+		if [[ -L ${symlink} ]]; then
+			rm -f "${symlink}" || die
+		fi
+	done
+
+	# some ancient installs still have boost cruft lying around
+	# for unknown reasons, causing havoc for reverse dependencies
+	# Bug: 607734
+	rm -rf "${EROOT%/}"/usr/include/boost-1_[3-5]? || die
+}
diff --git a/dev-libs/boost/files/boost-1.48.0-disable_icu_rpath.patch b/dev-libs/boost/files/boost-1.48.0-disable_icu_rpath.patch
new file mode 100644
index 0000000..23a8783
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.48.0-disable_icu_rpath.patch
@@ -0,0 +1,29 @@
+--- a/libs/locale/build/Jamfile.v2
++++ b/libs/locale/build/Jamfile.v2
+@@ -58,8 +58,8 @@
+ 
+ if $(ICU_LINK)
+ {
+-    ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
+-    ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
++    ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <runtime-link>shared ;
++    ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <runtime-link>shared ;
+ }
+ else
+ {
+@@ -117,7 +117,6 @@
+       <library>icuuc/<link>shared/<runtime-link>shared 
+       <library>icudt/<link>shared/<runtime-link>shared 
+       <library>icuin/<link>shared/<runtime-link>shared
+-      <dll-path>$(ICU_PATH)/bin
+         <runtime-link>shared ;
+ 
+ 
+@@ -176,7 +175,6 @@
+       <library>icuuc_64/<link>shared/<runtime-link>shared 
+       <library>icudt_64/<link>shared/<runtime-link>shared 
+       <library>icuin_64/<link>shared/<runtime-link>shared
+-      <dll-path>$(ICU_PATH)/bin64
+         <runtime-link>shared ;
+  
+     
diff --git a/dev-libs/boost/files/boost-1.55.0-context-x32.patch b/dev-libs/boost/files/boost-1.55.0-context-x32.patch
new file mode 100644
index 0000000..5bf7406
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.55.0-context-x32.patch
@@ -0,0 +1,42 @@
+https://svn.boost.org/trac/boost/ticket/9445
+
+hack to fix x32 builds
+
+--- a/libs/context/src/asm/jump_i386_sysv_elf_gas.S
++++ b/libs/context/src/asm/jump_i386_sysv_elf_gas.S
+@@ -31,6 +31,10 @@
+  *                                                                  *
+  * *****************************************************************/
+ 
++#ifdef __x86_64__
++#include "jump_x86_64_sysv_elf_gas.S"
++#else
++
+ .text
+ .globl jump_fcontext
+ .align 2
+@@ -73,3 +77,5 @@ jump_fcontext:
+ 
+ /* Mark that we don't need executable stack.  */
+ .section .note.GNU-stack,"",%progbits
++
++#endif
+--- a/libs/context/src/asm/make_i386_sysv_elf_gas.S
++++ b/libs/context/src/asm/make_i386_sysv_elf_gas.S
+@@ -31,6 +31,10 @@
+  *                                                                  *
+  * *****************************************************************/
+ 
++#ifdef __x86_64__
++#include "make_x86_64_sysv_elf_gas.S"
++#else
++
+ .text
+ .globl make_fcontext
+ .align 2
+@@ -78,3 +82,5 @@ finish:
+ 
+ /* Mark that we don't need executable stack.  */
+ .section .note.GNU-stack,"",%progbits
++
++#endif
diff --git a/dev-libs/boost/files/boost-1.56.0-build-auto_index-tool.patch b/dev-libs/boost/files/boost-1.56.0-build-auto_index-tool.patch
new file mode 100644
index 0000000..48ca513
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.56.0-build-auto_index-tool.patch
@@ -0,0 +1,13 @@
+Build auto_index tool with USE="tools"
+Gentoo bug report: https://bugs.gentoo.org/show_bug.cgi?id=529066
+
+--- a/tools/Jamfile.v2.orig	2014-12-24 12:57:32.290880067 +0300
++++ b/tools/Jamfile.v2	2014-12-24 12:58:38.403883250 +0300
+@@ -20,6 +20,7 @@
+ use-project /boost/regression : regression/build ;
+ 
+ TOOLS =
++    auto_index/build//auto_index
+     bcp//bcp
+     inspect/build//inspect
+     quickbook//quickbook
diff --git a/dev-libs/boost/files/boost-1.63.0-fix-python.patch b/dev-libs/boost/files/boost-1.63.0-fix-python.patch
new file mode 100644
index 0000000..18ca2f5
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.63.0-fix-python.patch
@@ -0,0 +1,138 @@
+--- a/boostcpp.jam
++++ b/boostcpp.jam
+@@ -104,7 +104,7 @@
+ python-id = [ option.get "python-buildid" ] ;
+ if $(python-id)
+ {
+-    PYTHON_ID = [ regex.replace $(python-id) [*\\/:.\"\'] _ ] ;
++    PYTHON_ID = [ regex.replace $(python-id) [*\\/:\"\'] _ ] ;
+ }
+ 
+ 
+--- a/libs/python/build/Jamfile
++++ b/libs/python/build/Jamfile
+@@ -30,22 +30,6 @@
+         ;
+ }
+ 
+-rule find-py3-version
+-{
+-    local versions = [ feature.values python ] ;
+-    local py3ver ;
+-    for local v in $(versions)
+-    {
+-        if $(v) >= 3.0
+-        {
+-            py3ver = $(v) ;
+-        }
+-    }
+-    return $(py3ver) ;
+-}
+-
+-py3-version = [ find-py3-version ] ;
+-
+ project boost/python
+   : source-location ../src
+   ;
+@@ -53,10 +37,16 @@
+ rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } }
+ rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
+ 
+-rule lib_boost_python ( is-py3 ? )
++rule lib_boost_python
+ {
++    local python_major_version = [ MATCH "^([^.]+)" : [ feature.values python ] ] ;
++    local python2 ;
++    if $(python_major_version) = 2
++    {
++        python2 = true ;
++    }
+ 
+-    lib [ cond $(is-py3) : boost_python3 : boost_python ]
++    lib boost_python
+         : # sources
+         numeric.cpp
+         list.cpp
+@@ -90,20 +80,9 @@
+         :   # requirements
+             <link>static:<define>BOOST_PYTHON_STATIC_LIB 
+             <define>BOOST_PYTHON_SOURCE
++            [ cond $(python2) : <cxxflags>-fno-strict-aliasing ]
+           
+-            # On Windows, all code using Python has to link to the Python
+-            # import library.
+-            #
+-            # On *nix we never link libboost_python to libpython.  When
+-            # extending Python, all Python symbols are provided by the
+-            # Python interpreter executable.  When embedding Python, the
+-            # client executable is expected to explicitly link to
+-            # /python//python (the target representing libpython) itself.
+-            #
+-            # python_for_extensions is a target defined by Boost.Build to
+-            # provide the Python include paths, and on Windows, the Python
+-            # import library, as usage requirements.
+-            [ cond [ python.configured ] : <library>/python//python_for_extensions ]
++            [ cond [ python.configured ] : <library>/python//python ]
+             
+             # we prevent building when there is no python available
+             # as it's not possible anyway, and to cause dependents to
+@@ -112,7 +91,6 @@
+             <dependency>config-warning
+ 
+             <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-            [ cond $(is-py3) : <python>$(py3-version) ]
+ 
+             -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+             <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+@@ -125,51 +103,8 @@
+         ;
+ }
+ 
+-rule lib_boost_numpy ( is-py3 ? )
+-{
+-    numpy-include = [ python.numpy-include ] ;
+-    lib [ cond $(is-py3) : boost_numpy3 : boost_numpy ]
+-        : # sources
+-        numpy/dtype.cpp
+-        numpy/matrix.cpp
+-        numpy/ndarray.cpp
+-	numpy/numpy.cpp
+-	numpy/scalars.cpp
+-	numpy/ufunc.cpp
+-        :   # requirements
+-            [ cond [ python.numpy ] : <library>/python//python_for_extensions ]
+-            [ unless [ python.numpy ] : <build>no ]
+-	    <include>$(numpy-include)
+-	    <library>boost_python
+-            <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-            [ cond $(is-py3) : <python>$(py3-version) ]
+-
+-            -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+-            <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+-
+-        :   # default build
+-            <link>shared
+-        :   # usage requirements
+-            <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-        ;
+-}
+-
+ libraries = boost_python ;
+-libraries3 = boost_python3 ;
+-if [ python.numpy ]
+-{
+-    libraries += boost_numpy ;
+-    libraries3 += boost_numpy3 ;
+-}
+ 
+ lib_boost_python ;
+-lib_boost_numpy ;
+-
+-if $(py3-version)
+-{
+-    lib_boost_python yes ;
+-    lib_boost_numpy yes ;
+-    libraries += $(libraries3) ;
+-}
+ 
+ boost-install $(libraries) ;
diff --git a/dev-libs/boost/files/boost-1.65.0-fix-python.patch b/dev-libs/boost/files/boost-1.65.0-fix-python.patch
new file mode 100644
index 0000000..0791602
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.65.0-fix-python.patch
@@ -0,0 +1,272 @@
+--- a/boostcpp.jam
++++ b/boostcpp.jam
+@@ -104,7 +104,7 @@
+ python-id = [ option.get "python-buildid" ] ;
+ if $(python-id)
+ {
+-    PYTHON_ID = [ regex.replace $(python-id) [*\\/:.\"\'] _ ] ;
++    PYTHON_ID = [ regex.replace $(python-id) [*\\/:\"\'] _ ] ;
+ }
+ 
+ 
+--- a/libs/mpi/build/Jamfile.v2
++++ b/libs/mpi/build/Jamfile.v2
+@@ -58,81 +58,50 @@
+ 
+   if [ python.configured ]
+   {
+-    py2-version = [ py-version 2 ] ;
+-    py3-version = [ py-version 3 ] ;
+-
+-    # These library names are synchronized with those defined by Boost.Python, see libs/python/build/Jamfile.
+-    lib_boost_python(2) = boost_python ;
+-    lib_boost_python(3) = boost_python3 ;
+-
+-    lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ;
+-    lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ;
+-
+-    lib_boost_mpi_python(2) = boost_mpi_python ;
+-    lib_boost_mpi_python(3) = boost_mpi_python3 ;
+-
+-    lib_boost_mpi_python($(py2-version)) = $(lib_boost_mpi_python(2)) ;
+-    lib_boost_mpi_python($(py3-version)) = $(lib_boost_mpi_python(3)) ;
+-
+-    for local N in 2 3
+-    {
+-        if $(py$(N)-version)
+-        {
+-            lib $(lib_boost_mpi_python($(py$(N)-version)))
+-              : # Sources
+-                python/serialize.cpp
+-              : # Requirements
+-                <library>boost_mpi
+-                <library>/mpi//mpi [ mpi.extra-requirements ]
+-                <library>/boost/python//$(lib_boost_python($(py$(N)-version)))
+-                <link>shared:<define>BOOST_MPI_DYN_LINK=1
+-                <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
+-                <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
+-                <define>BOOST_MPI_PYTHON_SOURCE=1
+-                -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+-                <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+-                <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-                <python>$(py$(N)-version)
+-              : # Default build
+-                <link>shared
+-              : # Usage requirements
+-                <library>/mpi//mpi [ mpi.extra-requirements ]
+-              ;
+-
+-            python-extension mpi
+-              : # Sources
+-                python/collectives.cpp
+-                python/py_communicator.cpp
+-                python/datatypes.cpp
+-                python/documentation.cpp
+-                python/py_environment.cpp
+-                python/py_nonblocking.cpp
+-                python/py_exception.cpp
+-                python/module.cpp
+-                python/py_request.cpp
+-                python/skeleton_and_content.cpp
+-                python/status.cpp
+-                python/py_timer.cpp
+-              : # Requirements
+-                <library>/boost/python//$(lib_boost_python($(py$(N)-version)))
+-                <library>$(lib_boost_mpi_python($(py$(N)-version)))
+-                <library>boost_mpi
+-                <library>/mpi//mpi [ mpi.extra-requirements ]
+-                <link>shared:<define>BOOST_MPI_DYN_LINK=1
+-                <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
+-                <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
+-                <link>shared <runtime-link>shared
+-                <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-                <python>$(py$(N)-version)
+-              ;
+-
+-            libraries += $(lib_boost_mpi_python($(py$(N)-version))) ;
+-        }
+-        else
+-        {
+-            alias $(lib_boost_mpi_python($(N))) ;
+-        }
+-    }
++    lib boost_mpi_python
++      : # Sources
++        python/serialize.cpp
++      : # Requirements
++        <library>boost_mpi
++        <library>/mpi//mpi [ mpi.extra-requirements ]
++      	<library>/boost/python//boost_python
++        <link>shared:<define>BOOST_MPI_DYN_LINK=1
++        <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
++        <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
++        <define>BOOST_MPI_PYTHON_SOURCE=1
++	-<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
++	<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
++      : # Default build
++        <link>shared
++      : # Usage requirements
++        <library>/mpi//mpi [ mpi.extra-requirements ]
++      ;
++    libraries += boost_mpi_python ;
++
++    python-extension mpi
++      : # Sources
++        python/collectives.cpp
++        python/py_communicator.cpp
++        python/datatypes.cpp
++        python/documentation.cpp
++        python/py_environment.cpp
++        python/py_nonblocking.cpp
++        python/py_exception.cpp
++        python/module.cpp
++        python/py_request.cpp
++        python/skeleton_and_content.cpp
++        python/status.cpp
++        python/py_timer.cpp
++      : # Requirements
++      	<library>/boost/python//boost_python
++        <library>boost_mpi_python
++        <library>boost_mpi
++        <library>/mpi//mpi [ mpi.extra-requirements ]
++        <link>shared:<define>BOOST_MPI_DYN_LINK=1
++        <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
++        <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
++        <link>shared <runtime-link>shared
++      ;
+   }
+ }
+ else if ! ( --without-mpi in  [ modules.peek : ARGV ] )
+--- a/libs/python/build/Jamfile
++++ b/libs/python/build/Jamfile
+@@ -31,26 +31,23 @@
+         ;
+ }
+ 
+-py2-version = [ py-version 2 ] ;
+-py3-version = [ py-version 3 ] ;
+-
+ project boost/python
+   : source-location ../src
+   ;
+ 
+ rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } }
+ rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
+-local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } }
+-
+-lib_boost_python(2) = boost_python ;
+-lib_boost_python(3) = boost_python3 ;
+-
+-lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ;
+-lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ;
+ 
+-rule lib_boost_python ( version )
++rule lib_boost_python
+ {
+-    lib $(lib_boost_python($(version)))
++    local python_major_version = [ MATCH "^([^.]+)" : [ feature.values python ] ] ;
++    local python2 ;
++    if $(python_major_version) = 2
++    {
++        python2 = true ;
++    }
++
++    lib boost_python
+         : # sources
+         list.cpp
+         long.cpp
+@@ -96,7 +93,8 @@
+             # python_for_extensions is a target defined by Boost.Build to
+             # provide the Python include paths, and on Windows, the Python
+             # import library, as usage requirements.
+-            [ cond [ python.configured ] : <library>/python//python_for_extensions ]
++            [ cond $(python2) : <cxxflags>-fno-strict-aliasing ]
++            [ cond [ python.configured ] : <library>/python//python ]
+             
+             # we prevent building when there is no python available
+             # as it's not possible anyway, and to cause dependents to
+@@ -105,13 +103,10 @@
+             <dependency>config-warning
+ 
+             <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-            <python>$(version)
+ 
+             -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+             <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+ 
+-            <conditional>@python.require-py
+-
+         :   # default build
+             <link>shared
+         :   # usage requirements
+@@ -120,68 +115,8 @@
+         ;
+ }
+ 
+-lib_boost_numpy(2) = boost_numpy ;
+-lib_boost_numpy(3) = boost_numpy3 ;
+-
+-lib_boost_numpy($(py2-version)) = $(lib_boost_numpy(2)) ;
+-lib_boost_numpy($(py3-version)) = $(lib_boost_numpy(3)) ;
+-
+-rule lib_boost_numpy ( version )
+-{
+-    numpy-include = [ python.numpy-include ] ;
+-    lib $(lib_boost_numpy($(version)))
+-        : # sources
+-        numpy/dtype.cpp
+-        numpy/matrix.cpp
+-        numpy/ndarray.cpp
+-        numpy/numpy.cpp
+-        numpy/scalars.cpp
+-        numpy/ufunc.cpp
+-        :   # requirements
+-            <link>static:<define>BOOST_NUMPY_STATIC_LIB 
+-            <define>BOOST_NUMPY_SOURCE
+-            [ cond [ python.numpy ] : <library>/python//python_for_extensions ]
+-            [ unless [ python.numpy ] : <build>no ]
+-            <include>$(numpy-include)
+-            <library>$(lib_boost_python($(version)))
+-            <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-            <python>$(version)
++libraries = boost_python ;
+ 
+-            -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+-            <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+-
+-            <conditional>@python.require-py
+-
+-        :   # default build
+-            <link>shared
+-        :   # usage requirements
+-			<link>static:<define>BOOST_NUMPY_STATIC_LIB
+-            <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-        ;
+-}
+-
+-libraries = ;
+-
+-for local N in 2 3
+-{
+-    if $(py$(N)-version)
+-    {
+-        lib_boost_python $(py$(N)-version) ;
+-        libraries += $(lib_boost_python($(py$(N)-version))) ;
+-    }
+-    else
+-    {
+-        alias $(lib_boost_python($(N))) ;
+-    }
+-    if $(py$(N)-version) && [ python.numpy ]
+-    {
+-        lib_boost_numpy $(py$(N)-version) ;
+-        libraries += $(lib_boost_numpy($(py$(N)-version))) ;
+-    }
+-    else
+-    {
+-        alias $(lib_boost_numpy($(N))) ;
+-    }
+-}
++lib_boost_python ;
+ 
+ boost-install $(libraries) ;
diff --git a/dev-libs/boost/files/boost-1.67.0-fix-python.patch b/dev-libs/boost/files/boost-1.67.0-fix-python.patch
new file mode 100644
index 0000000..6f51152
--- /dev/null
+++ b/dev-libs/boost/files/boost-1.67.0-fix-python.patch
@@ -0,0 +1,153 @@
+Python module needs to be built without these extra renames.
+MPI module needs to reference correct python
+
+~Index: boost_1_64_0/libs/mpi/build/Jamfile.v2
+~===================================================================
+~--- boost_1_64_0.orig/libs/mpi/build/Jamfile.v2
+~+++ boost_1_64_0/libs/mpi/build/Jamfile.v2
+~@@ -61,10 +61,10 @@ libraries += boost_mpi ;
+~     lib boost_mpi_python
+~       : # Sources
+~         python/serialize.cpp
+~+        /user-config//boost_python_alias
+~       : # Requirements
+~         <library>boost_mpi
+~         <library>/mpi//mpi [ mpi.extra-requirements ]
+~-      	<library>/boost/python//boost_python
+~         <link>shared:<define>BOOST_MPI_DYN_LINK=1
+~         <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
+~         <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
+~@@ -92,8 +92,8 @@ libraries += boost_mpi ;
+~         python/skeleton_and_content.cpp
+~         python/status.cpp
+~         python/py_timer.cpp
+~+        /user-config//boost_python_alias
+~       : # Requirements
+~-      	<library>/boost/python//boost_python
+~         <library>boost_mpi_python
+~         <library>boost_mpi
+~         <library>/mpi//mpi [ mpi.extra-requirements ]
+Index: boost_1_67_0/libs/mpi/build/Jamfile.v2
+===================================================================
+--- boost_1_67_0.orig/libs/mpi/build/Jamfile.v2
++++ boost_1_67_0/libs/mpi/build/Jamfile.v2
+@@ -60,33 +60,13 @@ libraries += boost_mpi ;
+
+   if [ python.configured ]
+   {
+-    py2-version = [ py-version 2 ] ;
+-    py3-version = [ py-version 3 ] ;
+-
+-    # These library names are synchronized with those defined by Boost.Python, see libs/python/build/Jamfile.
+-    lib_boost_python(2) = boost_python ;
+-    lib_boost_python(3) = boost_python3 ;
+-
+-    lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ;
+-    lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ;
+-
+-    lib_boost_mpi_python(2) = boost_mpi_python ;
+-    lib_boost_mpi_python(3) = boost_mpi_python3 ;
+-
+-    lib_boost_mpi_python($(py2-version)) = $(lib_boost_mpi_python(2)) ;
+-    lib_boost_mpi_python($(py3-version)) = $(lib_boost_mpi_python(3)) ;
+-
+-    for local N in 2 3
+-    {
+-        if $(py$(N)-version)
+-        {
+-            lib $(lib_boost_mpi_python($(py$(N)-version)))
++    lib boost_mpi_python
+               : # Sources
+                 python/serialize.cpp
+               : # Requirements
+                 <library>boost_mpi
+                 <library>/mpi//mpi [ mpi.extra-requirements ]
+-                <library>/boost/python//$(lib_boost_python($(py$(N)-version)))
++                <library>/boost/python//boost_python
+                 <link>shared:<define>BOOST_MPI_DYN_LINK=1
+                 <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
+                 <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
+@@ -94,12 +74,12 @@ libraries += boost_mpi ;
+                 -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
+                 <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
+                 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-                <python>$(py$(N)-version)
+               : # Default build
+                 <link>shared
+               : # Usage requirements
+                 <library>/mpi//mpi [ mpi.extra-requirements ]
+               ;
++            libraries += boost_mpi_python ;
+
+             python-extension mpi
+               : # Sources
+@@ -116,8 +96,8 @@ libraries += boost_mpi ;
+                 python/status.cpp
+                 python/py_timer.cpp
+               : # Requirements
+-                <library>/boost/python//$(lib_boost_python($(py$(N)-version)))
+-                <library>$(lib_boost_mpi_python($(py$(N)-version)))
++        <library>/boost/python//boost_python
++        <library>boost_mpi_python
+                 <library>boost_mpi
+                 <library>/mpi//mpi [ mpi.extra-requirements ]
+                 <link>shared:<define>BOOST_MPI_DYN_LINK=1
+@@ -125,16 +105,7 @@ libraries += boost_mpi ;
+                 <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
+                 <link>shared <runtime-link>shared
+                 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
+-                <python>$(py$(N)-version)
+               ;
+-
+-            libraries += $(lib_boost_mpi_python($(py$(N)-version))) ;
+-        }
+-        else
+-        {
+-            alias $(lib_boost_mpi_python($(N))) ;
+-        }
+-    }
+   }
+ }
+ else if ! ( --without-mpi in  [ modules.peek : ARGV ] )
+Index: boost_1_67_0/libs/python/Jamfile
+===================================================================
+--- boost_1_67_0.orig/libs/python/Jamfile
++++ boost_1_67_0/libs/python/Jamfile
+@@ -36,9 +36,10 @@ local rule split-version ( version )
+ # For example, Boost.Python built for Python 2.7 uses the suffix "27"
+ rule version-suffix ( version )
+ {
+-    local major-minor = [ split-version $(version) ] ;
+-    local suffix = $(major-minor:J="") ;
+-    return $(suffix) ;
++    # local major-minor = [ split-version $(version) ] ;
++    # local suffix = $(major-minor:J="") ;
++    # return $(suffix) ;
++    return "" ;
+ }
+
+
+diff -ur boost_1_67_0.orig/boostcpp.jam boost_1_67_0/boostcpp.jam
+--- boost_1_67_0.orig/boostcpp.jam	2018-07-30 16:26:03.346187542 -0700
++++ boost_1_67_0/boostcpp.jam	2018-07-30 16:26:18.839081472 -0700
+@@ -105,7 +105,7 @@
+ python-id = [ option.get "python-buildid" ] ;
+ if $(python-id)
+ {
+-    PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ;
++    PYTHON_ID = [ regex.replace $(python-id) "[*\\/:\"\']" _ ] ;
+ }
+
+
+diff -ur boost_1_67_0.orig/libs/python/Jamfile boost_1_67_0/libs/python/Jamfile
+--- boost_1_67_0.orig/libs/python/Jamfile	2018-07-30 14:56:15.591366992 -0700
++++ boost_1_67_0/libs/python/Jamfile	2018-07-30 16:26:31.662993677 -0700
+@@ -47,7 +47,7 @@
+ python-id = [ option.get "python-buildid" ] ;
+ if $(python-id)
+ {
+-    PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ;
++    PYTHON_ID = [ regex.replace $(python-id) "[*\\/:\"\']" _ ] ;
+ }
+
+ rule python-tag ( name : type ? : property-set )
diff --git a/dev-util/boost-build/Manifest b/dev-util/boost-build/Manifest
new file mode 100644
index 0000000..0590a2a
--- /dev/null
+++ b/dev-util/boost-build/Manifest
@@ -0,0 +1,11 @@
+AUX boost-build-1.48.0-disable_python_rpath.patch 341 SHA512 1bc89bcf7210d6f3fcf88b48c7d173fc76c16dae804a9c927509f7ff525c6c77b09d9fa5c1f02e77ec36dac303d516b3d00bed08626007852a22c400adc992a4
+AUX boost-build-1.49.0-darwin-gentoo-toolchain.patch 651 SHA512 54606684921997c4d280eae7f6033ef6d02dc76d8c56499db25b359879a5a89e0220ec9733d197c4c482339d9968771ddd90891edf543f11f622595ed2bf43cd
+AUX boost-build-1.50.0-respect-c_ld-flags.patch 1868 SHA512 821ceff3027c318191b0959c265c420c9f43b9e8185fc20c902a31efaf7bbaaa4dfe4f01408557f7b89774b15104ad391671f467ad2e70af93235e8a0b8d18ee
+AUX boost-build-1.52.0-darwin-no-python-framework.patch 419 SHA512 23f281c53c3e580a30efbea83e2c63d28021151e299b0086b106d1148f3b20e81237a3141a6842b71403f36cd531a58c4eb7ab5bf030ce0e23aa08198202cc48
+AUX boost-build-1.54.0-fix-test.patch 363 SHA512 d349ff3040c219c3a9f9f6182ca3f1fe7e25d8f2975dd04e66d8e281caf10a5b27cab5e6fa6240ed57b24524fa045a88ba1cf9220efcf065726c78c68378c5e8
+AUX boost-build-1.54.0-support_dots_in_python-buildid.patch 487 SHA512 41fbe223120452a6ddf7b8ec9f64b2f653ee3d18b2dfccdba90d9040632f911159ac4102947371e12af7e52ca251aa39db2be9b362251ec86c12860867e50e68
+AUX boost-build-1.55.0-ppc-aix.patch 228 SHA512 a320bfb744667312230cf601d034217f72e3a78fe06851678c5810bb47c8239007aaeffb5719513696922ffc2d4c2200e60e140b34e3992dc353ad0fc69177fe
+AUX boost-build-1.66.0-add-none-feature-options.patch 724 SHA512 9d4149739139d268e54304d73d1ceb0073ca94265d8a84467c890c8f68aac3b0060e847b71e961a92f17813bad651d0515898dd4d0535f5cc6c1c4a024e9b39a
+AUX site-config.jam 688 SHA512 b65bf1be3133f9f66d3139b00f195a288591bb20a13ba35041507c2c33d7d2da6047c3b02dc27bc4eb21798b91e1262a60e294b7fd4af90808b9de0f5af517df
+DIST boost_1_65_0.tar.bz2 82597718 SHA512 7142650fb8d61e3ef16ba066fc918e087f19e9bc2ad1d6a11fb10bf0d6b1b5ad05ab032f076a5233a1624b3669e952b2cc38b7dc074bbf53018e2970ee90fcdd
+EBUILD boost-build-1.65.0.ebuild 3841 SHA512 51bb46c6ecf0ee0447dc1cbaf15088f077159def1db09a5ba92ecffce7a53ced2992977b8f6105461fd1e86b43fbb44f0ca37e205c928fd31dd7e8bfbc8bbcb7
diff --git a/dev-util/boost-build/boost-build-1.65.0.ebuild b/dev-util/boost-build/boost-build-1.65.0.ebuild
new file mode 100644
index 0000000..fb56a57
--- /dev/null
+++ b/dev-util/boost-build/boost-build-1.65.0.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+RESTRICT="test"
+
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-single-r1 toolchain-funcs versionator
+
+MY_PV="$(replace_all_version_separators _)"
+
+DESCRIPTION="A system for large project software construction, simple to use and powerful"
+HOMEPAGE="http://www.boost.org/doc/tools/build/index.html"
+SRC_URI="https://downloads.sourceforge.net/project/boost/boost/${PV}/boost_${MY_PV}.tar.bz2"
+
+LICENSE="Boost-1.0"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="examples python test"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )
+	!<dev-libs/boost-1.34.0
+	!<=dev-util/boost-build-1.35.0-r1"
+DEPEND="${RDEPEND}
+	test? ( sys-apps/diffutils
+		${PYTHON_DEPS} )"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
+	test? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/boost_${MY_PV}/tools/build/src"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-1.48.0-disable_python_rpath.patch"
+	"${FILESDIR}/${PN}-1.50.0-respect-c_ld-flags.patch"
+	"${FILESDIR}/${PN}-1.49.0-darwin-gentoo-toolchain.patch"
+	"${FILESDIR}/${PN}-1.52.0-darwin-no-python-framework.patch"
+	"${FILESDIR}/${PN}-1.54.0-support_dots_in_python-buildid.patch"
+	"${FILESDIR}/${PN}-1.55.0-ppc-aix.patch"
+)
+
+pkg_setup() {
+	if use python || use test; then
+		python-single-r1_pkg_setup
+	fi
+}
+
+src_unpack() {
+	tar xojf "${DISTDIR}/${A}" boost_${MY_PV}/tools/build || die "unpacking tar failed"
+}
+
+src_prepare() {
+	default
+
+	pushd ../ >/dev/null || die
+	eapply "${FILESDIR}/${PN}-1.54.0-fix-test.patch"
+	popd >/dev/null || die
+
+	# Remove stripping option
+	# Fix python components build on multilib systems, bug #496446
+	cd "${S}/engine" || die
+	sed -i \
+		-e 's|-s\b||' \
+		-e "/libpython/s/lib ]/$(get_libdir) ]/" \
+		build.jam || die "sed failed"
+
+	# Force regeneration
+	rm jambase.c || die
+
+	# This patch allows us to fully control optimization
+	# and stripping flags when bjam is used as build-system
+	# We simply extend the optimization and debug-symbols feature
+	# with empty dummies called 'none'
+	cd "${S}" || die
+	sed -i \
+		-e 's/\(off speed space\)/\1 none/' \
+		-e 's/\(debug-symbols      : on off\)/\1 none/' \
+		tools/builtin.jam || die "sed failed"
+}
+
+src_configure() {
+	if use python; then
+		# replace versions by user-selected one (TODO: fix this when slot-op
+		# deps are available to always match the best version available)
+		sed -i \
+			-e "s|27 26 25 24 23 22|${EPYTHON#python}|" \
+			engine/build.jam || die "sed failed"
+	fi
+}
+
+src_compile() {
+	cd engine || die
+
+	local toolset
+
+	if [[ ${CHOST} == *-darwin* ]]; then
+		toolset=darwin
+	else
+		# Using boost's generic toolset here, which respects CC and CFLAGS
+		toolset=cc
+	fi
+
+	CC=$(tc-getCC) ./build.sh ${toolset} -d+2 $(use_with python python "${EROOT%/}"/usr) || die "building bjam failed"
+}
+
+src_install() {
+	dobin engine/bin.*/{bjam,b2}
+
+	insinto /usr/share/boost-build
+	doins -r "${FILESDIR}/site-config.jam" \
+		../boost-build.jam bootstrap.jam build-system.jam ../example/user-config.jam *.py \
+		build kernel options tools util
+
+	if ! use python; then
+		find "${ED%/}/usr/share/boost-build" -iname "*.py" -delete || die "removing experimental python files failed"
+	fi
+
+	dodoc ../notes/{changes,release_procedure,build_dir_option,relative_source_paths}.txt
+
+	if use examples; then
+		docinto examples
+		dodoc -r ../example/.
+		docompress -x /usr/share/doc/${PF}/examples
+	fi
+}
+
+src_test() {
+	cd ../test || die
+
+	export TMP="${T}"
+
+	DO_DIFF="${PREFIX}/usr/bin/diff" ${PYTHON} test_all.py
+
+	if [[ -s test_results.txt ]]; then
+		eerror "At least one test failed: $(<test_results.txt)"
+		die "tests failed"
+	fi
+}
diff --git a/dev-util/boost-build/files/boost-build-1.48.0-disable_python_rpath.patch b/dev-util/boost-build/files/boost-build-1.48.0-disable_python_rpath.patch
new file mode 100644
index 0000000..84734f7
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.48.0-disable_python_rpath.patch
@@ -0,0 +1,11 @@
+--- a/tools/python.jam
++++ b/tools/python.jam
+@@ -961,7 +961,7 @@
+             # linux).
+           : $(usage-requirements)
+             <testing.launcher>$(set-PYTHONPATH)
+-              <library-path>$(libraries) <dll-path>$(dll-path) <library>python.lib
++              <library-path>$(libraries) <library>python.lib
+           ;
+     }
+ 
diff --git a/dev-util/boost-build/files/boost-build-1.49.0-darwin-gentoo-toolchain.patch b/dev-util/boost-build/files/boost-build-1.49.0-darwin-gentoo-toolchain.patch
new file mode 100644
index 0000000..032feaf
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.49.0-darwin-gentoo-toolchain.patch
@@ -0,0 +1,26 @@
+Avoid adding all kinds of things to the toolchain's flags that within
+Gentoo (Prefix) we really shouldn't, such as sysroot, deployment target,
+arch, etc.
+
+--- a/tools/darwin.jam
++++ b/tools/darwin.jam
+@@ -227,6 +227,9 @@
+         }
+     }
+     
++    # leave compiler flags etc. up to the toolchain
++    return $(version-feature) ;
++
+     if $(version-feature)
+     {
+         if $(.debug-configuration)
+@@ -387,7 +390,8 @@
+             support-ppc64 = ;
+         }
+     }
+-    switch $(arch)
++    # Gentoo Prefix toolchain doesn't do multi-arch, so don't try either
++    switch $(donotaddarchpleaseXXXarch)
+     {
+         case combined : 
+         {
diff --git a/dev-util/boost-build/files/boost-build-1.50.0-respect-c_ld-flags.patch b/dev-util/boost-build/files/boost-build-1.50.0-respect-c_ld-flags.patch
new file mode 100644
index 0000000..8775583
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.50.0-respect-c_ld-flags.patch
@@ -0,0 +1,53 @@
+--- a/engine/build.jam
++++ b/engine/build.jam
+@@ -3,7 +3,7 @@
+ #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ 
+ # Clean env vars of any "extra" empty values.
+-for local v in ARGV CC CFLAGS LIBS
++for local v in ARGV CC CFLAGS LDFLAGS LIBS
+ {
+ 	local values ;
+ 	for local x in $($(v))
+@@ -179,10 +179,10 @@
+ if ! $(CC) { CC = cc ; }
+ toolset cc $(CC) : "-o " : -D
+     : $(CFLAGS)
+-    [ opt --release : -s -O ]
++    [ opt --release : ]
+     [ opt --debug : -g ]
+     -I$(--python-include) -I$(--extra-include)
+-    : $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
++    : $(LDFLAGS) $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
+ ## Comeau C/C++ 4.x
+ toolset como como : "-o " : -D
+     : --c
+@@ -201,11 +201,11 @@
+ ## MacOSX Darwin, using GCC 2.9.x, 3.x
+ toolset darwin cc :  "-o " : -D
+     :
+-    [ opt --release : -Wl,-x -O3 -finline-functions ]
++    [ opt --release : -Wl,-x -finline-functions ]
+     [ opt --debug : -g -O0 -fno-inline -pg ]
+     [ opt --profile : -Wl,-x -O3 -finline-functions -g -pg ]
+     -I$(--python-include) -I$(--extra-include)
+-    : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
++    : $(LDFLAGS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
+ ## GCC 2.x, 3.x, 4.x
+ toolset gcc gcc : "-o " : -D
+     : -pedantic -fno-strict-aliasing
+--- a/engine/build.sh
++++ b/engine/build.sh
+@@ -224,9 +224,9 @@
+     cc)
+     if test -z "$CC" ; then CC=cc ; fi
+     BOOST_JAM_CC=$CC
+-    BOOST_JAM_OPT_JAM="$BOOST_JAM_OPT_JAM $CFLAGS $LIBS"
+-    BOOST_JAM_OPT_MKJAMBASE="$BOOST_JAM_OPT_MKJAMBASE $CFLAGS $LIBS"
+-    BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $CFLAGS $LIBS"
++    BOOST_JAM_OPT_JAM="$BOOST_JAM_OPT_JAM $CFLAGS $LDFLAGS $LIBS"
++    BOOST_JAM_OPT_MKJAMBASE="$BOOST_JAM_OPT_MKJAMBASE $CFLAGS $LDFLAGS $LIBS"
++    BOOST_JAM_OPT_YYACC="$BOOST_JAM_OPT_YYACC $CFLAGS $LDFLAGS $LIBS"
+     ;;
+ 
+     qcc)
diff --git a/dev-util/boost-build/files/boost-build-1.52.0-darwin-no-python-framework.patch b/dev-util/boost-build/files/boost-build-1.52.0-darwin-no-python-framework.patch
new file mode 100644
index 0000000..cacbe00
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.52.0-darwin-no-python-framework.patch
@@ -0,0 +1,17 @@
+Don't look for the framework path, we build Python the UNIX way for
+Gentoo Prefix
+
+--- a/engine/build.jam
++++ b/engine/build.jam
+@@ -82,11 +82,6 @@
+         }
+         --python-lib = $(--python-lib[1]) ;
+     }
+-    else if $(OS) = MACOSX
+-    {
+-        --python-include = [ .path $(python-location) Headers ] ;
+-        --python-lib = $(python-location) Python ;
+-    }
+     else
+     {
+         --python-include = ;
diff --git a/dev-util/boost-build/files/boost-build-1.54.0-fix-test.patch b/dev-util/boost-build/files/boost-build-1.54.0-fix-test.patch
new file mode 100644
index 0000000..3f8b177
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.54.0-fix-test.patch
@@ -0,0 +1,11 @@
+--- a/test/startup_v2.py
++++ b/test/startup_v2.py
+@@ -50,7 +50,7 @@
+     return re.match(expected, actual, re.DOTALL) != None
+ 
+ 
+-t = BoostBuild.Tester(match=match_re, boost_build_path="", pass_toolset=0)
++t = BoostBuild.Tester(match=match_re, boost_build_path="/invalid/location", pass_toolset=0)
+ t.set_tree("startup")
+ check_for_existing_boost_build_jam(t)
+ 
diff --git a/dev-util/boost-build/files/boost-build-1.54.0-support_dots_in_python-buildid.patch b/dev-util/boost-build/files/boost-build-1.54.0-support_dots_in_python-buildid.patch
new file mode 100644
index 0000000..a04aa0b
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.54.0-support_dots_in_python-buildid.patch
@@ -0,0 +1,19 @@
+--- a/tools/common.jam
++++ b/tools/common.jam
+@@ -763,7 +763,15 @@
+         switch $(f:G)
+         {
+             case <base> :
+-                result += $(name:B) ;
++		local matched = [ MATCH "^(boost.*python)-.*" : $(name) ] ;
++		if $(matched) = boost_python || $(matched) = boost_mpi_python
++		{
++			result += $(name) ;
++		}
++		else
++		{
++			result += $(name:B) ;
++		}
+ 
+             case <toolset> :
+                 result += [ join-tag $(f:G=) : [ toolset-tag $(name) : $(type) :
diff --git a/dev-util/boost-build/files/boost-build-1.55.0-ppc-aix.patch b/dev-util/boost-build/files/boost-build-1.55.0-ppc-aix.patch
new file mode 100644
index 0000000..d8b6a5a
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.55.0-ppc-aix.patch
@@ -0,0 +1,13 @@
+https://svn.boost.org/trac/boost/ticket/10122
+
+--- a/engine/mem.h
++++ b/engine/mem.h
+@@ -8,6 +8,8 @@
+ #ifndef BJAM_MEM_H
+ #define BJAM_MEM_H
+ 
++#include "jam.h"
++
+ #ifdef OPT_BOEHM_GC
+ 
+     /* Use Boehm GC memory allocator. */
diff --git a/dev-util/boost-build/files/boost-build-1.66.0-add-none-feature-options.patch b/dev-util/boost-build/files/boost-build-1.66.0-add-none-feature-options.patch
new file mode 100644
index 0000000..fd86c9e
--- /dev/null
+++ b/dev-util/boost-build/files/boost-build-1.66.0-add-none-feature-options.patch
@@ -0,0 +1,26 @@
+diff --git a/tools/features/debug-feature.jam b/tools/features/debug-feature.jam
+index 04958f9a..38b6acf1 100644
+--- a/tools/features/debug-feature.jam
++++ b/tools/features/debug-feature.jam
+@@ -8,7 +8,7 @@
+ import feature ;
+ 
+ feature.feature debug-symbols
+-    : on off
++    : on off none
+     : propagated ;
+ 
+ feature.feature profiling
+diff --git a/tools/features/optimization-feature.jam b/tools/features/optimization-feature.jam
+index 761f76f1..fb2a5dec 100644
+--- a/tools/features/optimization-feature.jam
++++ b/tools/features/optimization-feature.jam
+@@ -8,7 +8,7 @@
+ import feature ;
+ 
+ feature.feature optimization
+-    : off speed space
++    : off none speed space
+     : propagated ;
+ 
+ feature.feature inlining
diff --git a/dev-util/boost-build/files/site-config.jam b/dev-util/boost-build/files/site-config.jam
new file mode 100644
index 0000000..6afe526
--- /dev/null
+++ b/dev-util/boost-build/files/site-config.jam
@@ -0,0 +1,11 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the Boost Software License, Version 1.0. 
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 
+
+# Define two new variants to be used when building boost (or separate boost-libs)
+# on Gentoo. The two variants make use of Gentoo-specific optimization and debug-symbols
+# values "none" which are not part of the official boost distribution.
+# DO NOT RELY ON THE FOLLOWING VARIANTS TO BE PRESENT ON OTHER OS!
+variant gentoorelease : release : <optimization>none <debug-symbols>none <runtime-link>shared ;
+variant gentoodebug   : debug   : <optimization>none <debug-symbols>on   <runtime-link>shared ;
+
diff --git a/net-libs/nghttp2/Manifest b/net-libs/nghttp2/Manifest
new file mode 100644
index 0000000..cbd3c1f
--- /dev/null
+++ b/net-libs/nghttp2/Manifest
@@ -0,0 +1,2 @@
+DIST nghttp2-1.32.0.tar.xz 1548528 SHA256 700a89d59fcc55acc2b18184001bfb3220fa6a6e543486aca35f40801cba6f7d SHA512 ec7e417fbc5497861d2b6dde5145da1640b36441882824e85940e5ca6ac52ec444aa7123846960f7211dd96462eab421d39f9cc49454f3f52e0dcdb36402044e WHIRLPOOL b8efda634a04849f78dbd3c34d57a923e65c006660a7e1163491edb871ede6a68aafedb9baa3a8a630908e06dfd347638da62f8d302c03b223e99768fb0131d1
+EBUILD nghttp2-1.32.0.ebuild 1875 SHA256 b0280e167c85aca14dab085351ed3b9d4af83f67e3b441173e1e04f509b72145 SHA512 e57d14993874cbe2804ea7f78846fc03a975eca5474f143fc7497800fc0c2abcf94d2b636be4f55ba2d58f516dfccb880ad4342b8be245d4439104387d1dffbc WHIRLPOOL 1f258d7a457555eda469be4b9a7b4d59e4261aaf9aaf422acc51d364b60cdcc612caf799ad5d34726e51149bc57628f2ca28a0a3023ddd18c7c6f0637fc3aeba
diff --git a/net-libs/nghttp2/nghttp2-1.32.0.ebuild b/net-libs/nghttp2/nghttp2-1.32.0.ebuild
new file mode 100644
index 0000000..f472f1d
--- /dev/null
+++ b/net-libs/nghttp2/nghttp2-1.32.0.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# TODO: Add python support.
+
+EAPI=6
+
+inherit multilib-minimal
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://github.com/nghttp2/nghttp2.git"
+	inherit git-r3
+else
+	SRC_URI="https://github.com/nghttp2/nghttp2/releases/download/v${PV}/${P}.tar.xz"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd"
+fi
+
+DESCRIPTION="HTTP/2 C Library"
+HOMEPAGE="https://nghttp2.org/"
+
+LICENSE="MIT"
+SLOT="0/1.14" # <C++>.<C> SONAMEs
+IUSE="cxx debug hpack-tools jemalloc libressl static-libs test +threads utils xml"
+
+SSL_DEPEND="
+	!libressl? ( >=dev-libs/openssl-1.0.2:0=[-bindist,${MULTILIB_USEDEP}] )
+	libressl? ( dev-libs/libressl:=[${MULTILIB_USEDEP}] )
+"
+RDEPEND="
+	cxx? (
+		${SSL_DEPEND}
+		dev-libs/boost:=[${MULTILIB_USEDEP},threads]
+	)
+	hpack-tools? ( >=dev-libs/jansson-2.5 )
+	jemalloc? ( dev-libs/jemalloc[${MULTILIB_USEDEP}] )
+	utils? (
+		${SSL_DEPEND}
+		>=dev-libs/libev-4.15[${MULTILIB_USEDEP}]
+		>=sys-libs/zlib-1.2.3[${MULTILIB_USEDEP}]
+		net-dns/c-ares:=[${MULTILIB_USEDEP}]
+	)
+	xml? ( >=dev-libs/libxml2-2.7.7:2[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	test? ( >=dev-util/cunit-2.1[${MULTILIB_USEDEP}] )"
+
+multilib_src_configure() {
+	local myeconfargs=(
+		--disable-examples
+		--disable-failmalloc
+		--disable-werror
+		--without-cython
+		--disable-python-bindings
+		$(use_enable cxx asio-lib)
+		$(use_enable debug)
+		$(multilib_native_use_enable hpack-tools)
+		$(use_enable static-libs static)
+		$(use_enable threads)
+		$(multilib_native_use_enable utils app)
+		$(multilib_native_use_with jemalloc)
+		$(multilib_native_use_with xml libxml2)
+	)
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_install_all() {
+	use static-libs || find "${ED%/}"/usr -name '*.la' -delete
+}
