summaryrefslogtreecommitdiff
path: root/util/crossgcc
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2016-03-20 20:39:04 -0600
committerMartin Roth <martinroth@google.com>2016-03-25 18:15:04 +0100
commit591790fca5f3e2ce0b1e4fa6099f59aaf9546c95 (patch)
treec2933b98a0de2bf27f811802c10b253296f6b647 /util/crossgcc
parent95f7b22dc4e0db2e27fab615c6e9c42bf7898ce4 (diff)
downloadcoreboot-591790fca5f3e2ce0b1e4fa6099f59aaf9546c95.tar.xz
buildgcc: Add check for missing libraries and test for zlib
- Add check_for_library routine to test for missing libraries. - Add a check for zlib. - Remove 'utility' text from please_install() routine since we can test for libraries or utilities now. - Remove incorrect 'solution' text from alternate install since I was updating that line. Change-Id: Id5ef28f8bde114cbf4e5a91fc119d42593ea6ab2 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/14147 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/crossgcc')
-rwxr-xr-xutil/crossgcc/buildgcc19
1 files changed, 17 insertions, 2 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 423d769047..525b574b3b 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -126,9 +126,9 @@ please_install()
*) solution="using your OS packaging system" ;;
esac
- printf "${RED}ERROR:${red} Missing tool: Please install \'$1\' utility. (eg $solution)${NC}\n" >&2
+ printf "${RED}ERROR:${red} Missing tool: Please install \'$1\'. (eg $solution)${NC}\n" >&2
if [ -n "$2" ]; then
- printf "${RED}ERROR:${red} or install \'$2\' utility. (eg $solution)${NC}\n" >&2
+ printf "${RED}ERROR:${red} or install \'$2\'.${NC}\n" >&2
fi
}
@@ -188,6 +188,19 @@ searchtool()
false
}
+# Run a compile check of the specified library option to see if it's installed
+check_for_library() {
+ local LIBRARY_FLAGS=$1
+ local LIBRARY_PACKAGES=$2
+ local LIBTEST_FILE=.libtest
+
+ echo "int main(int argc, char **argv) { (void) argc; (void) argv; return 0; }" > "${LIBTEST_FILE}.c"
+
+ cc $CFLAGS $LIBRARY_FLAGS "${LIBTEST_FILE}.c" -o "${LIBTEST_FILE}" >/dev/null 2>&1 || \
+ please_install "$LIBRARY_PACKAGES"
+ rm -rf "${LIBTEST_FILE}.c" "${LIBTEST_FILE}"
+}
+
check_sum() {
test -z "$CHECKSUM" || \
test "$(cat sum/$1.cksum 2>/dev/null | sed -e 's@.*\([0-9a-f]\{40,\}\).*@\1@')" = \
@@ -690,6 +703,8 @@ searchtool clang "LLVM" "" "g++" > /dev/null
searchtool wget > /dev/null
searchtool bzip2 "bzip2," > /dev/null
+check_for_library "-lz" "zlib (zlib1g-dev or zlib-devel)"
+
if [ "$HALT_FOR_TOOLS" -ne 0 ]; then
exit 1
fi