From 2c01607fdda70734dd04e0db3cd3ecb8d741b4c7 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 05 Aug 2019 21:25:51 +0800 Subject: [PATCH] Add libconfig libevent stunnel zlib build shell script --- 3rdparty/stunnel/build.sh | 112 ++++++++++++++++++ 3rdparty/zlib/build.sh | 1 3rdparty/libevent/build.sh | 95 +++++++++++++++ 3rdparty/libconfig/build.sh | 95 +++++++++++++++ 4 files changed, 302 insertions(+), 1 deletions(-) diff --git a/3rdparty/libconfig/build.sh b/3rdparty/libconfig/build.sh new file mode 100755 index 0000000..e6e3110 --- /dev/null +++ b/3rdparty/libconfig/build.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +#+-------------------------------------------------------------------------------------------- +#|Description: This shell script used download and compile libconfig for ARM +#| Author: GuoWenxue <guowenxue@gmail.com> +#| ChangeLog: +#| 1, Initialize 1.0.0 on 2011.04.12 +#+-------------------------------------------------------------------------------------------- + +PREFIX_PATH=`pwd`/../install/ + +LYFTP_SRC=ftp://master.iot-yun.club/src/ + +if [ -z $CROSSTOOL ] ; then + CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- +fi + +function msg_banner() +{ + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" +} + +function check_result() +{ + if [ $? != 0 ] ; then + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" + exit ; + 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_libconfig() +{ + SRC_NAME=libconfig-1.7.2 + PACK_SUFIX=tar.gz + + if [ -f ${PREFIX_PATH}/lib/libconfig.so ] ; then + return 0; + fi + + msg_banner "Start cross compile $SRC_NAME " + + if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then + #wget http://hyperrealm.github.io/libconfig/dist/${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} + cd ${SRC_NAME} + + export "CFLAGS+=-undefHAVE_USELOCALE" + ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} + check_result "ERROR: configure ${SRC_NAME} failure" + + make && make install + check_result "ERROR: compile ${SRC_NAME} failure" + + cd - +} + + +export_cross + +compile_libconfig + + diff --git a/3rdparty/libevent/build.sh b/3rdparty/libevent/build.sh new file mode 100755 index 0000000..19451ba --- /dev/null +++ b/3rdparty/libevent/build.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +#+-------------------------------------------------------------------------------------------- +#|Description: This shell script used download and compile libevent for ARM +#| Author: GuoWenxue <guowenxue@gmail.com> +#| ChangeLog: +#| 1, Initialize 1.0.0 on 2011.04.12 +#+-------------------------------------------------------------------------------------------- + +PREFIX_PATH=`pwd`/../install + +LYFTP_SRC=ftp://master.iot-yun.club/src/ + +if [ -z $CROSSTOOL ] ; then + CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- +fi + +function msg_banner() +{ + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" +} + +function check_result() +{ + if [ $? != 0 ] ; then + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" + exit ; + 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_libevent() +{ + SRC_NAME=libevent-2.1.11-stable + PACK_SUFIX=tar.gz + + if [ -f ${PREFIX_PATH}/lib/libevent.so ] ; then + return 0; + fi + + msg_banner "Start cross compile $SRC_NAME " + + if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then + #wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/${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} + cd ${SRC_NAME} + + ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-thread-support --enable-openssl --enable-function-sections + check_result "ERROR: configure ${SRC_NAME} failure" + + make && make install + check_result "ERROR: compile ${SRC_NAME} failure" + + cd - +} + + +export_cross + +compile_libevent + + diff --git a/3rdparty/stunnel/build.sh b/3rdparty/stunnel/build.sh new file mode 100755 index 0000000..f2088fd --- /dev/null +++ b/3rdparty/stunnel/build.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +#+-------------------------------------------------------------------------------------------- +#|Description: This shell script used download and compile stunnel for ARM +#| Author: GuoWenxue <guowenxue@gmail.com> +#| ChangeLog: +#| 1, Initialize 1.0.0 on 2018.08.16 +#+-------------------------------------------------------------------------------------------- + +PREFIX_PATH=`pwd`/../install/ + +LYFTP_SRC=ftp://master.iot-yun.club/src/ + +if [ -z $CROSSTOOL ] ; then + CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- +fi + +function msg_banner() +{ + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" +} + +function check_result() +{ + if [ $? != 0 ] ; then + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" + exit ; + 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_stunnel() +{ + SRC_NAME=stunnel-5.55 + PACK_SUFIX=tar.gz + + if [ -f ${PREFIX_PATH}/bin/stunnel ] ; then + return 0; + fi + + msg_banner "Start cross compile $SRC_NAME " + + if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then + wget http://www.usenix.org.uk/mirrors/stunnel/${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} + cd ${SRC_NAME} + + # fix can't load library 'libssp.so.0' bug + sed -i -e "s/fstack-protector/pthread/g" configure + + ./configure --prefix=${PREFIX_PATH} ${CONFIG_CROSS} --enable-static --disable-shared --disable-largefile --disable-ipv6 \ + --disable-systemd --disable-libwrap --with-ssl=${PREFIX_PATH} CFLAGS="-DHAVE_GETNAMEINFO -UHAVE_DAEMON " + check_result "ERROR: configure ${SRC_NAME} failure" + + sed -i -e "s|^LDFLAGS =.*|LDFLAGS =-static|g" src/Makefile + sed -i -e "s|^#define HAVE_DAEMON.*|#undef HAVE_DAEMON|g" src/config.h + make + check_result "ERROR: compile ${SRC_NAME} failure" + + ${STRIP} src/stunnel + cp src/stunnel ${PREFIX_PATH}/bin + + cd - +} + + +if [ ! -f ${PREFIX_PATH}/lib/libcrypto.so ] ; then + cd ../openssl + ./build.sh + cd - +fi + + +export_cross + +compile_stunnel + + diff --git a/3rdparty/zlib/build.sh b/3rdparty/zlib/build.sh index d5e0a9a..bbe204e 100755 --- a/3rdparty/zlib/build.sh +++ b/3rdparty/zlib/build.sh @@ -7,7 +7,6 @@ #| 1, Initialize 1.0.0 on 2011.04.12 #+-------------------------------------------------------------------------------------------- -PRJ_PATH=`pwd` PREFIX_PATH=`pwd`/../install/ LYFTP_SRC=ftp://master.iot-yun.club/src/ -- Gitblit v1.9.1