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
|
|
|
|
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 grep works
|
2007-01-19 18:11:05 +01:00
|
|
|
echo "WORKS" | grep "WORKS" >/dev/null 2>&1
|
|
|
|
if test $? != 0 ; then
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "grep doesn't work"
|
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
|
2013-12-30 17:31:41 +01:00
|
|
|
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
2007-01-19 18:11:05 +01:00
|
|
|
if test $? = 0; then
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You seem to have the current working directory in your"
|
|
|
|
echo "LD_LIBRARY_PATH environment variable. This doesn't work."
|
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
|
2013-12-30 17:31:41 +01:00
|
|
|
echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
|
|
|
|
echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
|
2010-05-22 00:53:08 +02:00
|
|
|
if test $? = 0; then
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You seem to have the current working directory in your"
|
|
|
|
echo "PATH environment variable. This doesn't work."
|
2010-05-22 00:53:08 +02:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
fi;
|
|
|
|
|
2011-10-14 09:50:02 +02:00
|
|
|
if test -n "$PERL_MM_OPT" ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
echo
|
|
|
|
echo "You have PERL_MM_OPT defined because Perl local::lib"
|
|
|
|
echo "is installed on your system. Please unset this variable"
|
|
|
|
echo "before starting Buildroot, otherwise the compilation of"
|
|
|
|
echo "Perl related packages will fail"
|
|
|
|
exit 1
|
2011-10-14 09:50:02 +02:00
|
|
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'which' on your build machine";
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'sed' on your build machine"
|
2010-09-30 23:09:39 +02:00
|
|
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'make' on your build machine";
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'make' on your build machine";
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You have make '$MAKE_VERSION' installed. GNU make >=3.81 is required"
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check host gcc
|
2010-12-07 21:09:56 +01:00
|
|
|
COMPILER=$(which $HOSTCC_NOCCACHE 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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'gcc' on your build machine";
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You must install 'gcc' on your build machine";
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
|
2006-05-02 23:35:55 +02:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
2007-02-09 13:32:21 +01:00
|
|
|
# check for host CXX
|
2012-02-08 23:40:20 +01:00
|
|
|
CXXCOMPILER=$(which $HOSTCXX_NOCCACHE 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
|
2014-02-05 19:25:49 +01:00
|
|
|
|
2007-02-09 13:32:21 +01:00
|
|
|
if [ -z "$CXXCOMPILER" ] ; then
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You may have to install 'g++' on your build machine"
|
2007-02-09 13:32:21 +01:00
|
|
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You may have to install 'g++' on your build machine"
|
2007-02-09 13:32:21 +01:00
|
|
|
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
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
|
|
|
echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
|
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
|
2014-03-19 00:33:49 +01:00
|
|
|
# We only check bash is available, setting SHELL appropriately is done
|
|
|
|
# in the top-level Makefile, and we mimick the same sequence here
|
|
|
|
if [ -n "${BASH}" ]; then :
|
|
|
|
elif [ -x /bin/bash ]; then :
|
|
|
|
elif [ -z "$( sh -c 'echo $BASH' )" ]; then
|
2014-01-22 19:48:52 +01:00
|
|
|
echo
|
2014-03-19 00:33:49 +01:00
|
|
|
echo "You must install 'bash' on your build machine"
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-05-02 23:35:55 +02:00
|
|
|
|
2009-12-16 08:33:38 +01:00
|
|
|
# Check that a few mandatory programs are installed
|
2013-03-23 23:26:44 +01:00
|
|
|
missing_progs="no"
|
2013-07-05 10:48:09 +02:00
|
|
|
for prog in patch perl tar wget cpio python unzip rsync bc ${DL_TOOLS} ; do
|
2014-02-05 19:25:49 +01:00
|
|
|
if ! which $prog > /dev/null ; then
|
|
|
|
echo "You must install '$prog' on your build machine";
|
|
|
|
missing_progs="yes"
|
|
|
|
if test $prog = "svn" ; then
|
|
|
|
echo " svn is usually part of the subversion package in your distribution"
|
|
|
|
elif test $prog = "hg" ; then
|
|
|
|
echo " hg is usually part of the mercurial package in your distribution"
|
|
|
|
elif test $prog = "zcat" ; then
|
|
|
|
echo " zcat is usually part of the gzip package in your distribution"
|
|
|
|
elif test $prog = "bzcat" ; then
|
|
|
|
echo " bzcat is usually part of the bzip2 package in your distribution"
|
|
|
|
fi
|
2009-12-16 08:33:38 +01:00
|
|
|
fi
|
|
|
|
done
|
2010-08-11 13:10:54 +02:00
|
|
|
|
2013-03-23 23:26:44 +01:00
|
|
|
if test "${missing_progs}" = "yes" ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
exit 1
|
2013-03-23 23:26:44 +01:00
|
|
|
fi
|
|
|
|
|
2014-02-04 16:18:52 +01:00
|
|
|
if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
|
|
|
|
grep ^BR2_ENABLE_LOCALE=y $BR2_CONFIG > /dev/null ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
if ! which locale > /dev/null ; then
|
|
|
|
echo
|
|
|
|
echo "You need locale support on your build machine to build a toolchain supporting locales"
|
|
|
|
exit 1 ;
|
|
|
|
fi
|
|
|
|
if ! locale -a | grep -q -i utf8$ ; then
|
|
|
|
echo
|
|
|
|
echo "You need at least one UTF8 locale to build a toolchain supporting locales"
|
|
|
|
exit 1 ;
|
|
|
|
fi
|
2010-08-11 13:10:54 +02:00
|
|
|
fi
|
2012-12-28 15:07:33 +01:00
|
|
|
|
2014-02-04 16:18:52 +01:00
|
|
|
if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
for prog in javac jar; do
|
|
|
|
if ! which $prog > /dev/null ; then
|
|
|
|
echo >&2
|
|
|
|
echo "You must install '$prog' on your build machine" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2012-12-04 19:28:31 +01:00
|
|
|
fi
|
2012-12-28 15:07:33 +01:00
|
|
|
|
2014-02-19 16:33:50 +01:00
|
|
|
if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
|
2014-02-18 00:37:12 +01:00
|
|
|
if ! which java > /dev/null ; then
|
|
|
|
echo >&2
|
|
|
|
echo "You must install 'java' on your build machine" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-02-04 16:18:52 +01:00
|
|
|
if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
if test ! -f /lib/ld-linux.so.2 ; then
|
|
|
|
echo
|
|
|
|
echo "Your Buildroot configuration uses pre-built tools for the x86 architecture,"
|
|
|
|
echo "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
|
|
|
|
echo "library."
|
|
|
|
echo "If you're running a Debian/Ubuntu distribution, install the libc6:i386,"
|
|
|
|
echo "libstdc++6:i386, and zlib1g:i386 packages."
|
|
|
|
echo "For other distributions, refer to the documentation on how to install the 32 bits"
|
|
|
|
echo "compatibility libraries."
|
|
|
|
exit 1
|
|
|
|
fi
|
2012-12-29 07:14:49 +01:00
|
|
|
fi
|
2013-03-23 23:26:45 +01:00
|
|
|
|
2014-02-04 16:18:52 +01:00
|
|
|
if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
if ! echo "int main(void) {}" | gcc -m32 -x c - -o /dev/null ; then
|
|
|
|
echo
|
|
|
|
echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
|
|
|
|
echo "If you're running a Debian/Ubuntu distribution, install the gcc-multilib package."
|
|
|
|
echo "For other distributions, refer to their documentation."
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-11-11 17:47:25 +01:00
|
|
|
fi
|
|
|
|
|
2013-03-23 23:26:45 +01:00
|
|
|
# Check that the Perl installation is complete enough to build
|
|
|
|
# host-autoconf.
|
|
|
|
if ! perl -e "require Data::Dumper" > /dev/null 2>&1 ; then
|
2014-02-05 19:25:49 +01:00
|
|
|
echo "Your Perl installation is not complete enough, at least Data::Dumper is missing."
|
|
|
|
echo "On Debian/Ubuntu distributions, install the 'perl' package."
|
|
|
|
exit 1
|
2013-03-23 23:26:45 +01:00
|
|
|
fi
|