This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] scripts/cc: get the right ecj for the gcc version.


If we look at:
ftp://gcc.gnu.org/pub/java/

Not all ecj-{MAJOR.MINOR}.jar versions are the same.
Grabbing latest is also naive, as it is NOT the latest ;)

Since we also have to deal with linaro version numbers, add a helper
function to extract the version number in a common way.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
---
 scripts/build/cc/gcc.sh | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 9dbc41e..3f6d94e 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -2,6 +2,15 @@
 # Copyright 2007 Yann E. MORIN
 # Licensed under the GPL v2. See COPYING in the root of this package
 
+# Discover the ecj version to get
+do_get_ecj_version() {
+    if [ "$(echo ${CT_CC_VERSION} | grep -o 'linaro')" = "linaro" ]; then
+        echo ${CT_CC_VERSION} | sed -r -e 's/linaro-([0-9]\.[0-9])-.*/\1/'
+    else
+        echo "${CT_CC_VERSION%.*}"
+    fi
+}
+
 # Download gcc
 do_cc_get() {
     local linaro_version
@@ -36,8 +45,9 @@ do_cc_get() {
     # GCC source tree, which will not be there unless we get it and
     # put it there ourselves
     if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" ]; then
-        CT_GetFile ecj-latest .jar ftp://gcc.gnu.org/pub/java   \
-                                   ftp://sourceware.org/pub/java
+        CT_GetFile "ecj-$(do_get_ecj_version)" .jar \
+            ftp://gcc.gnu.org/pub/java              \
+            ftp://sourceware.org/pub/java
     fi
 }
 
@@ -56,7 +66,8 @@ do_cc_extract() {
     if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y"                     \
          -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar"   \
        ]; then
-        CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar"
+        CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-$(do_get_ecj_version).jar" \
+            "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar"
     fi
 }
 
-- 
2.1.0


--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]