# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit go-module greadme DESCRIPTION="Environment variable manager for shell" HOMEPAGE="https://github.com/direnv/direnv" SRC_URI="https://github.com/direnv/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" SRC_URI+=" https://share.terinstock.com/${P}-vendor.tar.xz" LICENSE="MIT" LICENSE+=" BSD" SLOT="0" KEYWORDS="~amd64" RESTRICT="test" # fails src_prepare() { default sed -i -e "/selfPath, err/cselfPath := \"${EPREFIX}/usr/bin/direnv\"" internal/cmd/cmd_hook.go || die } src_compile() { emake all mkdir shell-init || die for shell in bash zsh fish elvish pwsh tcsh; do ./direnv hook ${shell} > shell-init/${shell} || die done } src_install() { einstalldocs emake DESTDIR="${ED}" PREFIX="/usr" install insinto "/usr/share/${PN}" doins -r shell-init greadme_stdin <<-EOF Gentoo installs direnv's shell-init code under /usr/share/direnv/shell-init/ Therefore, instead of using, e.g. 'eval \"\$(direnv hook zsh)\"' in your .zshrc you can put \"source /usr/share/direnv/shell-init/zsh\" there, which avoids the cost of forking a process. Although direnv does that a lot anyways. EOF }