From cbae784c040317daf1b9f9f8d7e6fdb63736283f Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Tue, 17 Aug 2021 01:53:05 +0800
Subject: [PATCH] Add libgpiod build shell script

---
 3rdparty/libgpiod/build.sh |   65 ++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/3rdparty/libgpiod/build.sh b/3rdparty/libgpiod/build.sh
new file mode 100755
index 0000000..f7a7613
--- /dev/null
+++ b/3rdparty/libgpiod/build.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+#+--------------------------------------------------------------------------------------------
+#|Description:  This shell script used download and compile MQTT C library mosquitto for ARM
+#|     Author:  GuoWenxue <guowenxue@gmail.com>
+#|  ChangeLog:
+#|           1, Initialize 1.0.0 on 2011.04.12
+#+--------------------------------------------------------------------------------------------
+
+
+LYFTP_SRC=ftp://master.iot-yun.club/src/
+
+function msg_banner()
+{
+    echo ""
+    echo "+-----------------------------------------------------------------------"
+    echo "|  $1 "
+    echo "+-----------------------------------------------------------------------"
+    echo ""
+}
+
+function check_result()
+{
+    if [ $? != 0 ] ; then
+       echo ""
+       echo "+-----------------------------------------------------------------------"
+       echo "|  $1 "
+       echo "+-----------------------------------------------------------------------"
+       echo ""
+       exit ;
+    fi
+}
+
+function compile_libgpiod()
+{
+    SRC_NAME=libgpiod-1.6.3
+    PACK_SUFIX=tar.gz
+
+    if [ -f ${PREFIX_PATH}/lib/libgpiod.so ] ; then
+        msg_banner "$SRC_NAME already compile and installed"
+        return 0;
+    fi
+
+    msg_banner "Start compile $SRC_NAME "
+
+    if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then
+        #official site: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
+        wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX}
+
+        check_result "ERROR: download ${SRC_NAME} failure"
+    fi
+
+    tar -xzf ${SRC_NAME}.${PACK_SUFIX}
+    cd ${SRC_NAME}
+
+    ./autogen.sh && ./configure --enable-tools
+
+    make && make install
+    
+    cd -
+}
+
+compile_libgpiod
+
+

--
Gitblit v1.9.1