Browse Source

Ср янв 2 13:49:05 MSK 2019

Mike Tatarko 5 months ago
parent
commit
9e986032c5

+ 17 - 0
dev-libs/cyrus-sasl/Manifest

@@ -0,0 +1,17 @@
+AUX cyrus-sasl-2.1.25-auxprop.patch 552 SHA256 d9f63e60aa664f064755151fb5aa442ed52a3053057b5a63f2d88c937906dc7c SHA512 73ae914e684ae698eb56a1579ba9a477a946625a3b079e2b400d88583074f1701d8a6926ed17dea36b923050f21c04fbf746d54284568bd21c14be3d10283b6f WHIRLPOOL 899e41790b71a55983fa99c09e3b9b28667e2e7f457bdc39028ad705883676f4363bbd968c04b35fe2ce84fd08c1b5daad73b988f6e2299f1c129e59bc65f93f
+AUX cyrus-sasl-2.1.26-missing-size_t.patch 280 SHA256 f4f52413ec6643247be6e84e2cc2092b2a4e1a3b8e287f1810b32d264489188a SHA512 d6ed3a981da06f60d63b0364d8d841922bb007bf478b67558e88e9b297a4ed7c8eee9501e232d9ca17601f63f6c1cf04962a59c4f0c24fc641868d56006b3616 WHIRLPOOL 7ca626720a5ad5653dc54f9df78b38acf58228b5fbef953b4292f4c5599505d0dde8b8a92e0b5607f6404d0a7572bce14aec20b60e8b2813d1d70329ddf71c13
+AUX cyrus-sasl-2.1.27-as_needed.patch 1141 SHA256 194c738218375785096309235114bd9d27d5861a13dc9204cc805f7286c3b414 SHA512 9eefa6d45e3dd9157a5672909acdd88f0ae35e76d64c3723890a474bbb05b22499cfadb0c077924d27f34da3710b2b700094dd7d5704050138c08dabcefdde94 WHIRLPOOL 98051e072ca6afd1b213db34d801ed5948a53620481a2719012b0909ee0b45f333e26d2ee728d60ad07445dae45019854d0399cb654375265488c6238a39fe2b
+AUX cyrus-sasl-2.1.27-autotools_fixes.patch 749 SHA256 9cf730cb819ccd0a3bfa2b03833dd7c37adabec372ce0392745690640063c757 SHA512 0d99ca049e76c11500769079d94f3bdb634bddb4c8d45a83b383e9bb9777edda66b17566800acbd450e1f4842d070ec3fbc236e7f0ef8759c36e6dd5ea8e3c64 WHIRLPOOL 11d5a3d3906fd5d146ff77c91e21f3eafb292723b76a7ece625fc0089a56495eea0f3c9c934f5cdc61bd1b97a2ca4e4e2e4724840a0141d0d8237cb9bf5729b6
+AUX cyrus-sasl-2.1.27-avoid_pic_overwrite.patch 866 SHA256 4ef488887ae95a3792cd9ec55ceeee03b8a5c27bb09dc463946d516664db0de4 SHA512 4ca601839b023ef790e48dae567ffbbd57c632384c980946639ec7437ad23874961451718569455e6e25afaeff1728ecbc71a8686f6b43246f83465f95a2c904 WHIRLPOOL 292ee0a9c358f99910ce9dfe0d5fd3aac267f6565443dfbe11128125283017c2e92fdddb95b21fff1783a2a754e5300c84f3d3db42f50874b82fc56d7bdff46f
+AUX cyrus-sasl-2.1.27-doc_build_fix.patch 417 SHA256 d7f2b1394294efcbb7480d9dae17e0083c79e40c6049ff2a620c83dd2a60bf36 SHA512 6d723e7ec2c431b45c011b887187b6a670dbe646aa4c39d38171047ab23db529c30c433f8d4dd624181917c5ce4e5271f86e35e2644ede1c40dfb09cb67dccde WHIRLPOOL 3c1eac5489c7edfeb216560b800cbb175bf5b87063ffa2f8d00e35aca816f1c4d7bf9bdfd655efa7d794413570519886514e06ddcc8794212956432415e2c28c
+AUX cyrus-sasl-2.1.27-gss_c_nt_hostbased_service.patch 734 SHA256 bffd105fc6270fe5744c6204785f12acd167f848e28d67b47d0fa67f1b67b456 SHA512 fca4f2b7e427c7613f71daa4a31772c33c8c0fe9d7f85b57b85da71bc5a88a18fc52f7caea463188b4addd31cd041d5349af689d5face2cc45fb50c700a8afd7 WHIRLPOOL 4610980af54dfbc706a62666ae7d655402693efb9df8a724d5a5003db1b76a0495aa6b0bb904ae00ad8cb95c671bd8e474e8f21603145eb08e0e45d7d2a4027b
+AUX cyrus-sasl.conf 34 SHA256 1d246914153ca86390e7c39aaa9494ce1175d783d3292a8cc5a2d867b816fb7b SHA512 67b9bb97191d091ffc2b8f450ad88a558df304a29651a9a49407c50df0a316666a96e7d1a2ca3ac8ee5e60a58a5d5b618ce963661f4f45049dc6b3ef2cf8099e WHIRLPOOL 671625830fc9df9b44fff4d7fe16a7d7e76c42e8c1cf75cc7a725586aad3f80b98aa5a07ae5dea848833aed6aa02294c2a7b9969f1e708dd6854370a62c5cd23
+AUX pwcheck.rc6 409 SHA256 64f6eb6c0e1dfab8a03de9e951b710bbacac0bd806ea5d2a6d3d10f6c6ab499a SHA512 797317f0361d6d849ca35c5189ba0cb562e58d62022ce7c29229aab71e8ce4c1e3e6409cd3b092b666724a00b0b3b6071e527cc49050fc34590ef3b1a7648f8a WHIRLPOOL d930022d08bafbd17634b1f66ada0d8625ba0a35d69a154328bbc1875e2943064739bc9d884e9dacb584f3ccc6073be19d17a2441d6a1bb4c8d13ff456900827
+AUX pwcheck.service 129 SHA256 6b4dd0f703dfb4d61f24f3ba42884d83eba4a8cd06eb794cc7cd8bebc6c93da5 SHA512 73e01063bf308cbdc45400d4d0b61f81eade8453acec71b2ac0c0acf1ee458881aab2876cbd47208f87c6a9f298846eb509e14eb01b985c4f9e0ad4db1d8b751 WHIRLPOOL 04ba7e1e7ddf7f5cccfc6ffa0d2bc6b7c47eb0d933409dc85eb1176e374a8a1dc1844221c6fe30a0341487226f1f42ea0473a5cc1c3455a06d071ed7ff625b46
+AUX saslauthd-2.1.26.conf 687 SHA256 b29db7875abe6d2bff694b065a895f1a3d8c2647dff1a871282c0cb471e69455 SHA512 4859a9659f580c93bfd47cdbd997ec3c75fa829721532061bee0f1736be897b9e59478ab33e216a588d072b866e4b61f7893a16b36ceadf016bda083eee26e0f WHIRLPOOL ee3b9d822f59755cee41ed2c6bdc0fd697d90909ae2485cabae783ce73bd1d94f9ef3b0b127587bef42e0b290b93562651eb3d21623c90f404a4979776d78d13
+AUX saslauthd.pam-include 160 SHA256 97166de49d227cf5ff305168ea75ca584feda9ab87d1eb1437638861986e70ba SHA512 14fcfc0f69dacd25ac9b298cf44b0b44146d418424ef16e66edf8893353e418ef53beebb7199bd516b828c40954e4875ab5659f50a09af12ef2a371b944b45b1 WHIRLPOOL cc1c48bb92cf89ed9f29df2469823bd7bfa96b97fa8d6d33c7cfedef1e1a2ee12e66a0c34b7a992a631d4f446dfa4e9769d5b2c08dae5039115c00514f8a40e9
+AUX saslauthd.service 277 SHA256 a8157a0748269d3534ac6f01bbf61f0215c665b50dbbf94fc2399b6d3287a677 SHA512 fa318aefec6f802badd72a4baf33875bc0021fc4889578877880971470d84bf645ad3c34dd10c582d8cc06ea512e3d56984902efaf09e2806a27feade5fc971c WHIRLPOOL 18f74f1caac60b7bbf58edf41b78c5d670a6892c8c763e05b026c930565dfb2c3ac7b6763e518824fe93c560c5f1f7e42306e950c1a942b38e0ec23824b74e89
+AUX saslauthd2.rc7 411 SHA256 dea35c48fdc94e475b427cb47ff47b914a66311afbd2d8397a833a60e4c1a7a4 SHA512 1d5942a94ffbc15774443d60a88d4c89c7c3c6ea68b041d304f0110f6ec3aa2a812f59021cddc78de6f51a25bb00955e4e56d769e766a9d856f13774dd37ce83 WHIRLPOOL 30c85e257b7592fa69adcbb3e6671045c7420a6079d2db175a40a9e2ea7c8cb3c0110d1be9fb101a2da17ca2823e82dc125656a0174dfb5cb2b7b21fd7904ae8
+DIST cyrus-sasl-2.1.27.tar.gz 4111249 SHA256 26866b1549b00ffd020f188a43c258017fa1c382b3ddadd8201536f72efb05d5 SHA512 d11549a99b3b06af79fc62d5478dba3305d7e7cc0824f4b91f0d2638daafbe940623eab235f85af9be38dcf5d42fc131db531c177040a85187aee5096b8df63b WHIRLPOOL 34c353de02fdf6af09314c5768ad75ebbb555cdeb88095f9eead17c9e67ba3557c5ceb6b80d505c8e8b0acfdc7e8958ee30b4f8d1ebacba68f9ac2fb4bf6a29a
+EBUILD cyrus-sasl-2.1.27.ebuild 7759 SHA256 097bf6ce6d094549bcedc9433ad668e112af41ee4e70802427eed11bac164a56 SHA512 b71360a99eb240df727babe8b5ec6cb7217167fc1bceebac0181199cba3acf4cf2fd5a75d1315fd198186e71bac8d85d388513ef67bd87ad9c231ca7285af401 WHIRLPOOL 9248c481ce863738479da4a88f849e709a116def18dbcda5bc49b59c3d69bebb5adf18bb6ef84cb198bd6aefbd504427cc31f10d9c60a50014f72a0825636ab8
+MISC metadata.xml 706 SHA256 a20b99c5a9e2b9f98988c79cf520b26aeb4dc4fcc5ce64df4dbdf7edda1bae58 SHA512 1e7495deff4727296d29b25b7af535c0b36054b9172763ca8634b40f324dbc33697424a7e5565791c3131def3708c9ffb7e3e2362cbd8b334d650921fc2291ce WHIRLPOOL aa1f700aa5595aa60f2ad7befa95a055ca19aeeb059a3b5bd403f04e6da71d12de38d0dee7b3c4c8eb85cb454149bdbb408b7902fa38348ca0338d2396d21bfb

