summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-05-23 02:09:50 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2020-05-23 02:14:36 +0000
commitac308289ca72bdb95093baf4a04478928137ea92 (patch)
tree58b398935a37765b9b13bda542cf6043c47a28e2
parent686a55246358e1b524aa34970bf0e9c0f14cf173 (diff)
Makefile: install links for gems
Instead of overriding GEM_PATH, let's simply use the default value, which installs files into ~/.gem. However, we want to store them in .local/share/gems, so let's create a symlink instead. This avoids us setting a GEM_PATH which may or may not work on various systems. When we create symlinks, remove the destination beforehand so that ln does not dereference the destination if it points to a directory. Note that there is an option in GNU ln, -n, which implements this behavior for us, and it is implemented as well in FreeBSD and macOS, but it is not in POSIX, so use the rm default. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
-rw-r--r--Makefile11
-rw-r--r--zsh/zshenv1
2 files changed, 10 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e73725a..7c4872d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,11 @@
DESTDIR ?= $(HOME)
+LINK_PAIRS += .local/share/gems .gem
+
all:
@echo To install, set DESTDIR and run make install.
-install: install-dirs install-standard
+install: install-links install-dirs install-standard
include bin/rules.mk
include git/rules.mk
@@ -21,6 +23,13 @@ install-dirs:
mkdir -p $(DESTDIR)/.cache
mkdir -p $(DESTDIR)/.local/share
+install-links: install-dirs
+ printf "%s %s\n" $(LINK_PAIRS) | (set -e; while read target link; \
+ do \
+ rm -f "$(DESTDIR)/$$link"; \
+ ln -sf "$(DESTDIR)/$$target" "$(DESTDIR)/$$link"; \
+ done)
+
install-standard:
printf "%s %s\n" $(INSTALL_PAIRS) | (set -e; while read src dest; \
do \
diff --git a/zsh/zshenv b/zsh/zshenv
index 3c8273f..7266861 100644
--- a/zsh/zshenv
+++ b/zsh/zshenv
@@ -189,7 +189,6 @@ then
GEM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/gems/$ver"
fi
unset ver
- GEM_PATH="$GEM_HOME${GEM_PATH:+:$GEM_PATH}"
fi
LANG=$(preferred_locale)