From fb4e8687f2c5e55ccead797588fed018bcae646b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 28 Mar 2018 11:54:03 +0200 Subject: Add "make install p=$PKG" to install packages locally This uses the erlang.mk test infrastructure to build the package and the packages are installed by default to XDG_DATA_HOME/erlang.mk/lib. Just add this path to ERL_LIBS and it will be available to all non-release Erlang shells. export ERL_LIBS=$HOME/.local/share/erlang.mk/lib To make them available to releases they need to be started in interactive mode. This can be done via the CODE_LOADING_MODE variable which is used at the release startup. export CODE_LOADING_MODE=interactive --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 9242b80..c0be579 100644 --- a/Makefile +++ b/Makefile @@ -83,3 +83,21 @@ up: cd gh-pages && make cd gh-pages && git push origin gh-pages rm -rf gh-pages + +ifdef p +XDG_DATA_HOME ?= $(HOME)/.local/share +INSTALL_DIR ?= $(XDG_DATA_HOME)/erlang.mk/lib + +install: check + for dep in `ls test/packages/$p_pkg/deps/`; do \ + rm -rf $(INSTALL_DIR)/$$dep; \ + mkdir -p $(INSTALL_DIR)/$$dep; \ + cp -r test/packages/$p_pkg/deps/$$dep/ebin $(INSTALL_DIR)/$$dep/; \ + if [ -d test/packages/$p_pkg/deps/$$dep/priv ]; then \ + cp -r test/packages/$p_pkg/deps/$$dep/priv $(INSTALL_DIR)/$$dep/; \ + fi; \ + done +else +install: + @echo "Usage: $(MAKE) install p=" +endif -- cgit v1.2.3