+ 253 - 0
dev-libs/cyrus-sasl/cyrus-sasl-2.1.27.ebuild

@@ -0,0 +1,253 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit flag-o-matic multilib multilib-minimal autotools pam java-pkg-opt-2 db-use systemd eapi7-ver
+
+SASLAUTHD_CONF_VER="2.1.26"
+
+DESCRIPTION="The Cyrus SASL (Simple Authentication and Security Layer)"
+HOMEPAGE="https://www.cyrusimap.org/sasl/"
+SRC_URI="https://github.com/cyrusimap/${PN}/releases/download/${P}/${P}.tar.gz"
+
+LICENSE="BSD-with-attribution"
+SLOT="2"
+KEYWORDS="~amd64 ~x86"
+IUSE="authdaemond berkdb doc gdbm kerberos ldapdb libressl openldap mysql pam postgres sample selinux sqlite srp ssl static-libs urandom"
+
+CDEPEND="
+	net-mail/mailbase
+	authdaemond? ( || ( net-mail/courier-imap mail-mta/courier ) )
+	berkdb? ( >=sys-libs/db-4.8.30-r1:=[${MULTILIB_USEDEP}] )
+	gdbm? ( >=sys-libs/gdbm-1.10-r1:=[${MULTILIB_USEDEP}] )
+	kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
+	openldap? ( >=net-nds/openldap-2.4.38-r1[${MULTILIB_USEDEP}] )
+	mysql? ( virtual/mysql )
+	pam? ( >=virtual/pam-0-r1[${MULTILIB_USEDEP}] )
+	postgres? ( dev-db/postgresql:* )
+	sqlite? ( >=dev-db/sqlite-3.8.2:3[${MULTILIB_USEDEP}] )
+	ssl? (
+		!libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+		libressl? ( dev-libs/libressl:=[${MULTILIB_USEDEP}] )
+	)
+	java? ( >=virtual/jdk-1.6:= )"
+
+RDEPEND="
+	${CDEPEND}
+	selinux? ( sec-policy/selinux-sasl )"
+
+DEPEND="${CDEPEND}
+	doc? (
+		dev-perl/Pod-POM-View-Restructured
+		dev-python/sphinx 
+	)"
+
+MULTILIB_WRAPPED_HEADERS=(
+	/usr/include/sasl/md5global.h
+)
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.1.27-avoid_pic_overwrite.patch"
+	"${FILESDIR}/${PN}-2.1.27-autotools_fixes.patch"
+	"${FILESDIR}/${PN}-2.1.27-as_needed.patch"
+	"${FILESDIR}/${PN}-2.1.25-auxprop.patch"
+	"${FILESDIR}/${PN}-2.1.27-gss_c_nt_hostbased_service.patch"
+	"${FILESDIR}/${PN}-2.1.26-missing-size_t.patch"
+	"${FILESDIR}/${PN}-2.1.27-doc_build_fix.patch"
+)
+
+pkg_setup() {
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# Get rid of the -R switch (runpath_switch for Sun)
+	# >=gcc-4.6 errors out with unknown option
+	sed -i -e '/LIB_SQLITE.*-R/s/ -R[^"]*//' \
+		configure.ac || die
+
+	# Use plugindir for sasldir
+	sed -i '/^sasldir =/s:=.*:= $(plugindir):' \
+		"${S}"/plugins/Makefile.{am,in} || die "sed failed"
+
+	# #486740 #468556
+	sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:g' \
+		-e 's:AC_CONFIG_MACRO_DIR:AC_CONFIG_MACRO_DIRS:g' \
+		configure.ac || die
+
+	eautoreconf
+}
+
+src_configure() {
+	append-flags -fno-strict-aliasing
+	if [[ ${CHOST} == *-solaris* ]] ; then
+		# getpassphrase is defined in /usr/include/stdlib.h
+		append-cppflags -DHAVE_GETPASSPHRASE
+	else
+		# this horrendously breaks things on Solaris
+		append-cppflags -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -DLDAP_DEPRECATED
+	fi
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+	# Java support.
+	multilib_is_native_abi && use java && export JAVAC="${JAVAC} ${JAVACFLAGS}"
+
+	local myeconfargs=(
+		--enable-login
+		--enable-ntlm
+		--enable-auth-sasldb
+		--disable-cmulocal
+		--disable-krb4
+		--disable-macos-framework
+		--enable-otp
+		--without-sqlite
+		--with-saslauthd="${EPREFIX}"/run/saslauthd
+		--with-pwcheck="${EPREFIX}"/run/saslauthd
+		--with-configdir="${EPREFIX}"/etc/sasl2
+		--with-plugindir="${EPREFIX}"/usr/$(get_libdir)/sasl2
+		--with-dbpath="${EPREFIX}"/etc/sasl2/sasldb2
+		$(use_with ssl openssl)
+		$(use_with pam)
+		$(use_with openldap ldap)
+		$(use_enable ldapdb)
+		$(multilib_native_use_enable sample)
+		$(use_enable kerberos gssapi)
+		$(multilib_native_use_enable java)
+		$(multilib_native_use_with mysql mysql "${EPREFIX}"/usr)
+		$(multilib_native_use_with postgres pgsql "${EPREFIX}"/usr/$(get_libdir)/postgresql)
+		$(use_with sqlite sqlite3 "${EPREFIX}"/usr/$(get_libdir))
+		$(use_enable srp)
+		$(use_enable static-libs static)
+
+		# Add authdaemond support (bug #56523).
+		$(usex authdaemond --with-authdaemond="${EPREFIX}"/var/lib/courier/authdaemon/socket '')
+
+		# Fix for bug #59634.
+		$(usex ssl '' --without-des)
+
+		# Use /dev/urandom instead of /dev/random (bug #46038).
+		$(usex urandom --with-devrandom=/dev/urandom '')
+	)
+
+	if use sqlite || { multilib_is_native_abi && { use mysql || use postgres; }; } ; then
+		myeconfargs+=( --enable-sql )
+	else
+		myeconfargs+=( --disable-sql )
+	fi
+
+	# Default to GDBM if both 'gdbm' and 'berkdb' are present.
+	if use gdbm ; then
+		einfo "Building with GNU DB as database backend for your SASLdb"
+		myeconfargs+=( --with-dblib=gdbm )
+	elif use berkdb ; then
+		einfo "Building with BerkeleyDB as database backend for your SASLdb"
+		myeconfargs+=(
+			--with-dblib=berkeley
+			--with-bdb-incdir="$(db_includedir)"
+		)
+	else
+		einfo "Building without SASLdb support"
+		myeconfargs+=( --with-dblib=none )
+	fi
+
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_compile() {
+	emake
+
+	# Default location for java classes breaks OpenOffice (bug #60769).
+	# Thanks to axxo@gentoo.org for the solution.
+	if multilib_is_native_abi && use java ; then
+		jar -cvf ${PN}.jar -C java $(find java -name "*.class")
+	fi
+}
+
+multilib_src_install() {
+	default
+
+	if multilib_is_native_abi; then
+		if use sample ; then
+			docinto sample
+			dodoc "${S}"/sample/*.c
+			exeinto /usr/share/doc/${P}/sample
+			doexe sample/client sample/server
+		fi
+
+		# Default location for java classes breaks OpenOffice (bug #60769).
+		if use java; then
+			java-pkg_dojar ${PN}.jar
+			java-pkg_regso "${ED}/usr/$(get_libdir)/libjavasasl$(get_libname)"
+			# hackish, don't wanna dig through makefile
+			rm -rf "${ED}/usr/$(get_libdir)/java" || die
+			docinto "java"
+			dodoc "${S}/java/README" "${FILESDIR}/java.README.gentoo" "${S}"/java/doc/*
+			dodir "/usr/share/doc/${PF}/java/Test"
+			insinto "/usr/share/doc/${PF}/java/Test"
+			doins "${S}"/java/Test/*.java
+		fi
+
+		dosbin saslauthd/testsaslauthd
+	fi
+}
+
+multilib_src_install_all() {
+	keepdir /etc/sasl2
+
+	dodoc AUTHORS ChangeLog doc/legacy/TODO
+	newdoc pwcheck/README README.pwcheck
+
+	newdoc docsrc/sasl/release-notes/$(ver_cut 1-2)/index.rst release-notes
+	edos2unix ${ED%/}/usr/share/doc/${PF}/release-notes
+
+	docinto html
+	dodoc doc/html/*.html
+
+	newpamd "${FILESDIR}/saslauthd.pam-include" saslauthd
+
+	newinitd "${FILESDIR}/pwcheck.rc6" pwcheck
+	systemd_dounit "${FILESDIR}/pwcheck.service"
+
+	newinitd "${FILESDIR}/saslauthd2.rc7" saslauthd
+	newconfd "${FILESDIR}/saslauthd-${SASLAUTHD_CONF_VER}.conf" saslauthd
+	systemd_dounit "${FILESDIR}/saslauthd.service"
+	systemd_dotmpfilesd "${FILESDIR}/${PN}.conf"
+
+	# The get_modname bit is important: do not remove the .la files on
+	# platforms where the lib isn't called .so for cyrus searches the .la to
+	# figure out what the name is supposed to be instead
+	if ! use static-libs && [[ $(get_modname) == .so ]] ; then
+		find "${ED}" -name "*.la" -delete || die
+	fi
+}
+
+pkg_postinst () {
+	# Generate an empty sasldb2 with correct permissions.
+	if ( use berkdb || use gdbm ) && [[ ! -f "${EROOT}/etc/sasl2/sasldb2" ]] ; then
+		einfo "Generating an empty sasldb2 with correct permissions ..."
+		echo "p" | "${EROOT}/usr/sbin/saslpasswd2" -f "${EROOT}/etc/sasl2/sasldb2" -p login \
+			|| die "Failed to generate sasldb2"
+		"${EROOT}/usr/sbin/saslpasswd2" -f "${EROOT}/etc/sasl2/sasldb2" -d login \
+			|| die "Failed to delete temp user"
+		chown root:mail "${EROOT}/etc/sasl2/sasldb2" \
+			|| die "Failed to chown ${EROOT}/etc/sasl2/sasldb2"
+		chmod 0640 "${EROOT}/etc/sasl2/sasldb2" \
+			|| die "Failed to chmod ${EROOT}/etc/sasl2/sasldb2"
+	fi
+
+	if use authdaemond ; then
+		elog "You need to add a user running a service using Courier's"
+		elog "authdaemon to the 'mail' group. For example, do:"
+		elog "	gpasswd -a postfix mail"
+		elog "to add the 'postfix' user to the 'mail' group."
+	fi
+
+	elog "pwcheck and saslauthd home directories have moved to:"
+	elog "  /run/saslauthd, using tmpfiles.d"
+}

+ 16 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.25-auxprop.patch

@@ -0,0 +1,16 @@
+https://bugzilla.cyrusimap.org/show_bug.cgi?id=3590
+https://bugs.gentoo.org/show_bug.cgi?id=392761
+
+--- cyrus-sasl-2.1.25/lib/auxprop.c~	2011-10-20 17:33:46.423015318 +0200
++++ cyrus-sasl-2.1.25/lib/auxprop.c	2011-10-20 17:48:49.336348654 +0200
+@@ -971,6 +971,10 @@
+     }
+ 
+     if(!found) {
++	/* compatibility with <= 2.1.23, ignore the lack of auxrop plugin */
++	if (!plist)
++	    result = SASL_OK;
++	else
+ 	_sasl_log(sparams->utils->conn, SASL_LOG_DEBUG,
+ 		  "could not find auxprop plugin, was searching for '%s'",
+ 		  plist ? plist : "[all]");

+ 13 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.26-missing-size_t.patch

@@ -0,0 +1,13 @@
+Gentoo bug #458790
+--- a/include/sasl.h
++++ b/include/sasl.h
+@@ -121,6 +121,9 @@
+ #ifndef SASL_H
+ #define SASL_H 1
+ 
++/* stddef.h to get size_t defined */
++#include <stddef.h>
++
+ /* Keep in sync with win32/common.mak */
+ #define SASL_VERSION_MAJOR 2
+ #define SASL_VERSION_MINOR 1

+ 25 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.27-as_needed.patch

@@ -0,0 +1,25 @@
+Author: Matthias Klose <doko@ubuntu.com>
+Desription: Fix FTBFS, add $(SASL_DB_LIB) as dependency to libsasldb, and use
+it.
+--- cyrus-sasl-2.1.27/saslauthd/Makefile.am
++++ cyrus-sasl-2.1.27/saslauthd/Makefile.am
+@@ -25,7 +25,7 @@
+ saslauthd_DEPENDENCIES = saslauthd-main.o $(LTLIBOBJS_FULL)
+ saslauthd_LDADD	= @SASL_KRB_LIB@ \
+ 		  @GSSAPIBASE_LIBS@ @LIB_CRYPT@ @LIB_SIA@ \
+-		  @LIB_SOCKET@ @SASL_DB_LIB@ @LIB_PAM@ @LDAP_LIBS@ $(LTLIBOBJS_FULL) $(CRYPTO_COMPAT_OBJS) $(LIBSASLDB_OBJS)
++		  @LIB_SOCKET@ ../sasldb/libsasldb.la @LIB_PAM@ @LDAP_LIBS@ $(LTLIBOBJS_FULL) $(CRYPTO_COMPAT_OBJS) $(LIBSASLDB_OBJS)
+ 
+ testsaslauthd_SOURCES = testsaslauthd.c utils.c
+ testsaslauthd_LDADD = @LIB_SOCKET@
+--- cyrus-sasl-2.1.27/sasldb/Makefile.am
++++ cyrus-sasl-2.1.27/sasldb/Makefile.am
+@@ -54,6 +54,6 @@
+ 
+ libsasldb_la_SOURCES = allockey.c sasldb.h
+ EXTRA_libsasldb_la_SOURCES = $(extra_common_sources)
+-libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND)
+-libsasldb_la_LIBADD = $(SASL_DB_BACKEND)
++libsasldb_la_DEPENDENCIES = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
++libsasldb_la_LIBADD = $(SASL_DB_BACKEND) $(SASL_DB_LIB)
+ libsasldb_la_LDFLAGS = -no-undefined

+ 31 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.27-autotools_fixes.patch

@@ -0,0 +1,31 @@
+--- cyrus-sasl-2.1.27/configure.ac
++++ cyrus-sasl-2.1.27/configure.ac
+@@ -44,6 +44,8 @@
+ 
+ AC_PREREQ(2.63)
+ 
++AC_CONFIG_MACRO_DIR([config])
++
+ dnl
+ dnl REMINDER: When changing the version number here, please also update
+ dnl the values in win32/include/config.h and include/sasl.h as well.
+--- cyrus-sasl-2.1.27/Makefile.am
++++ cyrus-sasl-2.1.27/Makefile.am
+@@ -44,6 +44,8 @@
+ #
+ ################################################################
+ 
++ACLOCAL_AMFLAGS = -I config
++
+ if SASLAUTHD
+ SAD = saslauthd
+ else
+--- cyrus-sasl-2.1.27/saslauthd/Makefile.am
++++ cyrus-sasl-2.1.27/saslauthd/Makefile.am
+@@ -1,4 +1,6 @@
+ AUTOMAKE_OPTIONS = 1.7
++ACLOCAL_AMFLAGS = -I ../config
++
+ sbin_PROGRAMS	= saslauthd testsaslauthd
+ EXTRA_PROGRAMS  = saslcache
+ 

+ 17 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.27-avoid_pic_overwrite.patch

@@ -0,0 +1,17 @@
+Author: Fabian Fagerholm <fabbe@debian.org>
+Description: This patch makes sure the non-PIC version of libsasldb.a, which
+is created out of non-PIC objects, is not going to overwrite the PIC version,
+which is created out of PIC objects. The PIC version is placed in .libs, and
+the non-PIC version in the current directory.  This ensures that both non-PIC
+and PIC versions are available in the correct locations.
+--- cyrus-sasl-2.1.27/lib/Makefile.am
++++ cyrus-sasl-2.1.27/lib/Makefile.am
+@@ -98,7 +98,7 @@
+ 
+ libsasl2.a: libsasl2.la $(SASL_STATIC_OBJS)
+ 	@echo adding static plugins and dependencies
+-	$(AR) cru .libs/$@ $(SASL_STATIC_OBJS)
++	$(AR) cru $@ $(SASL_STATIC_OBJS)
+ 	@for i in ./libsasl2.la ../common/libplugin_common.la ../sasldb/libsasldb.la ../plugins/lib*.la; do \
+ 	if test ! -f $$i; then continue; fi; . $$i; \
+ 	for j in $$dependency_libs foo; do \

+ 11 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.27-doc_build_fix.patch

@@ -0,0 +1,11 @@
+--- cyrus-sasl-2.1.27/docsrc/exts/sphinxlocal/writers/manpage.py
++++ cyrus-sasl-2.1.27/docsrc/exts/sphinxlocal/writers/manpage.py
+@@ -23,7 +23,7 @@
+ from sphinx import addnodes
+ from sphinx.locale import admonitionlabels, _
+ from sphinx.util.osutil import ustrftime
+-from sphinx.util.compat import docutils_version
++#from sphinx.util.compat import docutils_version
+ 
+ class CyrusManualPageWriter(ManualPageWriter):
+ 

+ 16 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl-2.1.27-gss_c_nt_hostbased_service.patch

@@ -0,0 +1,16 @@
+Gentoo bug #389349
+--- cyrus-sasl-2.1.27/m4/sasl2.m4
++++ cyrus-sasl-2.1.27/m4/sasl2.m4
+@@ -220,7 +220,11 @@
+                  [AC_WARN([Cybersafe define not found])])
+ 
+   elif test "$ac_cv_header_gssapi_h" = "yes"; then
+-    AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
++    AC_EGREP_CPP(hostbased_service_gss_nt_yes, gssapi.h,
++                 [#include <gssapi.h>
++                  #ifdef GSS_C_NT_HOSTBASED_SERVICE
++                    hostbased_service_gss_nt_yes
++                  #endif],
+                     [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,
+                                [Define if your GSSAPI implementation defines GSS_C_NT_HOSTBASED_SERVICE])])
+   elif test "$ac_cv_header_gssapi_gssapi_h"; then

