changes from past 2 weeks

Part of the modifications come from synergye's build script:
https://github.com/codefireXperiment/external_codefirex/blob/jb-devel-release/build.sh