Get rid of the dependency on "make" to install "bpkg"

Rename install.sh to setup.sh in order to take the Makefile targets.
Former make target names are now passed to the script like

$ ./setup.sh uninstall

Fixes #45.
pull/46/head
Sebastian Schuberth 9 years ago
parent 3c6a141444
commit bff2fde9c9

@ -1,24 +0,0 @@
# bpkg Makefile
BIN ?= bpkg
PREFIX ?= /usr/local
# All 'bpkg' supported commands
CMDS = json install package term suggest init utils update list show
install: uninstall
@echo " info: Installing $(PREFIX)/bin/$(BIN)..."
@install $(BIN) $(PREFIX)/bin
@for cmd in $(CMDS); do cp $(BIN)-$${cmd} $(PREFIX)/bin; done
uninstall:
@echo " info: Uninstalling $(PREFIX)/bin/$(BIN)..."
@rm -f $(PREFIX)/bin/$(BIN)
@for cmd in $(CMDS); do rm -f $(PREFIX)/bin/$(BIN)-$${cmd}; done
link: uninstall
@ln -s $(BIN) $(PREFIX)/bin/$(BIN)
@for cmd in $(CMDS); do ln -s $(BIN)-$${cmd} $(PREFIX)/bin; done
unlink: uninstall

@ -35,12 +35,12 @@ $ clib install bpkg/bpkg
### 3. Source Code
To directly install `bpkg` from it's source code you have to clone it's repository and install with `make`:
To directly install `bpkg` from it's source code you have to clone it's repository and run the `install` script:
```sh
$ git clone https://github.com/bpkg/bpkg.git
$ cd bpkg
$ make install
$ ./setup.sh
```
Or in a directory with user write permission, like `$HOME/opt/bin`
@ -48,7 +48,7 @@ Or in a directory with user write permission, like `$HOME/opt/bin`
```sh
$ git clone https://github.com/bpkg/bpkg.git
$ cd bpkg
$ PREFIX=$HOME/opt make install
$ PREFIX=$HOME/opt ./setup.sh
```
## Usage

@ -52,13 +52,51 @@ setup () {
cd "${DEST}"
echo " info: Installing..."
echo
make install
make_install
echo " info: Done!"
} >&2
return $?
}
## make targets
BIN="bpkg"
[ -z "$PREFIX" ] && PREFIX="/usr/local"
# All 'bpkg' supported commands
CMDS="json install package term suggest init utils update list show"
make_install () {
make_uninstall
echo " info: Installing $PREFIX/bin/$BIN..."
install "$BIN" "$PREFIX/bin"
for cmd in $CMDS; do
install "$BIN-$cmd" "$PREFIX/bin"
done
return $?
}
make_uninstall () {
echo " info: Uninstalling $PREFIX/bin/$BIN..."
rm -f "$PREFIX/bin/$BIN"
for cmd in $CMDS; do
rm -f "$PREFIX/bin/$BIN-$cmd"
done
return $?
}
make_link () {
make_uninstall
ln -s "$BIN" "$PREFIX/bin/$BIN"
for cmd in $CMDS; do
ln -s "$BIN-$cmd" "$PREFIX/bin"
done
return $?
}
make_unlink () {
make_uninstall
}
## go
setup
[ $# -eq 0 ] && setup || make_$1
exit $?
Loading…
Cancel
Save