+ 1 - 0
dev-libs/cyrus-sasl/files/cyrus-sasl.conf

@@ -0,0 +1 @@
+d /run/saslauthd 0755 root root -

+ 20 - 0
dev-libs/cyrus-sasl/files/pwcheck.rc6

@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	need localmount
+	use logger
+}
+
+start() {
+	ebegin "Starting sasl pwcheck daemon"
+	start-stop-daemon --start --quiet --exec /usr/sbin/pwcheck
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping sasl pwcheck daemon"
+	start-stop-daemon --stop --quiet --exec /usr/sbin/pwcheck
+	eend $?
+}

+ 9 - 0
dev-libs/cyrus-sasl/files/pwcheck.service

@@ -0,0 +1,9 @@
+[Unit]
+Description=SASL pwcheck daemon
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/pwcheck
+
+[Install]
+WantedBy=multi-user.target

+ 19 - 0
dev-libs/cyrus-sasl/files/saslauthd-2.1.26.conf

@@ -0,0 +1,19 @@
+# Config file for /etc/init.d/saslauthd and systemd unit
+
+# PLEASE READ THIS IF YOU ARE USING SYSTEMD
+# Please note that systemd does not expand shell variables
+# thus, something like FOO="${FOO} bar" won't work.
+
+# Specify the authentications mechanism.
+# **NOTE** For a list see: saslauthd -v
+# Since 2.1.19, add "-r" to options for old behavior,
+# ie. reassemble user and realm to user@realm form.
+#
+# Specify the hostname for remote IMAP server using:
+# "-O localhost".
+# Specify the number of worker processes to create using:
+# "-n <N>".
+# Enable credential cache, set cache size and timeout using:
+# "-c -s <cache size, like 128> -t <timeout seconds>".
+# 
+SASLAUTHD_OPTS="-a pam"

