Merged branch arm changes r411:415 into trunk
[hvlinux.git] / functions
index b799c51..79a57e1 100644 (file)
--- a/functions
+++ b/functions
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # This file is 'sourced' by other scripts, therefore the above line is of no
 # use, except when modifying the file in emacs to have syntax highlighting.
 
@@ -22,6 +22,8 @@ BRACKET="\033[1;34m"
 
 TAR_OPTS="-b8"
 
+HV_FONTS_PATH="/usr/share/fonts"
+
 # It seems that when compiling bash-4.0, using
 # "make -j 1" is causing problems...
 if [ "x${MAKEJOBS}" = "x1" ]; then
@@ -31,14 +33,27 @@ else
 fi
 
 case "${HVL_TARGET}" in
+    arm*)
+        CLFS_BUILDFLAGS="-mabi=aapcs-linux -mfloat-abi=soft"
+        CLFS_TARGET="arm-linux-gnueabi"
+        CLFS_ARCH=$(echo ${CLFS_TARGET} | sed -e 's/-.*//' -e 's/arm.*/arm/g')
+        CLFS_ENDIAN=$(echo ${CLFS_ARCH} | sed -e 's/armeb/BIG/' -e 's/arm/LITTLE/')
+        if [ "${CLFS_ENDIAN}" = "LITTLE" ]; then
+            CLFS_NOT_ENDIAN="BIG"
+        else
+            CLFS_NOT_ENDIAN="LITTLE"
+        fi
+       ;;
     "x86_64")
        CLFS_BUILDFLAGS="-m64"
         CLFS_TARGET="${HVL_TARGET}-unknown-linux-gnu"
+        CLFS_ARCH=${HVL_TARGET}
        ;;
     "x86")
         # No special flags
        CLFS_BUILDFLAGS=""
         CLFS_TARGET="i686-unknown-linux-gnu"
+        CLFS_ARCH=${HVL_TARGET}
        ;;
     *)
        echo "Unsupported target architecture: ${HVL_TARGET}"
@@ -46,6 +61,11 @@ case "${HVL_TARGET}" in
        ;;
 esac
 
+CLFS_HOST="$(echo $MACHTYPE | \
+    sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
+
+export CLFS_BUILDFLAGS CLFS_TARGET CLFS_ARCH CLFS_HOST CLFS_ENDIAN CLFS_NOT_ENDIAN
+
 CLFS=${LFS}
 
 # Extracting the version number from a complete package name.
@@ -97,7 +117,7 @@ get_pkg_name()
        return 1
     fi
 
-    echo ${1} | sed "s!^\(.*\)-.*!\1!g"
+    echo ${1} | sed "s!^\(.*\)-[0-9]*\.[0-9]*.*!\1!g"
 }
 
 # Saves the content of CFLAGS and CXXFLAGS environment variables.
@@ -853,7 +873,14 @@ rcmd()
 
     # Executing command
     ${CMD_WITH_ARGS} 1>> ${LFS_LOG_FILE} 2>&1
-    eval_retval
+    if [ $? -ne 0 ]; then
+       print_status failure
+        if [ -n "${RCMD_NO_EXIT}" ]; then
+            return ${EXIT_FAILURE}
+        else
+           exit ${EXIT_FAILURE}
+        fi
+    fi
 
     # Displaying build time after the package name
     print_status success