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/paho.mqtt/build.sh | 71 ++++++----------------------------- 1 files changed, 13 insertions(+), 58 deletions(-) diff --git a/3rdparty/local/paho.mqtt/build.sh b/3rdparty/local/paho.mqtt/build.sh index 7fb3625..b3a4c56 100755 --- a/3rdparty/local/paho.mqtt/build.sh +++ b/3rdparty/local/paho.mqtt/build.sh @@ -1,18 +1,14 @@ #!/bin/bash #+-------------------------------------------------------------------------------------------- -#|Description: This shell script used download and compile paho.mqtt for ARM +#|Description: This shell script used download and compile paho.mqtt 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,76 +31,35 @@ fi } -function export_cross() -{ - # export cross toolchain - export CC=${CROSSTOOL}gcc - 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_paho() { - SRC_NAME=paho.mqtt.c-1.2.1 + SRC_NAME=paho.mqtt.c-1.3.9 PACK_SUFIX=tar.gz - if [ -f ${PREFIX_PATH}/ethtool ] ; then + if [ -f ${PREFIX_PATH}/lib/libpaho-mqtt3a.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://github.com/eclipse/paho.mqtt.c/archive/v1.2.1.tar.gz -O ${SRC_NAME}.${PACK_SUFIX} + #wget https://github.com/eclipse/paho.mqtt.c/archive/v1.3.9.tar.gz -O ${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} + 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 - - mkdir -p ${PREFIX_PATH}/usr/local/{bin,include,lib} - make && make install DESTDIR=${PREFIX_PATH} + make && sudo make prefix=${PREFIX_PATH} install - cp -af build/output/samples/ ${PREFIX_PATH}/ - - cd ${PREFIX_PATH}/usr/local/lib - ln -s libpaho-mqtt3a.so.1.0 libpaho-mqtt3a.so.1 - ln -s libpaho-mqtt3as.so.1.0 libpaho-mqtt3as.so.1 - ln -s libpaho-mqtt3c.so.1.0 libpaho-mqtt3c.so.1 - ln -s libpaho-mqtt3cs.so.1.0 libpaho-mqtt3cs.so.1 - tar -cf libpaho-mqtt.tar * - mv libpaho-mqtt.tar ${PREFIX_PATH} - cd - - - check_result "ERROR: compile ${SRC_NAME} failure" cd - } - - -export_cross - -if [ ! -d ${OPENSSL_PATH}/include ] ; then - cd ../openssl - ./build.sh - cd - -fi compile_paho -- Gitblit v1.9.1