+ 8 - 0
dev-libs/cyrus-sasl/files/saslauthd.pam-include

@@ -0,0 +1,8 @@
+#%PAM-1.0
+
+auth       required     pam_nologin.so
+auth       include      system-auth
+
+account    include      system-auth
+
+session    include      system-auth

+ 13 - 0
dev-libs/cyrus-sasl/files/saslauthd.service

@@ -0,0 +1,13 @@
+[Unit]
+Description=SASL Authentication Daemon
+
+[Service]
+Type=forking
+PIDFile=/run/saslauthd/saslauthd.pid
+EnvironmentFile=/etc/conf.d/saslauthd
+ExecStart=/usr/sbin/saslauthd $SASLAUTHD_OPTS
+ExecStop=/bin/kill -15 $MAINPID
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target

+ 20 - 0
dev-libs/cyrus-sasl/files/saslauthd2.rc7

@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting saslauthd"
+	start-stop-daemon --start --quiet --exec /usr/sbin/saslauthd \
+		-- ${SASLAUTHD_OPTS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping saslauthd"
+	start-stop-daemon --stop --quiet --pidfile /run/saslauthd/saslauthd.pid
+	eend $?
+}

+ 18 - 0
dev-libs/cyrus-sasl/metadata.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+  <email>net-mail@gentoo.org</email>
+  <name>Net-Mail</name>
+</maintainer>
+<use>
+  <flag name="authdaemond">Add Courier-IMAP authdaemond unix socket
+    support (<pkg>net-mail/courier-imap</pkg>, <pkg>mail-mta/courier</pkg>)
+    </flag>
+  <flag name="openldap">Add ldap support for saslauthd</flag>
+  <flag name="ldapdb">Enable ldapdb plugin</flag>
+  <flag name="sample">Enable sample client and server</flag>
+  <flag name="srp">Enable SRP authentication</flag>
+  <flag name="urandom">Use /dev/urandom instead of /dev/random</flag>
+</use>
+</pkgmetadata>

