ruby: bump version to 2.4.1
[buildroot-gz.git] / support / dependencies / dependencies.sh
blob168d1960a17709edbe7550c6710e380795436b03
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 # 'file' must be present and must be exactly /usr/bin/file,
73 # otherwise libtool fails in incomprehensible ways.
74 check_prog_host "/usr/bin/file"
76 # Check make
77 MAKE=$(which make 2> /dev/null)
78 if [ -z "$MAKE" ] ; then
79 echo
80 echo "You must install 'make' on your build machine";
81 exit 1;
82 fi;
83 MAKE_VERSION=$($MAKE --version 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
84 if [ -z "$MAKE_VERSION" ] ; then
85 echo
86 echo "You must install 'make' on your build machine";
87 exit 1;
88 fi;
89 MAKE_MAJOR=$(echo $MAKE_VERSION | sed -e "s/\..*//g")
90 MAKE_MINOR=$(echo $MAKE_VERSION | sed -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
91 if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 81 ] ; then
92 echo
93 echo "You have make '$MAKE_VERSION' installed. GNU make >=3.81 is required"
94 exit 1;
95 fi;
97 # Check host gcc
98 COMPILER=$(which $HOSTCC_NOCCACHE 2> /dev/null)
99 if [ -z "$COMPILER" ] ; then
100 COMPILER=$(which cc 2> /dev/null)
102 if [ -z "$COMPILER" ] ; then
103 echo
104 echo "You must install 'gcc' on your build machine";
105 exit 1;
108 COMPILER_VERSION=$($COMPILER -v 2>&1 | sed -n '/^gcc version/p' |
109 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
110 if [ -z "$COMPILER_VERSION" ] ; then
111 echo
112 echo "You must install 'gcc' on your build machine";
113 exit 1;
115 COMPILER_MAJOR=$(echo $COMPILER_VERSION | sed -e "s/\..*//g")
116 COMPILER_MINOR=$(echo $COMPILER_VERSION | sed -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
117 if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
118 echo
119 echo "You have gcc '$COMPILER_VERSION' installed. gcc >= 2.95 is required"
120 exit 1;
123 # check for host CXX
124 CXXCOMPILER=$(which $HOSTCXX_NOCCACHE 2> /dev/null)
125 if [ -z "$CXXCOMPILER" ] ; then
126 CXXCOMPILER=$(which c++ 2> /dev/null)
129 if [ -z "$CXXCOMPILER" ] ; then
130 echo
131 echo "You may have to install 'g++' on your build machine"
133 if [ ! -z "$CXXCOMPILER" ] ; then
134 CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
135 sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
136 if [ -z "$CXXCOMPILER_VERSION" ] ; then
137 echo
138 echo "You may have to install 'g++' on your build machine"
142 if [ -n "$CXXCOMPILER_VERSION" ] ; then
143 CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/\..*//g")
144 CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR\.//g" -e "s/\..*//g")
145 if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
146 echo
147 echo "You have g++ '$CXXCOMPILER_VERSION' installed. g++ >= 2.95 is required"
148 exit 1
152 # Check bash
153 # We only check bash is available, setting SHELL appropriately is done
154 # in the top-level Makefile, and we mimick the same sequence here
155 if [ -n "${BASH}" ]; then :
156 elif [ -x /bin/bash ]; then :
157 elif [ -z "$( sh -c 'echo $BASH' )" ]; then
158 echo
159 echo "You must install 'bash' on your build machine"
160 exit 1
163 # Check that a few mandatory programs are installed
164 missing_progs="no"
165 for prog in patch perl tar wget cpio python unzip rsync bc ${DL_TOOLS} ; do
166 if ! which $prog > /dev/null ; then
167 echo "You must install '$prog' on your build machine";
168 missing_progs="yes"
169 if test $prog = "svn" ; then
170 echo " svn is usually part of the subversion package in your distribution"
171 elif test $prog = "hg" ; then
172 echo " hg is usually part of the mercurial package in your distribution"
173 elif test $prog = "zcat" ; then
174 echo " zcat is usually part of the gzip package in your distribution"
175 elif test $prog = "bzcat" ; then
176 echo " bzcat is usually part of the bzip2 package in your distribution"
179 done
181 if test "${missing_progs}" = "yes" ; then
182 exit 1
185 if grep ^BR2_NEEDS_HOST_UTF8_LOCALE=y $BR2_CONFIG > /dev/null; then
186 if ! which locale > /dev/null ; then
187 echo
188 echo "You need locale support on your build machine to build a toolchain supporting locales"
189 exit 1 ;
191 if ! locale -a | grep -q -i utf8$ ; then
192 echo
193 echo "You need at least one UTF8 locale to build a toolchain supporting locales"
194 exit 1 ;
198 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
199 check_prog_host "java"
200 JAVA_GCJ=$(java -version 2>&1 | grep gcj)
201 if [ ! -z "$JAVA_GCJ" ] ; then
202 echo
203 echo "$JAVA_GCJ is not sufficient to compile your package selection."
204 echo "Please install an OpenJDK/IcedTea/Oracle Java."
205 exit 1 ;
209 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
210 check_prog_host "javac"
213 if grep -q ^BR2_NEEDS_HOST_JAR=y $BR2_CONFIG ; then
214 check_prog_host "jar"
217 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then
218 if test ! -f /lib/ld-linux.so.2 ; then
219 echo
220 echo "Your Buildroot configuration uses pre-built tools for the x86 architecture,"
221 echo "but your build machine uses the x86-64 architecture without the 32 bits compatibility"
222 echo "library."
223 echo "If you're running a Debian/Ubuntu distribution, install the libc6-i386,"
224 echo "lib32stdc++6, and lib32z1 packages (or alternatively libc6:i386,"
225 echo "libstdc++6:i386, and zlib1g:i386)."
226 echo "For other distributions, refer to the documentation on how to install the 32 bits"
227 echo "compatibility libraries."
228 exit 1
232 if grep -q ^BR2_HOSTARCH_NEEDS_IA32_COMPILER=y $BR2_CONFIG ; then
233 if ! echo "int main(void) {}" | gcc -m32 -x c - -o /dev/null 2>/dev/null; then
234 echo
235 echo "Your Buildroot configuration needs a compiler capable of building 32 bits binaries."
236 echo "If you're running a Debian/Ubuntu distribution, install the gcc-multilib package."
237 echo "For other distributions, refer to their documentation."
238 exit 1
242 # Check that the Perl installation is complete enough for Buildroot.
243 required_perl_modules="Data::Dumper" # Needed to build host-autoconf
244 required_perl_modules="$required_perl_modules ExtUtils::MakeMaker" # Used by host-libxml-parser-perl
245 required_perl_modules="$required_perl_modules Thread::Queue" # Used by host-automake
247 if grep -q ^BR2_PACKAGE_MPV=y $BR2_CONFIG ; then
248 required_perl_modules="$required_perl_modules Math::BigInt"
249 required_perl_modules="$required_perl_modules Math::BigRat"
252 # This variable will keep the modules that are missing in your system.
253 missing_perl_modules=""
255 for pm in $required_perl_modules ; do
256 if ! perl -e "require $pm" > /dev/null 2>&1 ; then
257 missing_perl_modules="$missing_perl_modules $pm"
259 done
261 if [ -n "$missing_perl_modules" ] ; then
262 echo "Your Perl installation is not complete enough; at least the following"
263 echo "modules are missing:"
264 echo
265 for pm in $missing_perl_modules ; do
266 printf "\t $pm\n"
267 done
268 echo
269 exit 1