Merge pull request #46 from sschuberth/master

Make bpkg install properly on MSYS
pull/47/head
Chris Carpita 9 years ago
commit 03da496b63

@ -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
@ -87,8 +87,8 @@ $ bpkg install jwerle/suggest.sh@0.0.1 -g
**Note:** to do that the packages **must be tagged releases** on the repository.
You can also *installing packages without a `package.json`*.
As long as there is a `Makefile` in the repository it will try to invoke `make install` so long as the `-g` or `--global` flags are set when invoking `bpkg install`.
You can also *install packages without a `package.json`*.
As long as there is a `Makefile` in the repository it will try to invoke `make install` as long as the `-g` or `--global` flags are set when invoking `bpkg install`.
For example you could install [git-standup](https://github.com/stephenmathieson/git-standup) with an omitted `package.json` because of the `Makefile` and the `install` target found in it.

@ -52,13 +52,55 @@ 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 -d "$PREFIX/bin"
local source=$(<$BIN)
[ -f "$source" ] && install "$source" "$PREFIX/bin/$BIN" || install "$BIN" "$PREFIX/bin"
for cmd in $CMDS; do
source=$(<$BIN-$cmd)
[ -f "$source" ] && install "$source" "$PREFIX/bin/$BIN-$cmd" || 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
echo " info: Linking $PREFIX/bin/$BIN..."
ln -s "$PWD/$BIN" "$PREFIX/bin/$BIN"
for cmd in $CMDS; do
ln -s "$PWD/$BIN-$cmd" "$PREFIX/bin"
done
return $?
}
make_unlink () {
make_uninstall
}
## go
setup
[ $# -eq 0 ] && setup || make_$1
exit $?
Loading…
Cancel
Save