+ 4 - 0
net-libs/nodejs/Manifest

@@ -1,5 +1,9 @@
 AUX gentoo-global-npm-config.patch 1511 SHA256 a6575286a4f0c3b4db07c2f353d2e6c093eb3caba6cd0d3b11e546734b16bfad SHA512 b6c8bf88bd44d5461cbad0354273a6f964429d1cde48ab4c8bef9f50452de22bfc5d15707c5c9adc2a0d8000a6b1be4cffdee039618b627fb0d291886309cc3f WHIRLPOOL 7e748dd02dd248fde544ee088fe4e7b295919f5da1fcaf9511071c716d073ed45380831677082f9748c3802b7bdc6004b78275f39d29f1396330a1b196c5f1e1
 AUX nodejs-10.3.0-global-npm-config.patch 819 SHA256 eb412fa354c76a6dcb5a894c8d2e702d11319f17d403fc16aa86ed7482ecbb87 SHA512 abe27eab0beb3444186fb3c4ce3c67fbc05b684a606f8f8bc4a5bae570fd8fd988f1ad5d65c442842fb6c7b069dc6e3f82577ba6becb1d934ae1039dac074e03 WHIRLPOOL 515d1fb4bcf47a2b207d502d4b779c267d243bb4dbe4d5cc9bb4c69aeee073f09f0e038c9e1563f3673d131ca1ee29671d6067542a6cbecdad285b7aa5664bbd
