summaryrefslogtreecommitdiff
path: root/simple-build-script
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-19 21:48:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-19 21:48:57 +0000
commit532c9ef5cedf319cf8266c9c252eeb5776e6911c (patch)
treea14d25d974b21c68da385cd4cbe5ce9d906317b3 /simple-build-script
parentf86602791bf50df5c9bc83396720f52ee80f59c7 (diff)
2010-07-19 Joel Sherrill <joel.sherrilL@OARcorp.com>
* build_tools: Add command line arguments and let you do individual parts of the build process.
Diffstat (limited to 'simple-build-script')
-rw-r--r--simple-build-script/ChangeLog5
-rw-r--r--simple-build-script/build_tools186
2 files changed, 138 insertions, 53 deletions
diff --git a/simple-build-script/ChangeLog b/simple-build-script/ChangeLog
index 8112689..a20ff1b 100644
--- a/simple-build-script/ChangeLog
+++ b/simple-build-script/ChangeLog
@@ -1,5 +1,10 @@
2010-07-19 Joel Sherrill <joel.sherrilL@OARcorp.com>
+ * build_tools: Add command line arguments and let you do individual
+ parts of the build process.
+
+2010-07-19 Joel Sherrill <joel.sherrilL@OARcorp.com>
+
* README: Fix typo.
2010-03-28 Joel Sherrill <joel.sherrill@oarcorp.com>
diff --git a/simple-build-script/build_tools b/simple-build-script/build_tools
index fa91071..21398af 100644
--- a/simple-build-script/build_tools
+++ b/simple-build-script/build_tools
@@ -1,30 +1,29 @@
#! /bin/sh
#
# This script is a simple script to build and install rtems toolset
-# for the target you specify by editing TARGET below. It should be
-# of the form <CPU>-rtems<VERSION>. For example, sparc-rtems4.11
+# for the target you specify on the command line. It should be of
+# the form <CPU>-rtems<VERSION>. For example, sparc-rtems4.11
#
# This can be used to build versions from CVS/SVN or released versions.
# Please be sure to apply appropriate patches from
# rtems/contrib/crossrpms/patches.
#
-# --Joel Sherrill (28 Match 2010)
+# --Joel Sherrill (28 March 2010)
#
# $Id$
#
### EDIT THESE AS NEEDED
-INSTALL=NOT_SET
-TARGET=sparc-rtems4.10
-AUTOCONF=autoconf-2.65
+AUTOCONF=autoconf-2.66
AUTOMAKE=automake-1.11.1
BINUTILS=binutils-2.20.1
GDB=gdb-7.1
-GCC=gcc-4.4.3
+GCC=gcc-4.5.0
NEWLIB=newlib-1.18.0
LANGUAGES="c,c++"
### END OF EDIT THESE
+
BASE=`pwd`
# log an error to stderr
@@ -48,50 +47,143 @@ check_status()
fi
}
-test $# -eq 1
-check_status $? "Useage: $0 install_point"
+toggle()
+{
+ case $1 in
+ no) echo "yes" ;;
+ yes) echo "no" ;;
+ *) fatal "Unknown value to toggle ($1)" ;;
+ esac
+}
+
+usage()
+{
+cat <<EOF
+ -v verbose
+ -A toggle building all parts
+ -a toggle building autoconf
+ -m toggle building automake
+ -b toggle building binutils
+ -g toggle building gcc/newlib
+ -d toggle building db
+ -i INSTALL specify install directory (required)
+ -t TARGET specify target (required)
+
+EOF
+exit 1
+}
+
+do_autoconf=no
+do_automake=no
+do_binutils=no
+do_gdb=no
+do_gcc_newlib=no
+verbose=no
+TARGET=NOT_SET
+INSTALL=NOT_SET
-INSTALL=$1
+while getopts vAambgdi:t: OPT
+do
+ case "$OPT" in
+ A) do_autoconf=`toggle ${do_autoconf}`
+ do_automake=`toggle ${do_automake}`
+ do_binutils=`toggle ${do_binutils}`
+ do_gdb=`toggle ${do_gdb}`
+ do_gcc_newlib=`toggle ${do_gcc_newlib}`
+ ;;
+ a) do_autoconf=`toggle ${do_autoconf}` ;;
+ m) do_automake=`toggle ${do_automake}` ;;
+ b) do_binutils=`toggle ${do_binutils}` ;;
+ g) do_gcc_newlib=`toggle ${do_gcc_newlib}` ;;
+ d) do_gdb=`toggle ${do_gdb}` ;;
+ i) INSTALL="${OPTARG}" ;;
+ t) TARGET="${OPTARG}" ;;
+ v) verbose=`toggle ${verbose}` ;;
+ *) echo ERROR ; exit 1 ;;
+ esac
+done
+
+if [ ${verbose} = "yes" ] ; then
+ echo "Build autoconf: " ${do_autoconf}
+ echo "Build automake: " ${do_automake}
+ echo "Build binutils: " ${do_binutils}
+ echo "Build gdb: " ${do_gdb}
+ echo "Build gcc/newlib: " ${do_gcc_newlib}
+ echo "Install point: " ${INSTALL}
+ echo "Target: " ${TARGET}
+ echo
+fi
### Validate arguments
+test ${TARGET} != NOT_SET
+check_status $? "TARGET not specified"
+
+test ${INSTALL} != NOT_SET
+check_status $? "INSTALL not specified"
+
if [ ! -d ${INSTALL} ] ; then
mkdir ${INSTALL}
check_status $? "failed to make ${INSTALL}"
fi
-test -d ${BINUTILS}
-check_status $? "No ${BINUTILS} - You do not appear to be in src directory"
+if [ ${do_autoconf} = yes ] ; then
+ test -d ${AUTOCONF}
+ check_status $? "No ${AUTOCONF} - You do not appear to be in src directory"
+ TOBUILD="${TOBUILD} ${AUTOCONF}"
+fi
+
+if [ ${do_automake} = yes ] ; then
+ test -d ${AUTOMAKE}
+ check_status $? "No ${AUTOMAKE} - You do not appear to be in src directory"
+ TOBUILD="${TOBUILD} ${AUTOMAKE}"
+fi
-test -d ${GCC}
-check_status $? "No ${GCC} - You do not appear to be in src directory"
+if [ ${do_binutils} = yes ] ; then
+ test -d ${BINUTILS}
+ check_status $? "No ${BINUTILS} - You do not appear to be in src directory"
+ TOBUILD="${TOBUILD} ${BINUTILS}"
+fi
-test -d ${NEWLIB}
-check_status $? "No ${NEWLIB} - You do not appear to be in src directory"
+if [ ${do_gdb} = yes ] ; then
+ test -d ${GDB}
+ check_status $? "No ${GDB} - You do not appear to be in src directory"
+ TOBUILD="${TOBUILD} ${GDB}"
+fi
-test -d ${GDB}
-check_status $? "No ${GDB} - You do not appear to be in src directory"
+if [ ${do_gcc_newlib} = yes ] ; then
+ test -d ${GCC}
+ check_status $? "No ${GCC} - You do not appear to be in src directory"
-if [ ! -d ${GCC}/newlib -o ! -d ${GCC}/libgloss ] ; then
- echo "Please ensure that ${GCC}/newlib and ${GCC}/libgloss are symbolic"
- echo "links into the newlib tree. Use commands simiilar to the following:"
- echo ""
- echo "ln -s ${BASE}/${NEWLIB}/newlib ${BASE}/${GCC}/newlib"
- echo "ln -s ${BASE}/${NEWLIB}/libgloss ${BASE}/${GCC}/libgloss"
- exit 1
+ test -d ${NEWLIB}
+ check_status $? "No ${NEWLIB} - You do not appear to be in src directory"
+
+ if [ ! -d ${GCC}/newlib -o ! -d ${GCC}/libgloss ] ; then
+ echo "Please ensure that ${GCC}/newlib and ${GCC}/libgloss are symbolic"
+ echo "links into the newlib tree. Use commands simiilar to the following:"
+ echo ""
+ echo "ln -s ${BASE}/${NEWLIB}/newlib ${BASE}/${GCC}/newlib"
+ echo "ln -s ${BASE}/${NEWLIB}/libgloss ${BASE}/${GCC}/libgloss"
+ exit 1
+ fi
+
+ TOBUILD="${TOBUILD} ${GCC}"
fi
export PATH=${INSTALL}/bin:$PATH
-
-### Everything except GCC
-for pkg in ${AUTOCONF} ${AUTOMAKE} ${BINUTILS} ${GDB}
+### Build everything
+for pkg in ${TOBUILD}
do
+ rm -rf b-${pkg}
+ check_status $? "failed to rm b-${pkg}"
+
mkdir b-${pkg}
check_status $? "failed to make b-${pkg}"
cd b-${pkg}
check_status $? "failed to cd b-${pkg}"
- case pkg in
+ echo "Configuring ${pkg}..."
+ case $pkg in
auto*) # autotools are native
../${pkg}/configure --prefix=${INSTALL} >c.log 2>&1
check_status $? "failed to configure ${pkg}"
@@ -109,15 +201,27 @@ do
>c.log 2>&1
check_status $? "failed to configure ${pkg}"
;;
+ gcc*)
+ ../${GCC}/configure \
+ --enable-threads=rtems --with-gnu-as --enable-multilib \
+ --enable-newlib-mb --enable-newlib-iconv \
+ --with-gnu-ld --with-newlib --verbose --with-system-zlib --disable-nls \
+ --enable-version-specific-runtime-libs \
+ --enable-languages=${LANGUAGES} --target=${TARGET} --prefix=${INSTALL} \
+ >c.log 2>&1
+ check_status $? "failed to configure ${pkg}"
+ ;;
*)
prerr "UNKNOWN PACKAGE ${pkg}"
exit 1
;;
esac
+ echo "Building ${pkg}..."
make >b.log 2>&1
check_status $? "failed to make ${pkg}"
+ echo "Installing ${pkg}..."
make install >i.log 2>&1
check_status $? "failed to install ${pkg}"
@@ -125,28 +229,4 @@ do
rm -rf b-${pkg}
done
-### GCC/NEWLIB
-mkdir b-${GCC}
-check_status $? "failed to make b-${GCC}"
-
-cd b-${GCC}
-check_status $? "failed to cd b-${GCC}"
-
-../${GCC}/configure \
- --enable-threads=rtems --with-gnu-as --enable-multilib \
- --enable-newlib-mb --enable-newlib-iconv \
- --with-gnu-ld --with-newlib --verbose --with-system-zlib --disable-nls \
- --enable-version-specific-runtime-libs \
- --enable-languages=${LANGUAGES} --target=${TARGET} --prefix=${INSTALL} \
- >c.log 2>&1
-
-make >b.log 2>&1
-check_status $? "failed to make ${GCC}/newlib"
-
-make install >i.log 2>&1
-check_status $? "failed to install ${GCC}/newlib"
-
-cd ..
-rm -rf b-${GCC}
-
exit 0