[haiku-commits] r43163 - haiku/trunk/build/scripts

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 3 Nov 2011 15:22:31 +0100 (CET)

Author: bonefish
Date: 2011-11-03 15:22:31 +0100 (Thu, 03 Nov 2011)
New Revision: 43163
Changeset: https://dev.haiku-os.org/changeset/43163

Modified:
   haiku/trunk/build/scripts/build_cross_tools
Log:
* Document that the haikuRequiredLegacyGCCVersion variable is
  influencing this script.
* If haikuRequiredLegacyGCCVersion has not been specified, assume that
  the script was called manually and just use the version string from
  the gcc sources.
* Make error output a bit more consistent.


Modified: haiku/trunk/build/scripts/build_cross_tools
===================================================================
--- haiku/trunk/build/scripts/build_cross_tools 2011-11-03 14:18:20 UTC (rev 
43162)
+++ haiku/trunk/build/scripts/build_cross_tools 2011-11-03 14:22:31 UTC (rev 
43163)
@@ -1,6 +1,9 @@
 #!/bin/sh
 
-# parameters <haiku sourcedir> <buildtools dir> <haiku output dir>
+# Parameters <haiku sourcedir> <buildtools dir> <haiku output dir>
+# Influential environmental variable:
+# * haikuRequiredLegacyGCCVersion: The requrired version of the gcc. Will be
+#   checked against the version in the buildtools directory.
 
 # get and check the parameters
 if [ $# -lt 3 ]; then
@@ -19,21 +22,37 @@
 
 
 if [ ! -d $haikuSourceDir ]; then
-       echo "No such directory: \"$haikuSourceDir\"" >&2
+       echo "ERROR: No such directory: \"$haikuSourceDir\"" >&2
        exit 1
 fi
 
 if [ ! -d $buildToolsDir ]; then
-       echo "No such directory: \"$buildToolsDir\"" >&2
+       echo "ERROR: No such directory: \"$buildToolsDir\"" >&2
        exit 1
 fi
 
-if ! grep "$haikuRequiredLegacyGCCVersion" \
-               $buildToolsDir/gcc/gcc/version.c >/dev/null 2>&1 ; then
-       echo "*** Mismatching compiler versions between configure script and" 
>&2
-       echo "*** $buildToolsDir/gcc/gcc/version.c" >&2
-       echo "*** Did you perhaps update only one of haiku & buildtools?" >&2
-       exit 1
+# verify or extract the gcc version
+gccVersionDotC="$buildToolsDir/gcc/gcc/version.c"
+if [ -n "$haikuRequiredLegacyGCCVersion" ]; then
+       # haikuRequiredLegacyGCCVersion has been specified. Check whether the
+       # version of the gcc in the given build tools directory matches.
+       if ! grep "$haikuRequiredLegacyGCCVersion" \
+                       "$gccVersionDotC" >/dev/null 2>&1 ; then
+               echo "*** Mismatching compiler versions between configure 
script and" \
+                       >&2
+               echo "*** $gccVersionDotC" >&2
+               echo "*** Did you perhaps update only one of haiku & 
buildtools?" >&2
+               exit 1
+       fi
+else
+       # haikuRequiredLegacyGCCVersion wasn't specified. Extract the version 
string
+       # from the gcc's version.c.
+       haikuRequiredLegacyGCCVersion=`grep "2.95.3-haiku-" "$gccVersionDotC" \
+               | sed 's@.*\"\(.*\)\".*@\1@'`
+       if [ -z "$haikuRequiredLegacyGCCVersion" ]; then
+               echo "ERROR: Failed to extract version string from 
$gccVersionDotC" >&2
+               exit 1
+       fi
 fi
 
 


Other related posts:

  • » [haiku-commits] r43163 - haiku/trunk/build/scripts - ingo_weinhold