changeset 8:0068264ad65a

Some work I did back in october but hadn't checked in yet: let setupfor() specify source directory to allow gcc to build out of tree. Add basic uClibc build.
author Rob Landley <rob@landley.net>
date Tue, 28 Nov 2006 16:15:07 -0500
parents f8c588578fa1
children 6cd344d090de
files build.sh
diffstat 1 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Tue Nov 28 16:08:42 2006 -0500
+++ b/build.sh	Tue Nov 28 16:15:07 2006 -0500
@@ -26,7 +26,8 @@
   echo
 }
 
-# Extract package $1, use work directory $2 (or $1 if no $2)
+# Extract package $1, use work directory $2 (or $1 if no $2), use source
+# directory $3 (or $1 if no $3)
 
 function setupfor()
 {
@@ -42,7 +43,9 @@
     mkdir "$2"
     cd "$2" || dienow
   fi
-  export CURSRC="${WORK}/$1"*
+  export CURSRC="$1"
+  [ ! -z "$3" ] && CURSRC="$3"
+  export CURSRC=`echo "${WORK}/${CURSRC}"*`
   [ ! -d "${CURSRC}" ] && dienow
 }
 
@@ -55,7 +58,7 @@
 
 TOP=`pwd`
 export SOURCES="${TOP}/sources"
-export CROSS="${TOP}/build/cross-compiler"
+export CROSS="${TOP}/build/cross-compiler/"
 export WORK="${TOP}/build/temp"
 mkdir -p "${CROSS}" "${WORK}"
 
@@ -74,9 +77,6 @@
 
 export STAGE=build-cross
 
-if false
-then
-
 echo === Install linux-headers.
 
 setupfor linux-headers
@@ -105,15 +105,14 @@
 
 [ $? -ne 0 ] && dienow
 
-
-setupfor gcc-core build-gcc
+setupfor gcc-core build-gcc gcc-
 # Remove /usr/libexec/gcc and /usr/lib/gcc from gcc's search path.  (Don't grab
 # random host libraries when cross-compiling, it's not polite.)
 sed -ie 's/standard_exec_prefix_//;T;N;d' "${CURSRC}/gcc/gcc.c" &&
 # Adjust StartFile Spec to point to cross libraries.
-#echo -e "\n#undef STARTFILE_PREFIX_SPEC\n#define STARTFILE_PREFIX_SPEC \"${CROSS}/lib/\"" >> ../gcc-*/gcc/config/linux.h &&
+echo -e "\n#undef STARTFILE_PREFIX_SPEC\n#define STARTFILE_PREFIX_SPEC \"${CROSS}/lib/\"" >> ../gcc-*/gcc/config/linux.h &&
 # Adjust preprocessor's default search path
-#sed -ire "s@(^CROSS_SYSTEM_HEADER_DIR =).*@\1 ${CROSS}/include@g" ../gcc-*/gcc/Makefile.in &&
+sed -ire "s@(^CROSS_SYSTEM_HEADER_DIR =).*@\1 ${CROSS}/include@g" ../gcc-*/gcc/Makefile.in &&
 "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \
 	--target=${CROSS_TARGET} --with-local-prefix="${CROSS}" \
 	--disable-multilib --disable-nls --disable-shared --disable-threads \
@@ -123,6 +122,19 @@
 cd .. &&
 rm -rf "${CURSRC}" build-gcc
 
-fi
+[ $? -ne 0 ] && dienow
+
+setupfor uClibc
+make TARGET_ARCH=${ARCH} CROSS=${CROSS_TARGET}- defconfig &&
+make TARGET_ARCH=${ARCH} CROSS=${CROSS_TARGET}- KERNEL_SOURCE="${CROSS}" &&
+make TARGET_ARCH=${ARCH} CROSS=${CROSS_TARGET}- utils &&
+# The kernel headers are already installed, but uClibc's install will try to
+# be "helpful" and copy them over themselves, at which point hilarity ensues.
+# Make it not do that.
+rm include/{asm,asm-generic,linux} &&
+make RUNTIME_PREFIX="${CROSS}" DEVEL_PREFIX="${CROSS}" \
+	install_runtime install_dev &&
+cd .. &&
+rm -rf uClibc
 
 [ $? -ne 0 ] && dienow