Hello folks,

I have created a port of direnv (https://direnv.net). It is a utility
(written in Go) that hooks onto your shell, and lets you define
project specific environments.

Portcheck is clean. The package builds successfully, I was able to
pkg_add it to my machine and test it (amd64 with zsh).

There is a small example on the github page, I was able to confirm
that it is working. `man direnv` and related pages also work.

Any suggestions appreciated. Thanks.

diff --git a/sysutils/direnv/Makefile b/sysutils/direnv/Makefile
new file mode 100644
index 00000000000..345705be866
--- /dev/null
+++ b/sysutils/direnv/Makefile
@@ -0,0 +1,48 @@
+# $OpenBSD: Makefile.template,v 1.88 2020/05/15 01:32:48 abieber Exp $
+
+COMMENT = tool for managing environment based on current directory
+
+GH_ACCOUNT =           direnv
+GH_PROJECT =           direnv
+VERSION =                  2.23.0
+GH_TAGNAME =           v${VERSION}
+
+MAINTAINER= Ashton Fagg <ash...@fagg.id.au>
+CATEGORIES =  sysutils devel
+HOMEPAGE =             https://direnv.net
+
+# MIT
+PERMIT_PACKAGE =       Yes
+
+WANTLIB =              c pthread
+
+USE_GMAKE =            Yes
+
+MODULES=               lang/go
+
+pre-build: remove-github-actions
+
+do-build:
+       cd ${WRKSRC}; ${MODGO_BUILD_CMD} github.com/direnv/direnv/...
+
+# This removes some unneeded stuff. These are just
+# Github CI hooks.
+remove-github-actions:
+       rm -rf ${WRKSRC}/script
+
+do-install:
+       $(INSTALL_PROGRAM) $(MODGO_WORKSPACE)/bin/direnv $(PREFIX)/bin
+       $(INSTALL_MAN) \
+               $(WRKSRC)/man/direnv.1 $(PREFIX)/man/man1/direnv.1
+       $(INSTALL_MAN) \
+               $(WRKSRC)/man/direnv-stdlib.1 $(PREFIX)/man/man1/direnv-stdlib.1
+       $(INSTALL_MAN) \
+               $(WRKSRC)/man/direnv-fetchurl.1 
$(PREFIX)/man/man1/direnv-fetchurl.1
+       $(INSTALL_MAN) \
+               $(WRKSRC)/man/direnv.toml.1 $(PREFIX)/man/man1/direnv.toml.1
+
+do-test:
+       cd ${WRKSRC};
+       ${MODGO_CMD} test github.com/direnv/direnv/...
+
+.include <bsd.port.mk>
diff --git a/sysutils/direnv/distinfo b/sysutils/direnv/distinfo
new file mode 100644
index 00000000000..e068918c6f2
--- /dev/null
+++ b/sysutils/direnv/distinfo
@@ -0,0 +1,2 @@
+SHA256 (direnv-2.23.0.tar.gz) = 0ovJWWgKMJ0NVPdU7f5iLN3hSkuAb90y0oXUejIgmLk=
+SIZE (direnv-2.23.0.tar.gz) = 1349546
diff --git a/sysutils/direnv/pkg/DESCR b/sysutils/direnv/pkg/DESCR
new file mode 100644
index 00000000000..3c433d4d887
--- /dev/null
+++ b/sysutils/direnv/pkg/DESCR
@@ -0,0 +1,12 @@
+direnv is an extension for POSIX shells that adds the ability to modify
+the environment based on the current working directory.
+
+Before each prompt, direnv checks for the existence of .envrc in the current
+and parent directories. If the file exists, and is authorized, it is loaded 
into
+a bash sub-shell and all exported variables are then captured by direnv and 
made
+available to the current shell.
+
+This allows for project specific environment variables to be defined without
+cluttering .profile.
+
+Supports common shells such as bash, zsh, fish, tcsh, elvish.
diff --git a/sysutils/direnv/pkg/PLIST b/sysutils/direnv/pkg/PLIST
new file mode 100644
index 00000000000..b5e197b94d6
--- /dev/null
+++ b/sysutils/direnv/pkg/PLIST
@@ -0,0 +1,6 @@
+@comment $OpenBSD: PLIST,v$
+@bin bin/direnv
+@man man/man1/direnv-fetchurl.1
+@man man/man1/direnv-stdlib.1
+@man man/man1/direnv.1
+@man man/man1/direnv.toml.1

Reply via email to