Skip to content

Commit

Permalink
make install: Compatibile with BSD and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1nksm committed Feb 9, 2020
1 parent a0a5d4d commit 235e0bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
BIN ?= shellspec
PREFIX ?= /usr/local
BINDIR := $(PREFIX)/bin
LIBDIR := $(PREFIX)/lib
Expand All @@ -11,12 +10,14 @@ dist: LICENSE shellspec lib libexec
tar -czf shellspec-dist.tar.gz $^ --transform 's,^,shellspec/,'

install:
install -d $(LIBDIR)/$(BIN)
cp -r shellspec lib libexec $(LIBDIR)/$(BIN)
install -D stub/shellspec $(BINDIR)/$(BIN)
install -d "$(BINDIR)" "$(LIBDIR)"
install stub/shellspec "$(BINDIR)/shellspec"
find lib libexec -type d -exec install -d "$(LIBDIR)/shellspec/{}" \;
find LICENSE lib -type f -exec install -m 644 {} "$(LIBDIR)/shellspec/{}" \;
find shellspec libexec -type f -exec install {} "$(LIBDIR)/shellspec/{}" \;

uninstall:
rm -rf $(LIBDIR)/$(BIN) $(BINDIR)/$(BIN)
rm -rf "$(BINDIR)/shellspec" "$(LIBDIR)/shellspec"

package:
contrib/make_package_json.sh > package.json
Expand Down
4 changes: 2 additions & 2 deletions stub/shellspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

self=${0##*/}
exec "${0%"$self"}../lib/$self/shellspec" "$@"
# Do not use symlink to support file system that symlink not available
exec "${0%/*}/../lib/shellspec/shellspec" "$@"

0 comments on commit 235e0bf

Please sign in to comment.