2006-05-02 23:35:55 +02:00
|
|
|
#!/bin/sh
|
2007-02-09 13:32:21 +01:00
|
|
|
# vi: set sw=4 ts=4:
|
2006-05-02 23:35:55 +02:00
|
|
|
#set -x
|
|
|
|
|
2007-03-21 19:15:02 +01:00
|
|
|
export LC_ALL=C
|
2006-12-13 08:21:16 +01:00
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Verify that critical environment variables aren't set
|
|
|
|
for var in CC CXX CPP CFLAGS CXXFLAGS GREP_OPTIONS CROSS_COMPILE ARCH ; do
|
|
|
|
if test -n "$(eval echo '$'$var)" ; then
|
|
|
|
/bin/echo -e "\nYou must run 'unset $var' so buildroot can run with";
|
2006-12-13 10:17:12 +01:00
|
|
|
/bin/echo -e "a clean environment on your build machine\n";
|
2006-12-13 08:21:16 +01:00
|
|
|
exit 1;
|
2009-12-16 08:33:38 +01:00
|
|
|
fi
|
|
|
|
done
|
2007-06-26 15:26:51 +02:00
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Verify that grep works
|
2007-01-19 18:11:05 +01:00
|
|
|
echo "WORKS" | grep "WORKS" >/dev/null 2>&1
|
|
|
|
if test $? != 0 ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\ngrep doesn't work\n"
|
2007-01-19 18:11:05 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# sanity check for CWD in LD_LIBRARY_PATH
|
|
|
|
# try not to rely on egrep..
|
|
|
|
if test -n "$LD_LIBRARY_PATH" ; then
|
2010-05-22 00:52:22 +02:00
|
|
|
/bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':\.:' >/dev/null 2>&1 ||
|
|
|
|
/bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
|
|
|
/bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
|
|
|
|
/bin/echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | /bin/grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
2007-01-19 18:11:05 +01:00
|
|
|
if test $? = 0; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou seem to have the current working directory in your"
|
|
|
|
/bin/echo -e "LD_LIBRARY_PATH environment variable. This doesn't work.\n"
|
2007-01-19 18:11:05 +01:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
fi;
|
|
|
|
|
2010-05-22 00:53:08 +02:00
|
|
|
# sanity check for CWD in PATH. Having the current working directory
|
|
|
|
# in the PATH makes the toolchain build process break.
|
|
|
|
# try not to rely on egrep..
|
|
|
|
if test -n "$PATH" ; then
|
|
|
|
/bin/echo TRiGGER_start"$PATH"TRiGGER_end | /bin/grep ':\.:' >/dev/null 2>&1 ||
|
|
|
|
/bin/echo TRiGGER_start"$PATH"TRiGGER_end | /bin/grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
|
|
|
/bin/echo TRiGGER_start"$PATH"TRiGGER_end | /bin/grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
|
2010-06-09 12:04:25 +02:00
|
|
|
/bin/echo TRiGGER_start"$PATH"TRiGGER_end | /bin/grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
2010-05-22 00:53:08 +02:00
|
|
|
if test $? = 0; then
|
|
|
|
/bin/echo -e "\nYou seem to have the current working directory in your"
|
|
|
|
/bin/echo -e "PATH environment variable. This doesn't work.\n"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
fi;
|
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Verify that which is installed
|
2006-11-29 11:39:30 +01:00
|
|
|
if ! which which > /dev/null ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'which' on your build machine\n";
|
2006-11-29 11:39:30 +01:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2010-09-30 23:09:39 +02:00
|
|
|
if ! which sed > /dev/null ; then
|
|
|
|
/bin/echo -e "\nYou must install 'sed' on your build machine\n"
|
|
|
|
exit 1
|
2007-03-09 09:33:34 +01:00
|
|
|
fi
|
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check make
|
2007-05-11 14:50:15 +02:00
|
|
|
MAKE=$(which make 2> /dev/null)
|
2006-05-02 23:35:55 +02:00
|
|
|
if [ -z "$MAKE" ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'make' on your build machine\n";
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
2010-09-30 23:09:39 +02:00
|
|
|
MAKE_VERSION=$($MAKE --version 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
|
2006-05-02 23:35:55 +02:00
|
|
|
if [ -z "$MAKE_VERSION" ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'make' on your build machine\n";
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
2010-09-30 23:09:39 +02:00
|
|
|
MAKE_MAJOR=$(echo $MAKE_VERSION | sed -e "s/\..*//g")
|
|
|
|
MAKE_MINOR=$(echo $MAKE_VERSION | sed -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
|
2009-09-30 09:03:40 +02:00
|
|
|
if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 81 ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou have make '$MAKE_VERSION' installed. GNU make >=3.81 is required\n"
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check host gcc
|
2007-03-21 19:15:02 +01:00
|
|
|
COMPILER=$(which $HOSTCC 2> /dev/null)
|
2006-05-02 23:35:55 +02:00
|
|
|
if [ -z "$COMPILER" ] ; then
|
2007-05-11 14:50:15 +02:00
|
|
|
COMPILER=$(which cc 2> /dev/null)
|
2006-05-02 23:35:55 +02:00
|
|
|
fi;
|
2006-11-29 11:39:30 +01:00
|
|
|
if [ -z "$COMPILER" ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'gcc' on your build machine\n";
|
2006-11-29 11:39:30 +01:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2010-09-30 23:09:39 +02:00
|
|
|
COMPILER_VERSION=$($COMPILER -v 2>&1 | sed -n '/^gcc version/p' |
|
|
|
|
sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
|
2006-05-02 23:35:55 +02:00
|
|
|
if [ -z "$COMPILER_VERSION" ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'gcc' on your build machine\n";
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
2010-09-30 23:09:39 +02:00
|
|
|
COMPILER_MAJOR=$(echo $COMPILER_VERSION | sed -e "s/\..*//g")
|
|
|
|
COMPILER_MINOR=$(echo $COMPILER_VERSION | sed -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
|
2006-05-02 23:35:55 +02:00
|
|
|
if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
echo "\nYou have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required\n"
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2007-02-09 13:32:21 +01:00
|
|
|
# check for host CXX
|
2007-03-21 19:15:02 +01:00
|
|
|
CXXCOMPILER=$(which $HOSTCXX 2> /dev/null)
|
2007-02-09 13:32:21 +01:00
|
|
|
if [ -z "$CXXCOMPILER" ] ; then
|
2007-05-11 14:50:15 +02:00
|
|
|
CXXCOMPILER=$(which c++ 2> /dev/null)
|
2007-02-09 13:32:21 +01:00
|
|
|
fi
|
|
|
|
if [ -z "$CXXCOMPILER" ] ; then
|
|
|
|
/bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
|
|
|
|
#exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -z "$CXXCOMPILER" ] ; then
|
2010-09-30 23:09:39 +02:00
|
|
|
CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
|
|
|
|
sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
|
2007-02-09 13:32:21 +01:00
|
|
|
if [ -z "$CXXCOMPILER_VERSION" ] ; then
|
|
|
|
/bin/echo -e "\nYou may have to install 'g++' on your build machine\n"
|
|
|
|
fi
|
|
|
|
|
2010-09-30 23:09:39 +02:00
|
|
|
CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/\..*//g")
|
|
|
|
CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
|
2007-02-09 13:32:21 +01:00
|
|
|
if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required\n"
|
2007-02-09 13:32:21 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2006-05-02 23:35:55 +02:00
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check bash
|
2009-01-01 22:20:46 +01:00
|
|
|
if ! $SHELL --version 2>&1 | grep -q '^GNU bash'; then
|
2009-12-16 08:33:38 +01:00
|
|
|
/bin/echo -e "\nYou must install 'bash' on your build machine\n";
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check that a few mandatory programs are installed
|
2010-07-29 08:37:56 +02:00
|
|
|
for prog in awk bison flex msgfmt makeinfo patch gzip bzip2 perl tar wget cpio python svn ; do
|
2009-12-16 08:33:38 +01:00
|
|
|
if ! which $prog > /dev/null ; then
|
|
|
|
/bin/echo -e "\nYou must install '$prog' on your build machine";
|
|
|
|
if test $prog = "makeinfo" ; then
|
|
|
|
/bin/echo -e "makeinfo is usually part of the texinfo package in your distribution\n"
|
|
|
|
elif test $prog = "msgfmt" ; then
|
|
|
|
/bin/echo -e "msgfmt is usually part of the gettext package in your distribution\n"
|
2010-07-29 08:37:56 +02:00
|
|
|
elif test $prog = "svn" ; then
|
|
|
|
/bin/echo -e "svn is usually part of the subversion package in your distribution\n"
|
2009-12-16 08:33:38 +01:00
|
|
|
else
|
|
|
|
/bin/echo -e "\n"
|
|
|
|
fi
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
2009-12-16 08:33:38 +01:00
|
|
|
fi
|
|
|
|
done
|
2010-08-11 13:10:54 +02:00
|
|
|
|
|
|
|
if grep ^BR2_TOOLCHAIN_BUILDROOT=y $CONFIG_FILE > /dev/null && \
|
|
|
|
grep ^BR2_ENABLE_LOCALE=y $CONFIG_FILE > /dev/null ; then
|
|
|
|
if ! which locale > /dev/null ; then
|
|
|
|
/bin/echo -e "\nYou need locale support on your build machine to build a toolchain supporting locales\n"
|
|
|
|
exit 1 ;
|
|
|
|
fi
|
|
|
|
if ! locale -a | grep -i utf8$ ; then
|
|
|
|
/bin/echo -e "\nYou need at least one UTF8 locale to build a toolchain supporting locales\n"
|
|
|
|
exit 1 ;
|
|
|
|
fi
|
|
|
|
fi
|