build: work around missing readlink -f on Mac

Change-Id: I5d56366cf33a2b02f1886c87815d00cff279779d
Add SED_INPLACE macro - based on squashed commits from Cyanogenmod

Make sed in-place more portable

In-place sed (sed -i) works differents for GNU vs BSD version like
what is found on OS X.

This adds a check and does a sed -i for GNU and a sed -i '' for
Darwin only.

This allows my OS X machine to fully compile CM without the need
for any GNU specific packages.

Author: Brandon Bennett <bennetb@gmail.com>

Darwin: Use gsed for SED_INPLACE if found.

Change-Id: I5922b31ff2d192d5c6cc0cd8cabfe64d8b4f2620
Author: Koushik Dutta
build: Fix zip creation on Mac OSX

When checking if files are symbolic links, then ota_from_target_files
expect the permissions of the file to be 0755 which is always the case
on Linux, but not on Mac OSX. I adapted the function so that permissions
are not included in the check anymore. Instead it uses only the type
attributes of the zip external_attr flags.
CM uses the same kind of check.

Change-Id: I5d5d0567cb798b765cbc19a66661163f80e21f70