Skip to content

Commit

Permalink
Workaround for OSX unix tool fail
Browse files Browse the repository at this point in the history
  • Loading branch information
choptastic committed Aug 15, 2014
1 parent 36eca8c commit 3cfa611
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Expand Up @@ -163,8 +163,11 @@ package_yaws_win:

# PLATFORM-AGNOSTIC

## OSX doesn't ship with a decent readlink, so this is a workaround
READLINK="support/readlink/readlink-f.sh"

move_release:
ifneq ($(shell readlink -f "$(PREFIX)/$(PROJECT)"), $(shell readlink -f "rel/nitrogen"))
ifneq ($(shell $(READLINK) "$(PREFIX)/$(PROJECT)"), $(shell $(READLINK) "rel/nitrogen"))
@(mkdir -p $(shell dirname "$(PREFIX)/$(PROJECT)"))
@(mv ./rel/nitrogen $(PREFIX)/$(PROJECT))
endif
Expand Down Expand Up @@ -331,7 +334,11 @@ rel_inner_win: generate erl_interface
@rm -rf rel/reltool.config "rel/nitrogen/make_start_cmd.sh" "rel/nitrogen/start.cmd.src"

replace_project_name:
@(sed -i 's/{{PROJECT}}/$(PROJECT)/g' rel/nitrogen/etc/vm.args)
## This rather stupid looking workaround is because OSX throws odd
## stdin errors with sed and "-i" despite us not even using stdin.
## I really wish OSX would ship with some non-terrible UNIX utilities.
sed "s/{{PROJECT}}/$(PROJECT)/g" < rel/nitrogen/etc/vm.args > rel/nitrogen/etc/temp.args
mv rel/nitrogen/etc/temp.args rel/nitrogen/etc/vm.args

rel_copy_quickstart:
mkdir -p deps
Expand Down
10 changes: 10 additions & 0 deletions support/readlink/readlink-f.sh
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

## This is just to get around the fact that OSX doesn't ship with a decent
## version of readlink that supports -f

realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

realpath "$1"

0 comments on commit 3cfa611

Please sign in to comment.