11#! /bin/sh
22
3- set -eux
3+ set -eu
44
55GIT_REPO=" https:////github.com/b49020/u-boot"
66GIT_BRANCH=" qcom-mainline"
@@ -23,18 +23,35 @@ fatal() {
2323packages=" git"
2424# will pull gcc-aarch64-linux-gnu; should pull a native compiler on arm64 and
2525# a cross-compiler on other architectures
26- packages=" $packages crossbuild-essential-arm64"
26+ packages=" ${ packages} crossbuild-essential-arm64"
2727# u-boot build-dependencies
28- packages=" $packages make bison flex bc libssl-dev gnutls-dev"
28+ packages=" ${ packages} make bison flex bc libssl-dev gnutls-dev"
2929# needed to pack resulting u-boot binary into an Android boot image
30- packages=" $packages gzip mkbootimg"
30+ packages=" ${ packages} gzip mkbootimg"
3131
3232log_i " Checking build-dependencies ($packages )"
3333missing=" "
34- for pkg in $packages ; do
35- if ! dpkg -l " ${pkg} " 2>&1 | grep -q " ^ii ${pkg} " ; then
36- missing=" ${missing} ${pkg} "
34+ for pkg in ${packages} ; do
35+ # check if package with this name is installed
36+ if dpkg -l " ${pkg} " 2>&1 | grep -q " ^ii ${pkg} " ; then
37+ continue
3738 fi
39+ # otherwise, check if it's a virtual package and if some package providing
40+ # it is installed
41+ providers=" $( apt-cache showpkg " ${pkg} " |
42+ sed -e ' 1,/^Reverse Provides: *$/ d' -e ' s/ .*$//' |
43+ sort -u) "
44+ provider_found=" no"
45+ for provider in ${providers} ; do
46+ if dpkg -l " ${provider} " 2>&1 | grep -q " ^ii ${provider} " ; then
47+ provider_found=" yes"
48+ break
49+ fi
50+ done
51+ if [ " ${provider_found} " = yes ]; then
52+ continue
53+ fi
54+ missing=" ${missing} ${pkg} "
3855done
3956if [ -n " ${missing} " ]; then
4057 fatal " Missing build-dependencies: ${missing} "
0 commit comments