+AUX nodejs-11.4.0-stdarg_h.patch 243 SHA256 f9ab8069b836a4886946516d4bb22d212c97008c8978953adc99b527537aa22c SHA512 008cb557c9d94fd3a70dcf54ea260ed5ad457f62bbc689eccb668052c7195895c3c7f115354dc76da8f1ff0c6807bda9ca7bce62c844e37036c3916cea40286b WHIRLPOOL 3d6a742e6bcacab204fa851afe1e5d5c36bf2ff3be25475ce81d15f98c7128b6ae2c020fc2243ddc83361ef90a4b8c508389187992c151e302a942839e0d4a9c
+AUX nodejs-99999999-llhttp.patch 506 SHA256 23b71cc2e1b27f16595ea246ea6c2a46282e6192892a023536ba971961b32fc6 SHA512 13cdbaf73696b4feef1fec48ac43f6a6d80f59096a81308c746655e2cffa0b0ef78850facff103f27062fd25192d8abd7bc200b36bd25df7bd4b800f80da0c5c WHIRLPOOL 2903af7badc59e4097fddde3d0fe87295f3df5b6e6abd2f913a992ac5d53119e8577807ced547409ba0076ae48fe3e73950514734ade57a211b5e398dae3f618
+DIST node-v11.6.0.tar.xz 20410716 SHA256 94f2be389c80ab939114f67c824db7ebd12df602358b7481c55431336bbff9b3 SHA512 7e3ee41a5de8395669796cf8f81a9e8f584ceda480b54874fceb057ccf8aa5b986239ca842b2dbd796dd1a97f9e2111995b334278f6d7bf38421a84c4e883c65 WHIRLPOOL 3581a99b52141f577dcb282b3163fb406d80fbd641b5ae172c8167463cad9917d907304364ed0b31d72abd80241e7f2456f439956995bb727698bd54a2079aca
 DIST node-v8.14.1.tar.xz 18497208 SHA256 b1df87803ddffb76fc6739f025f69f6b8288514fcd2f278f0d675ac3d52a6b9b SHA512 038975261da930aa8122e9ad44f6d59c32b32dbf6f71a4da8ba74f0874455a7b8f7a9878d900829898b25adb57b81a8114b4222b0384173db19daa769ea025d0 WHIRLPOOL cada539679f3a207f0d465d790a7ffc7b4890c8711f3f161ca7eea3d2d2dc1b8f5e2e350f2613cbecde0c0d4daaeb8c2c6e8723c5a1cb2c15acaa8a17e221028
