build.sh: avoid unnecessary copies and reduce overall runtime

build.sh was staging the headers to be included in a temporary
directory. Not only did this lead to a huge amount of cp commands, in
general that approach did not scale very well. In addition, the tmp
directory used might have ended up repeatedly in the archive under
certain circumstances.

Therefore, teach build.sh to collect all header files to be archived in
one single `find` command and to create the final archive on the fly.

On my machine that reduced the runtime for this step from ~60s to ~2s.
That is just a rough measurement by observation.

Change-Id: Ib65aa7c5a76050e92d4f8dcb13d110886181cc53
Signed-off-by: Matthias Maennich <maennich@google.com>
1 file changed