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

See the CrossGCC FAQ 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 3 of 4] scripts/gcc: clean up 'if' statement for STATIC_TOOLCHAIN/CC_STATIC_LIBSTDCXX


 scripts/build/cc/gcc.sh |  70 ++++++++++++++++++------------------------------
 1 files changed, 27 insertions(+), 43 deletions(-)


# HG changeset patch
# User Bryan Hundven <bryanhundven@gmail.com>
# Date 1306822446 25200
# Node ID 76a2c150464e068e50c2ca2197f29c33ac1d187c
# Parent  a30af7f9cfb1b1118ddf0886744f7449a7f1dc29
scripts/gcc: clean up 'if' statement for STATIC_TOOLCHAIN/CC_STATIC_LIBSTDCXX

This patch cleans up the way we set host_libstdcxx_flags, core_LDFLAGS
and final_LDFLAGS, based on the changes from the previous commit to fix
STATIC_TOOLCHAIN dependencies.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>

diff -r a30af7f9cfb1 -r 76a2c150464e scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Mon May 30 23:05:07 2011 -0700
+++ b/scripts/build/cc/gcc.sh	Mon May 30 23:14:06 2011 -0700
@@ -183,36 +183,28 @@
     fi
 
     # *** WARNING ! ***
-    # Keep this full if-else-if-elif-fi-fi block in sync
+    # Keep this full if-if-fi-elif-fi block in sync
     # with the same block in do_cc, below.
-    if [ "${build_staticlinked}" = "yes" ]; then
-        core_LDFLAGS+=("-static")
+    if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then
+        # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
+        # build script
+        # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
+        # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
         host_libstdcxx_flags+=("-static-libgcc")
-        host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
+        host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
         host_libstdcxx_flags+=("-lm")
-        # Companion libraries are build static (eg !shared), so
+	if [ "${build_staticlinked}" = "yes" ]; then
+            core_LDFLAGS+=("-static")
+            core_LDFLAGS+=("-lstdc++")
+            core_LDFLAGS+=("-lm")
+	fi
+    elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
+        # When companion libraries are build static (eg !shared),
         # the libstdc++ is not pulled automatically, although it
         # is needed. Shoe-horn it in our LDFLAGS
         # Ditto libm on some Fedora boxen
         core_LDFLAGS+=("-lstdc++")
         core_LDFLAGS+=("-lm")
-    else
-        if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then
-            # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
-            # build script
-            # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
-            # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
-            host_libstdcxx_flags+=("-static-libgcc")
-            host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
-            host_libstdcxx_flags+=("-lm")
-        elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
-            # When companion libraries are build static (eg !shared),
-            # the libstdc++ is not pulled automatically, although it
-            # is needed. Shoe-horn it in our LDFLAGS
-            # Ditto libm on some Fedora boxen
-            core_LDFLAGS+=("-lstdc++")
-            core_LDFLAGS+=("-lm")
-        fi
     fi
 
     if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
@@ -434,36 +426,28 @@
     fi
 
     # *** WARNING ! ***
-    # Keep this full if-else-if-elif-fi-fi block in sync
+    # Keep this full if-if-fi-elif-fi block in sync
     # with the same block in do_cc_core, above.
-    if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
-        final_LDFLAGS+=("-static")
+    if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then
+        # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
+        # build script
+        # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
+        # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
         host_libstdcxx_flags+=("-static-libgcc")
         host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++")
         host_libstdcxx_flags+=("-lm")
-        # Companion libraries are build static (eg !shared), so
+	if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
+            final_LDFLAGS+=("-static")
+            final_LDFLAGS+=("-lstdc++")
+            final_LDFLAGS+=("-lm")
+        fi
+    elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
+        # When companion libraries are build static (eg !shared),
         # the libstdc++ is not pulled automatically, although it
         # is needed. Shoe-horn it in our LDFLAGS
         # Ditto libm on some Fedora boxen
         final_LDFLAGS+=("-lstdc++")
         final_LDFLAGS+=("-lm")
-    else
-        if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then
-            # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2
-            # build script
-            # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++,
-            # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html
-            host_libstdcxx_flags+=("-static-libgcc")
-            host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic")
-            host_libstdcxx_flags+=("-lm")
-        elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then
-            # When companion libraries are build static (eg !shared),
-            # the libstdc++ is not pulled automatically, although it
-            # is needed. Shoe-horn it in our LDFLAGS
-            # Ditto libm on some Fedora boxen
-            final_LDFLAGS+=("-lstdc++")
-            final_LDFLAGS+=("-lm")
-        fi
     fi
 
     if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then

--
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]