# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=direnv
pkgver=2.36.0
pkgrel=1
pkgdesc="Environment variable switcher for the shell"
url="https://direnv.net"
license="MIT"
arch="all"
depends="bash"
makedepends="go"
subpackages="$pkgname-doc $pkgname-fish::noarch"
options="net" # go modules
source="$pkgname-$pkgver.tar.gz::https://github.com/direnv/direnv/archive/v$pkgver.tar.gz"

build() {
	make
}

check() {
	# Also has tests for tcsh and elvish, this manual call is done instead of
	# tests to avoid unwanted tests like 'shellcheck' and 'go-fmt'
	make test-go test-bash
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr install
}

fish() {
	pkgdesc="configuration hooks for fish"
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	amove usr/share/fish/vendor_conf.d
}

sha512sums="
81f1673fdbe904906663f1929562ed430bbae2ea3560885f8289b23779f22b0e05f05ea69de83cbd6deab4f4bdf6c13b4211e2faf3b5fd5867ed7a37ad51cbe9  direnv-2.36.0.tar.gz
"
