crossgcc: Add version number to script name

Store both the version number and git hash in the file name
when copying the buildgcc script to the destination directory.

Also, fix the quoting in the lines touched anyways, and move the
script to $TARGETDIR/share/

Change-Id: Ib37dc2be57ee7f0ae18a0b954f537f8b4c2db9d0
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/14347
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 0222b4c..ea7c2e9 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -20,6 +20,7 @@
 
 CROSSGCC_DATE="April 3rd, 2016"
 CROSSGCC_VERSION="1.38"
+CROSSGCC_COMMIT=$( git describe )
 
 # default settings
 PACKAGE=GCC
@@ -780,6 +781,7 @@
 # Prepare target directory for building GCC
 # (dependencies must be in the PATH)
 mkdir -p $DESTDIR$TARGETDIR/bin
+mkdir -p $DESTDIR$TARGETDIR/share
 export PATH=$DESTDIR$TARGETDIR/bin:$PATH
 
 # Download, unpack, patch and build all packages
@@ -806,8 +808,8 @@
 # Adding git information of current tree to target directory
 # for reproducibility
 PROGNAME=$(basename "$0")
-rm -f "$DESTDIR$TARGETDIR/$PROGNAME".commit.*
-cp "$PROGNAME" $DESTDIR$TARGETDIR/"$PROGNAME.commit.$(git describe)"
+rm -f "$DESTDIR$TARGETDIR/share/$PROGNAME-*"
+cp "$PROGNAME" "$DESTDIR$TARGETDIR/share/$PROGNAME-$CROSSGCC_VERSION-$CROSGCC_COMMIT"
 
 if [ $SAVETEMPS -eq 0 ]; then
 	cleanup