From 96c43ff8f26cf89934198d2387cddef1f119a271 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Apr 2021 08:26:11 +0000 Subject: build: add "symlink-install" target This is useful for users relying on system Ruby and lack permissions to install gems. --- GNUmakefile | 14 +++++++++++++- dtas.sh | 7 +++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 dtas.sh diff --git a/GNUmakefile b/GNUmakefile index e5914b2..084a2d8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2020 all contributors +# Copyright (C) 2013-2021 all contributors # License: GPL-3.0+ all:: pkg = dtas @@ -74,5 +74,17 @@ $(pkgtgz): .tgz-manifest package: $(pkgtgz) $(pkggem) +# Install symlinks to ~/bin (which is hopefuly in PATH) which point to +# this source tree. +# prefix + bindir matches git.git Makefile: +prefix = $(HOME) +bindir = $(prefix)/bin +symlink-install : + mkdir -p $(bindir) + dtas=$(CURDIR)/dtas.sh && cd $(bindir) && \ + for x in $(CURDIR)/bin/*; do \ + ln -sf "$$dtas" $$(basename "$$x"); \ + done + .PHONY: all .FORCE-GIT-VERSION-FILE test $(test_units) NEWS .PHONY: check-warnings fix-perms diff --git a/dtas.sh b/dtas.sh new file mode 100755 index 0000000..d3ea5e1 --- /dev/null +++ b/dtas.sh @@ -0,0 +1,7 @@ +#!/bin/sh -e +# symlink this file to a directory in PATH to run dtas (or anything in bin/*) +# without needing perms to install globally. Used by "make symlink-install" +p=$(realpath "$0" || readlink "$0") # neither is POSIX, but common +p=$(dirname "$p") c=$(basename "$0") # both are POSIX +exec ${RUBY-ruby} -I"$p"/lib "$p"/bin/"${c%.sh}" "$@" +: this script is too short to copyright -- cgit v1.2.3-24-ge0c7