Add protocol consolidation support to escript.build. Closes #2699