+EBUILD nodejs-11.6.0.ebuild 6518 SHA256 96fa0c93ab7f5598ef2c6aeed06f8e50d0cee9874219c8e7724f0af935e363e4 SHA512 3d8e67f7d35fff87ec66c7dfcd0a4390339904f3bd5af6459a2621ebd161cb0228bb7cd2484b433763be35a6cca27ec419a8e8ce4f9f8d50c75cc755134ab3ab WHIRLPOOL 913ebd04c16b4d33504515e93273f2891b86e2def1d5eae0a59c5eeea4601915a9ef1739169ae2a3790d54a19e3e78d99bc3f4ee51ae0d635809117463b9ca53
 EBUILD nodejs-8.14.1.ebuild 6442 SHA256 38a21ae86cffdcca5d4a87e10bc1fc71a2367c7ede7175adbe9eae87ac44c52e SHA512 9291910af341adc7363dbac1a9b5efe6628b0abfb5f0c173516b02b75ffa51d906ccd3aafbaf453968c996ee08ba015684c4e430700c6577da143af42a98d78c WHIRLPOOL ae8c291db76108b2d056f4248021b632b021736b56dbf00f5df4f8741215443efe1ec19852fd92abaed98230ec9f56863dab20f57db76064983a3a15c5283704
 MISC metadata.xml 473 SHA256 b9f6072b47cc6364632c196887ec89346a1796413b13c4c44beefda4e5b62bc0 SHA512 f2911891d28329b3f6a21b56976f1507939bd51cb65581f73c2b5716c4610551cbc225450755be2e649e2070e1810ef41ca641d105155ceb1847e9a93ad2ee85 WHIRLPOOL 7c27a76cc13a62704fabb12cb3f2e97370fd606d32b03ab71cbc8b12958fa11f47f4792fff8b482a1c80de7d43eb04d2a59fa046afccf81a955114964047f644

+ 10 - 0
net-libs/nodejs/files/nodejs-11.4.0-stdarg_h.patch

@@ -0,0 +1,10 @@
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -75,6 +75,7 @@
+ #include <fcntl.h>  // _O_RDWR
+ #include <limits.h>  // PATH_MAX
+ #include <signal.h>
++#include <stdarg.h> // va_start/va_end
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>

+ 20 - 0
net-libs/nodejs/files/nodejs-99999999-llhttp.patch

@@ -0,0 +1,20 @@
+--- a/node.gypi
++++ b/node.gypi
+@@ -169,11 +169,15 @@
+ 
+     [ 'node_shared_http_parser=="false"', {
+       'dependencies': [
+-        'deps/http_parser/http_parser.gyp:http_parser',
+-        'deps/llhttp/llhttp.gyp:llhttp'
++        'deps/http_parser/http_parser.gyp:http_parser'
+       ],
+     } ],
+ 
++    [ '"true"', { 'dependencies': [
++        'deps/llhttp/llhttp.gyp:llhttp'
++      ],
++    }],
++
+     [ 'node_shared_cares=="false"', {
+       'dependencies': [ 'deps/cares/cares.gyp:cares' ],
+     }],

+ 207 - 0
net-libs/nodejs/nodejs-11.6.0.ebuild

