From d634817310a7186e9a84a65bb135d850d0adee17 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Tue, 17 Aug 2021 14:32:40 +0800 Subject: [PATCH] update 3rdparty local build shell script --- 3rdparty/local/mosquitto/build.sh | 60 ++++++++++++++---------------------------------------------- 1 files changed, 14 insertions(+), 46 deletions(-) diff --git a/3rdparty/local/mosquitto/build.sh b/3rdparty/local/mosquitto/build.sh index 928d556..efc334b 100755 --- a/3rdparty/local/mosquitto/build.sh +++ b/3rdparty/local/mosquitto/build.sh @@ -1,18 +1,14 @@ #!/bin/bash #+-------------------------------------------------------------------------------------------- -#|Description: This shell script used download and compile MQTT C library mosquitto for ARM +#|Description: This shell script used download and compile mosquitto for RaspberryPi #| Author: GuoWenxue <guowenxue@gmail.com> #| ChangeLog: #| 1, Initialize 1.0.0 on 2011.04.12 #+-------------------------------------------------------------------------------------------- -PREFIX_PATH=`pwd`/install -OPENSSL_PATH=`pwd`/../openssl/install/ - -if [ -z $CROSSTOOL ] ; then - CROSSTOOL=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -fi +PREFIX_PATH=/usr/ +LYFTP_SRC=ftp://master.iot-yun.club/src/ function msg_banner() { @@ -35,67 +31,39 @@ fi } -function export_cross() -{ - # export cross toolchain - export CC=${CROSSTOOL}gcc - export CXX=${CROSSTOOL}g++ - export AS=${CROSSTOOL}as - export AR=${CROSSTOOL}ar - export LD=${CROSSTOOL}ld - export NM=${CROSSTOOL}nm - export RANLIB=${CROSSTOOL}ranlib - export OBJDUMP=${CROSSTOOL}objdump - export STRIP=${CROSSTOOL}strip - - # export cross configure - export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux " - - # Clear LDFLAGS and CFLAGS - export LDFLAGS= - export CFLAGS= -} - function compile_mosquitto() { - SRC_NAME=mosquitto-1.4.15 + SRC_NAME=mosquitto-2.0.10 PACK_SUFIX=tar.gz - if [ -d ${PREFIX_PATH}/lib ] ; then + if [ -f ${PREFIX_PATH}/lib/libmosquitto.so ] ; then + msg_banner "$SRC_NAME already compile and installed" return 0; fi - msg_banner "Start cross compile $SRC_NAME " + msg_banner "Start compile $SRC_NAME " if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then - wget https://mosquitto.org/files/source//${SRC_NAME}.${PACK_SUFIX} + #wget https://mosquitto.org/files/source//${SRC_NAME}.${PACK_SUFIX} + wget ${LYFTP_SRC}/${SRC_NAME}.${PACK_SUFIX} + check_result "ERROR: download ${SRC_NAME} failure" fi tar -xzf ${SRC_NAME}.${PACK_SUFIX} + check_result "ERROR: decompress ${SRC_NAME} failure" + cd ${SRC_NAME} - export CFLAGS=-I${OPENSSL_PATH}/include - export LDFLAGS=-L${OPENSSL_PATH}/lib + sudo apt install -y libssl1.0-dev export DESTDIR=${PREFIX_PATH} make WITH_SRV=no WITH_UUID=no check_result "ERROR: compile ${SRC_NAME} failure" - mkdir -p ${PREFIX_PATH}/{lib,bin} - cp lib/libmosquitto.so.1 ${PREFIX_PATH}/lib - cp src/mosquitto src/mosquitto_passwd client/mosquitto_pub client/mosquitto_sub ${PREFIX_PATH}/bin - cd - + sudo make prefix=${PREFIX_PATH} install } - -export_cross - -if [ ! -d ${OPENSSL_PATH}/include ] ; then - cd ../openssl - ./build.sh - cd - -fi compile_mosquitto -- Gitblit v1.9.1