# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=5
+EAPI=6
 
 EGIT_REPO_URI="https://github.com/vaeth/eix.git"
 
 WANT_LIBTOOL="none"
 
 PLOCALES="de ru"
-inherit autotools git-r3 bash-completion-r1 eutils l10n
+inherit autotools git-r3 bash-completion-r1 l10n systemd
 
 DESCRIPTION="Search and query ebuilds, portage incl. local settings, ext. overlays, version changes, and more"
 HOMEPAGE="https://github.com/vaeth/eix/"
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS=""
-IUSE="debug +dep doc nls optimization security strong-optimization strong-security sqlite swap-remote tools"
+IUSE="debug +dep doc nls optimization +required-use security strong-optimization strong-security sqlite swap-remote tools"
 
 BOTHDEPEND="sqlite? ( >=dev-db/sqlite-3 )
        nls? ( virtual/libintl )"
        >=sys-devel/gettext-0.18.3"
 
 src_prepare() {
-       sed -i -e "s'/'${EPREFIX}/'" -- "${S}"/tmpfiles.d/eix.conf
-       epatch_user
+       sed -i -e "s'/'${EPREFIX}/'" -- "${S}"/tmpfiles.d/eix.conf || die
+       eapply_user
        eautoreconf
 }
 
                $(use_enable swap-remote) \
                $(use_with prefix always-accept-keywords) \
                $(use_with dep dep-default) \
+               $(use_with required-use required-use-default) \
                --with-zsh-completion \
                --with-portage-rootpath="${ROOTPATH}" \
-               --with-eprefix-default="${EPREFIX}" \
-               --docdir="${EPREFIX}/usr/share/doc/${PF}" \
-               --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
+               --with-eprefix-default="${EPREFIX}"
 }
 
 src_install() {
        default
        dobashcomp bash/eix
-       insinto "/usr/lib/tmpfiles.d"
-       doins tmpfiles.d/eix.conf
+       systemd_dotmpfilesd tmpfiles.d/eix.conf
 }
 
 pkg_postinst() {