@@ -0,0 +1,207 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs
+
+DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
+HOMEPAGE="https://nodejs.org/"
+SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"
+
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
+IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
+REQUIRED_USE="
+	${PYTHON_REQUIRED_USE}
+	inspector? ( icu ssl )
+	npm? ( ssl )
+"
+
+RDEPEND="
+	>=dev-libs/libuv-1.24.1:=
+	>=net-dns/c-ares-1.15.0
+	>net-libs/http-parser-2.9.0:=
+	>=net-libs/nghttp2-1.34.0
+	sys-libs/zlib
+	icu? ( >=dev-libs/icu-63.1:= )
+	ssl? ( dev-libs/openssl )
+"
+DEPEND="
+	${RDEPEND}
+	${PYTHON_DEPS}
+	systemtap? ( dev-util/systemtap )
+	test? ( net-misc/curl )
+"
+PATCHES=(
+	"${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
+	"${FILESDIR}"/${PN}-11.4.0-stdarg_h.patch
+	"${FILESDIR}"/${PN}-99999999-llhttp.patch
+)
+S="${WORKDIR}/node-v${PV}"
+
+pkg_pretend() {
+	(use x86 && ! use cpu_flags_x86_sse2) && \
+		die "Your CPU doesn't support the required SSE2 instruction."
+
+	( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
+		die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
+}
+
+src_prepare() {
+	tc-export CC CXX PKG_CONFIG
+	export V=1
+	export BUILDTYPE=Release
+
+	# fix compilation on Darwin
+	# https://code.google.com/p/gyp/issues/detail?id=260
+	sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
+
+	# make sure we use python2.* while using gyp
+	sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
+	sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
+
+	# less verbose install output (stating the same as portage, basically)
+	sed -i -e "/print/d" tools/install.py || die
+
+	# proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
+	local LIBDIR=$(get_libdir)
+	sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
+	sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die
+
+	# Avoid writing a depfile, not useful
+	sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die
+
+	sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die
+
+	# Avoid a test that I've only been able to reproduce from emerge. It doesnt
+	# seem sandbox related either (invoking it from a sandbox works fine).
+	# The issue is that no stdin handle is openened when asked for one.
+	# It doesn't really belong upstream , so it'll just be removed until someone
+	# with more gentoo-knowledge than me (jbergstroem) figures it out.
+	rm test/parallel/test-stdout-close-unref.js || die
+
+	# debug builds. change install path, remove optimisations and override buildtype
+	if use debug; then
+		sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
+		BUILDTYPE=Debug
+	fi
+
+	default
+}
+
+src_configure() {
+	local myconf=( --shared-cares --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
+	use debug && myconf+=( --debug )
+	use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
+	use inspector || myconf+=( --without-inspector )
+	use npm || myconf+=( --without-npm )
+	use snapshot && myconf+=( --with-snapshot )
+	use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )
+
+	local myarch=""
+	case ${ABI} in
+		amd64) myarch="x64";;
+		arm) myarch="arm";;
+		arm64) myarch="arm64";;
+		ppc64) myarch="ppc64";;
+		x32) myarch="x32";;
+		x86) myarch="ia32";;
+		*) myarch="${ABI}";;
+	esac
+
+	GYP_DEFINES="linux_use_gold_flags=0
+		linux_use_bundled_binutils=0
+		linux_use_bundled_gold=0" \
+	"${PYTHON}" configure \
+		--prefix="${EPREFIX}"/usr \
+		--dest-cpu=${myarch} \
+		$(use_with systemtap dtrace) \
+		"${myconf[@]}" || die
+}
+
+src_compile() {
+	emake -C out mksnapshot
+	pax-mark m "out/${BUILDTYPE}/mksnapshot"
+	emake -C out
+}
+
+src_install() {
+	local LIBDIR="${ED}/usr/$(get_libdir)"
+	emake install DESTDIR="${D}"
+	pax-mark -m "${ED}"usr/bin/node
+
+	# set up a symlink structure that node-gyp expects..
+	dodir /usr/include/node/deps/{v8,uv}
+	dosym . /usr/include/node/src
+	for var in deps/{uv,v8}/include; do
+		dosym ../.. /usr/include/node/${var}
+	done
+
+	if use doc; then
+		# Patch docs to make them offline readable
+		for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
+			sed -i '/fonts.googleapis.com/ d' $i;
+		done
+		# Install docs
+		docinto html
+		dodoc -r "${S}"/doc/*
+	fi
+
+	if use npm; then
+		dodir /etc/npm
+
+		# Install bash completion for `npm`
+		# We need to temporarily replace default config path since
+		# npm otherwise tries to write outside of the sandbox
+		local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
+		sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
+		local tmp_npm_completion_file="$(emktemp)"
+		"${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
+		newbashcomp "${tmp_npm_completion_file}" npm
+		sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die
+
+		# Move man pages
+		doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*
+
+		# Clean up
+		rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
+		rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die
+
+		local find_exp="-or -name"
+		local find_name=()
+		for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
+			".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
+			"*.md" "*.markdown" "*.bat" "*.cmd"; do
+			find_name+=( ${find_exp} "${match}" )
+		done
+
+		# Remove various development and/or inappropriate files and
+		# useless docs of dependend packages.
+		find "${LIBDIR}"/node_modules \
+			\( -type d -name examples \) -or \( -type f \( \
+				-iname "LICEN?E*" \
+				"${find_name[@]}" \
+			\) \) -exec rm -rf "{}" \;
+	fi
+
+	mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die
+}
+
+src_test() {
+	out/${BUILDTYPE}/cctest || die
+	"${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
+}
+
+pkg_postinst() {
+	einfo "The global npm config lives in /etc/npm. This deviates slightly"
+	einfo "from upstream which otherwise would have it live in /usr/etc/."
+	einfo ""
+	einfo "Protip: When using node-gyp to install native modules, you can"
+	einfo "avoid having to download extras by doing the following:"
+	einfo "$ node-gyp --nodedir /usr/include/node <command>"
+}