File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ INSTALL_BIN ?= $(PREFIX)/bin
2222INSTALL_LIB ?= $(PREFIX ) /share/$(NAME )
2323INSTALL_EXT ?= $(INSTALL_LIB ) /$(NAME ) .d
2424INSTALL_MAN1 ?= $(PREFIX ) /share/man/man1
25- LINK_REL_DIR := $(shell realpath --relative-to= $(INSTALL_BIN ) $(INSTALL_LIB ) )
25+ LINK_REL_DIR := $(shell bash share/pnrelpath.sh $(INSTALL_BIN ) $(INSTALL_LIB ) )
2626
2727# Docker variables:
2828DOCKER_TAG ?= 0.0.6
4949
5050.PHONY : test
5151test :
52+ @echo uname: ' $(shell uname)'
5253 prove $(prove ) $(test )
5354
5455test-all : test docker-tests
Original file line number Diff line number Diff line change 1212export FILTER_BRANCH_SQUELCH_WARNING=1
1313
1414# Import Bash+ helper functions:
15- SUBREPO_EXT_DIR=" $( dirname " $( realpath " ${BASH_SOURCE[0]} " ) " ) /git-subrepo.d" # replaced by `make install`
15+ SUBREPO_EXT_DIR=" $( dirname " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) /git-subrepo.d" # replaced by `make install`
1616source " ${SUBREPO_EXT_DIR} /bash+.bash"
1717bash+:import :std can version-check
1818
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # from: https://unix.stackexchange.com/questions/573047/how-to-get-the-relative-path-between-two-directories
4+ #
5+ # Expects two parameters, source-dir and target-dir, both absolute canonicalized
6+ # non-empty pathnames, either may be /-ended, neither need exist.
7+ # Returns result in shell variable $REPLY as a relative path from source-dir
8+ # to target-dir without trailing /, . if void.
9+ #
10+ # Algorithm is from a 2005 comp.unix.shell posting which has now ascended to
11+ # archive.org.
12+
13+ pnrelpath () {
14+ set -- " ${1%/ } /" " ${2%/ } /" ' ' # # '/'-end to avoid mismatch
15+ while [ " $1 " ] && [ " $2 " = " ${2# " $1 " } " ] # # reduce $1 to shared path
16+ do set -- " ${1%/ ?*/ } /" " $2 " " ../$3 " # # source/.. target ../relpath
17+ done
18+ REPLY=" ${3}${2# " $1 " } " # # build result
19+ # unless root chomp trailing '/', replace '' with '.'
20+ [ " ${REPLY#/ } " ] && REPLY=" ${REPLY%/ } " || REPLY=" ${REPLY:- .} "
21+ }
22+
23+ pnrelpath " $1 " " $2 "
24+
25+ echo $REPLY
Original file line number Diff line number Diff line change 22
33set -e
44
5- export LC_ALL=C.UTF-8
5+ if [ " $( uname) " == " Linux" ]; then
6+ export LC_ALL=C.UTF-8
7+ fi
68
79# Get the location of this script
810SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
You can’t perform that action at this time.
0 commit comments