From 5e9d03d507aad324a803eb8795e0eed6fb671761 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 10 Jul 2023 15:24:52 +0800
Subject: [PATCH] Merge branch 'master' of http://master.iot-yun.club:8088/r/raspberrypi

---
 3rdparty/x86/build.sh |   48 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/3rdparty/x86/build.sh b/3rdparty/x86/build.sh
index a99a1fe..b65b4b5 100755
--- a/3rdparty/x86/build.sh
+++ b/3rdparty/x86/build.sh
@@ -1,15 +1,43 @@
 #!/bin/bash
 
-ARCH=`uname -m`
+CROSSTOOL=arm-linux-gnueabihf-
 
-echo ${ARCH} | grep "x86" > /dev/null 
-if [ $? != 0 ] ; then
-   echo "+---------------------------------------------------+"
-   echo "|   ERROR: This folder must compile on X86 server   |"; 
-   echo "+---------------------------------------------------+"
-   exit 1;
-fi
+# display in red
+function pr_error() {
+    echo ""
+    echo -e "\033[40;31m --E-- $1 \033[0m"
+    echo ""
+}
 
+# display in yellow
+function pr_warn() {
+    echo ""
+    echo -e "\033[40;33m --W-- $1 \033[0m"
+    echo ""
+}
+
+# display in green
+function pr_info() {
+    echo -e "\033[40;32m --I-- $1 \033[0m"
+}
+
+function check_depend()
+{
+    ARCH=`uname -m`
+    echo ${ARCH} | grep "x86" > /dev/null
+    if [ $? != 0 ] ; then
+       pr_error  "This folder must compile on X86 server ";
+       exit 1;
+    fi
+
+
+    ${CROSSTOOL}g++ -v > /dev/null 2>&1
+    if [ $? != 0 ] ; then
+        pr_error "Crosstool not installed, please install it by follow command:"
+        pr_info  "sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf"
+        exit 1;
+    fi
+}
 
 function do_compile
 {
@@ -37,11 +65,13 @@
     rm -rf install
 }
 
-if [[ $# == 1 ]] && [[ $1 == "clean" ]] ; then 
+if [[ $# == 1 ]] && [[ $1 == "clean" ]] ; then
     do_clean
     exit;
 fi
 
+check_depend
+
 do_compile
 
 

--
Gitblit v1.9.1