linux-firmware: bump version
[buildroot-gz.git] / support / dependencies / dependencies.sh
blob01ad82887c7565af4c7ba10f7eb8485c2c9d8c58
1 #!/bin/sh
2 # vi: set sw=4 ts=4:
4 export LC_ALL=C
6 # Verify that grep works
7 echo "WORKS" | grep "WORKS" >/dev/null 2>&1
8 if test $? != 0 ; then
9 echo
10 echo "grep doesn't work"
11 exit 1
14 # sanity check for CWD in LD_LIBRARY_PATH
15 # try not to rely on egrep..
16 if test -n "$LD_LIBRARY_PATH" ; then
17 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep '::' >/dev/null 2>&1 ||
18 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
19 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start:' >/dev/null 2>&1 ||
20 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
21 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':TRiGGER_end' >/dev/null 2>&1 ||
22 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
23 echo TRiGGER_start"$LD_LIBRARY_PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
24 if test $? = 0; then
25 echo
26 echo "You seem to have the current working directory in your"
27 echo "LD_LIBRARY_PATH environment variable. This doesn't work."
28 exit 1;
30 fi;
32 # sanity check for CWD in PATH. Having the current working directory
33 # in the PATH makes the toolchain build process break.
34 # try not to rely on egrep..
35 if test -n "$PATH" ; then
36 echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.:' >/dev/null 2>&1 ||
37 echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.:' >/dev/null 2>&1 ||
38 echo TRiGGER_start"$PATH"TRiGGER_end | grep ':\.TRiGGER_end' >/dev/null 2>&1 ||
39 echo TRiGGER_start"$PATH"TRiGGER_end | grep 'TRiGGER_start\.TRiGGER_end' >/dev/null 2>&1
40 if test $? = 0; then
41 echo
42 echo "You seem to have the current working directory in your"
43 echo "PATH environment variable. This doesn't work."
44 exit 1;
46 fi;
48 if test -n "$PERL_MM_OPT" ; then
49 echo
50 echo "You have PERL_MM_OPT defined because Perl local::lib"
51 echo "is installed on your system. Please unset this variable"
52 echo "before starting Buildroot, otherwise the compilation of"
53 echo "Perl related packages will fail"
54 exit 1
57 check_prog_host()
59 prog="$1"
60 if ! which $prog > /dev/null ; then
61 echo >&2
62 echo "You must install '$prog' on your build machine" >&2
63 exit 1
67 # Verify that which is installed
68 check_prog_host "which"
69 # Verify that sed is installed
70 check_prog_host "sed"
72 # Check make
73 MAKE=$(which make 2> /dev/null)
74 if [ -z "$MAKE" ] ; then
75 echo
76 echo "You must install 'make' on your build machine";
77 exit 1;
78 fi;
79 MAKE_VERSION=$($MAKE --version 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
80 if [ -z "$MAKE_VERSION" ] ; then
81 echo
82 echo "You must install 'make' on your build machine";
83 exit 1;
84 fi;
85 MAKE_MAJOR=$(echo $MAKE_VERSION | sed -e "s/\..*//g")
86 MAKE_MINOR=$(echo $MAKE_VERSION | sed -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
87 if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 81 ] ; then
88 echo
89 echo "You have make '$MAKE_VERSION' installed. GNU make >=3.81 is required"
90 exit 1;
91 fi;
93 # Check host gcc
94 COMPILER=$(which $HOSTCC_NOCCACHE 2> /dev/null)
95 if [ -z "$COMPILER" ] ; then
96 COMPILER=$(which cc 2> /dev/null)
97 fi;
98 if [ -z "$COMPILER" ] ; then
99 echo
100 echo "You must install 'gcc' on your build machine";
101 exit 1;
104 COMPILER_VERSION=$($COMPILER -v 2>&1 | sed -n '/^gcc version/p' |
105 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
106 if [ -z "$COMPILER_VERSION" ] ; then
107 echo
108 echo "You must install 'gcc' on your build machine";
109 exit 1;
111 COMPILER_MAJOR=$(echo $COMPILER_VERSION | sed -e "s/\..*//g")
112 COMPILER_MINOR=$(echo $COMPILER_VERSION | sed -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
113 if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
114 echo
115 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
116 exit 1;
119 # check for host CXX
120 CXXCOMPILER=$(which $HOSTCXX_NOCCACHE 2> /dev/null)
121 if [ -z "$CXXCOMPILER" ] ; then
122 CXXCOMPILER=$(which c++ 2> /dev/null)
125 if [ -z "$CXXCOMPILER" ] ; then
126 echo
127 echo "You may have to install 'g++' on your build machine"
129 if [ ! -z "$CXXCOMPILER" ] ; then
130 CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
131 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
132 if [ -z "$CXXCOMPILER_VERSION" ] ; then
133 echo
134 echo "You may have to install 'g++' on your build machine"
138 if [ -n "$CXXCOMPILER_VERSION" ] ; then
139 CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/\..*//g")
140 CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
141 if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
142 echo
143 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
144 exit 1
148 # Check bash
149 # We only check bash is available, setting SHELL appropriately is done
150 # in the top-level Makefile, and we mimick the same sequence here
151 if [ -n "${BASH}" ]; then :
152 elif [ -x /bin/bash ]; then :
153 elif [ -z "$( sh -c 'echo $BASH' )" ]; then
154 echo
155 echo "You must install 'bash' on your build machine"
156 exit 1
159 # Check that a few mandatory programs are installed
160 missing_progs="no"
161 for prog in patch perl tar wget cpio python unzip rsync bc ${DL_TOOLS} ; do
162 if ! which $prog > /dev/null ; then
163 echo "You must install '$prog' on your build machine";
164 missing_progs="yes"
165 if test $prog = "svn" ; then
166 echo " svn is usually part of the subversion package in your distribution"
167 elif test $prog = "hg" ; then
168 echo " hg is usually part of the mercurial package in your distribution"
169 elif test $prog = "zcat" ; then
170 echo " zcat is usually part of the gzip package in your distribution"
171 elif test $prog = "bzcat" ; then
172 echo " bzcat is usually part of the bzip2 package in your distribution"
175 done
177 if test "${missing_progs}" = "yes" ; then
178 exit 1
181 if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
182 grep ^BR2_ENABLE_LOCALE=y $BR2_CONFIG > /dev/null ; then
183 if ! which locale > /dev/null ; then
184 echo
185 echo "You need locale support on your build machine to build a toolchain supporting locales"
186 exit 1 ;
188 if ! locale -a | grep -q -i utf8$ ; then
189 echo
190 echo "You need at least one UTF8 locale to build a toolchain supporting locales"
191 exit 1 ;
195 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
196 check_prog_host "java"
197 JAVA_GCJ=$(java -version 2>&1 | grep gcj)
198 if [ ! -z "$JAVA_GCJ" ] ; then
199 echo
200 echo "$JAVA_GCJ is not sufficient to compile your package selection."
201 echo "Please install an OpenJDK/IcedTea/Oracle Java."
202 exit 1 ;
206 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
207 check_prog_host "javac"
210 if grep -q ^BR2_NEEDS_HOST_JAR=y $BR2_CONFIG ; then
211 check_prog_host "jar"
214 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
215 if test ! -f /lib/ld-linux.so.2 ; then
216 echo
217 echo "Your Buildroot configuration uses pre-built tools for the x86 architecture,"
218 echo "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
219 echo "library."
220 echo "If you're running a Debian/Ubuntu distribution, install the libc6-i386,"
221 echo "lib32stdc++6, and lib32z1 packages (or alternatively libc6:i386,"
222 echo "libstdc++6:i386, and zlib1g:i386)."
223 echo "For other distributions, refer to the documentation on how to install the 32 bits"
224 echo "compatibility libraries."
225 exit 1
229 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
230 if ! echo "int main(void) {}" | gcc -m32 -x c - -o /dev/null 2>/dev/null; then
231 echo
232 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
233 echo "If you're running a Debian/Ubuntu distribution, install the gcc-multilib package."
234 echo "For other distributions, refer to their documentation."
235 exit 1
239 # Check that the Perl installation is complete enough to build
240 # host-autoconf.
241 if ! perl -e "require Data::Dumper" > /dev/null 2>&1 ; then
242 echo "Your Perl installation is not complete enough, at least Data::Dumper is missing."
243 echo "On Debian/Ubuntu distributions, install the 'perl' package."
244 exit 1