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]

suggested patches for crosstool-ng v.1.3.2 -> adding uclibc++ support


Attached is 3 patches to support uClibc++ in crosstool-ng v.1.3.2,

Best regards,
Stefan Hallas Andersen
Cisco Systems Inc.
--- /dev/null	2009-03-13 12:41:30.082500994 -0500
+++ b/scripts/uclibc++.sh	2009-03-31 23:58:35.000000000 -0500
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Tuple for Cross Compiling
+export ARCH=${CT_ARCH}-unknown-linux-uclibc
+
+# This won't work if we're building a cross-compiler for the same thing we're running on, 
+# because GCC thinks too much
+export CROSS_TARGET=${CT_ARCH}-unknown-linux
+export CROSS_HOST=`uname -m`-unknown-linux
+
+# The current GCC source directory crosstool-ng has
+export GCCSRC=${CT_WORK_DIR}/src/${CT_CC}-${CT_CC_VERSION}
+
+# Crosstool-ng has this as a config option. ...why
+export CPUS=${CT_PARALLEL_JOBS}
+
+# Where we need a clean directory to do this GCC hack
+export GCC_WORK_DIR="${CT_WORK_DIR}/${ARCH}/build/build-uclibc++-gcc"
+rm -rf ${GCC_WORK_DIR}
+mkdir -p $GCC_WORK_DIR
+cd $GCC_WORK_DIR
+
+# We need the cross-compiler in our path to do this
+export PATH=${CT_PREFIX_DIR}/bin:$PATH
+
+sed -i 's@^STMP_FIX.*@@' "${GCCSRC}/gcc/Makefile.in"
+
+CC="${ARCH}-gcc" GCC_FOR_TARGET="${ARCH}-gcc" CC_FOR_TARGET="${ARCH}-gcc" \
+  AR="${ARCH}-ar" AR_FOR_TARGET="${ARCH}-ar" AS="${ARCH}-as" LD="${ARCH}-ld" \
+  ac_cv_path_AR_FOR_TARGET="${ARCH}-ar" \
+  ac_cv_path_RANLIB_FOR_TARGET="${ARCH}-ranlib" \
+  ac_cv_path_NM_FOR_TARGET="${ARCH}-nm" \
+  NM="${ARCH}-nm" NM_FOR_TARGET="${ARCH}-nm" CXX_FOR_TARGET="${ARCH}-g++" \
+  "${GCCSRC}/configure" --prefix=/ --disable-multilib \
+  --build="${CROSS_HOST}" --host="${CROSS_TARGET}" --target="${CROSS_TARGET}" \
+  --enable-long-long --enable-c99 --enable-shared --enable-threads=posix \
+  --enable-__cxa_atexit --disable-nls --enable-languages=c,c++ \
+  --disable-libstdcxx-pch --enable-sjlj-exceptions --program-prefix=""
+
+make -j $CPUS configure-host
+make -j $CPUS configure-target-libstdc++-v3
+cd "$CROSS_TARGET"/libstdc++-v3/libsupc++
+make -j $CPUS &&
+
+# The only file we actually needed
+cp .libs/libsupc++.a ${CT_PREFIX_DIR}/lib &&
+
+# Build uClibc++
+export UCLIBC_WORK_DIR="${CT_WORK_DIR}/${ARCH}/build/build-uclibc++"
+rm -rf ${UCLIBC_WORK_DIR}
+mkdir -p ${UCLIBC_WORK_DIR}
+
+cd ${CT_LOCAL_TARBALLS_DIR}
+if [[ ! -f ${CT_LOCAL_TARBALLS_DIR}/uClibc++-0.2.2.tar.bz2 ]]; then
+   wget http://cxx.uclibc.org/src/uClibc++-0.2.2.tar.bz2
+fi
+
+cd ${UCLIBC_WORK_DIR}
+tar -jxvf ${CT_LOCAL_TARBALLS_DIR}/uClibc++-0.2.2.tar.bz2 
+
+# Build uClib++ 
+cd uClibc++-0.2.2
+CROSS= make defconfig &&
+sed -r -i 's/(UCLIBCXX_HAS_(TLS|LONG_DOUBLE))=y/# \1 is not set/' .config &&
+sed -r -i '/UCLIBCXX_RUNTIME_PREFIX=/s/".*"/""/' .config &&
+CROSS= make oldconfig &&
+CROSS="$ARCH"- make &&
+CROSS= make install PREFIX="${UCLIBC_WORK_DIR}"
+
+# Get rid of the old libstd++ files
+cd ${UCLIBC_WORK_DIR}
+rm "${CT_PREFIX_DIR}"/"${ARCH}"/lib/libstdc++*
+
+# Use the new ones
+cp "${UCLIBC_WORK_DIR}"/lib/* "${CT_PREFIX_DIR}"/"${ARCH}"/lib &&
+cd "${CT_PREFIX_DIR}"/"${ARCH}"/lib &&
+ln -s libuClibc++.so libstdc++.so &&
+ln -s libuClibc++.a libstdc++.a &&
+
+# Get rid of the old C++ include files
+rm -rf "${CT_PREFIX_DIR}"/"${ARCH}"/include/c++/${CT_CC_VERSION}/
+mkdir -p "${CT_PREFIX_DIR}"/"${ARCH}"/include/c++/${CT_CC_VERSION}/
+
+# And use uClibc++
+cp "${UCLIBC_WORK_DIR}"/include/* "${CT_PREFIX_DIR}"/"${ARCH}"/include/c++/${CT_CC_VERSION}/
--- a/scripts/crosstool.sh	2009-01-27 17:22:47.000000000 -0600
+++ b/scripts/crosstool.sh	2009-04-01 01:47:44.000000000 -0500
@@ -22,6 +22,8 @@
 
 # Parse the configuration file
 # It has some info about the logging facility, so include it early
+# We want it exported for any subshells
+for symbol in `grep "=" .config`; do export $symbol; done
 . .config
 
 # Overide the locale early, in case we ever translate crosstool-NG messages
@@ -508,7 +510,14 @@
         CT_DoExecLog ALL rm -rf "${CT_PREFIX_DIR}/"{,usr/}{man,info}
         CT_DoExecLog ALL rm -rf "${CT_SYSROOT_DIR}/"{,usr/}{man,info}
         CT_DoExecLog ALL rm -rf "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info}
+    fi  
+    
+    if [ "${CT_UCLIBCPLUSPLUS}" = "y" ]; then
+      CT_DoLog INFO "Building uClibc++"
+		chmod u+x ${CT_LIB_DIR}/scripts/uclibc++.sh
+      ${CT_LIB_DIR}/scripts/uclibc++.sh &> /dev/null
     fi
+
 fi
 
 CT_DoEnd INFO
--- a/config/libc/uClibc.in	2008-11-14 07:49:27.000000000 -0600
+++ b/config/libc/uClibc.in	2009-03-31 23:56:06.000000000 -0500
@@ -38,6 +38,10 @@
     bool
     prompt "0.9.30"
 
+config LIBC_V_0_9_30_1
+   bool
+   prompt "0.9.30.1"
+
 # CT_INSERT_VERSION_ABOVE
 # Don't remove above line!
 
@@ -63,6 +67,7 @@
     default "0.9.28.3" if LIBC_V_0_9_28_3
     default "0.9.29" if LIBC_V_0_9_29
     default "0.9.30" if LIBC_V_0_9_30
+    default "0.9.30.1" if LIBC_V_0_9_30_1
 # CT_INSERT_VERSION_STRING_ABOVE
 # Don't remove above line!
 
@@ -141,3 +146,10 @@
       Say y if you want uClibc to support localisation.
 
       Note that seems to be broken on recent uClibc releases.
+
+config UCLIBCPLUSPLUS
+   bool
+   prompt "uClibc++ Support"
+   default n
+   help
+     Say y if you want to use uClibc++ as your C++ library
--
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]