#!/bin/sh
|
|
#+--------------------------------------------------------------------------------------------
|
#|Description: This shell script used to download curl source code and cross compile it.
|
#| Author: GuoWenxue <guowenxue@gmail.com>
|
#| ChangeLog:
|
#| 1, Initialize 1.0.0 on 2013.03.22
|
#+--------------------------------------------------------------------------------------------
|
. ../scripts/funcs.sh
|
clear_crossenv
|
. ../scripts/envs.sh
|
|
if [ -z $ARCH ]; then
|
ARCH=
|
fi
|
|
APP_NAME=curl
|
DIR_NAME=curl-7.19.7
|
PACK_SUFIX="tar.bz2"
|
DL_ADDR=http://curl.haxx.se/download/${DIR_NAME}.$PACK_SUFIX
|
INST_PATH=/tftp
|
|
LINK_STATIC=YES
|
|
select_arch
|
if [ -z $CROSS -a "x86" != "$ARCH" ] ; then
|
CROSS="/opt/buildroot-2012.08/${ARCH}/usr/bin/arm-linux-"
|
fi
|
set_crosstool $CROSS
|
|
if [ "x86" != "$ARCH" ] ; then
|
CONFIG_CROSS=--host=arm-linux
|
fi
|
|
PREFIX_PATH=/apps/${ARCH}/${APP_NAME}
|
OPENSSL_PATH=/apps/${ARCH}/openssl
|
|
if [ ! -d ${OPENSSL_PATH}/lib ] ; then
|
cd ../openssl
|
sh build.sh
|
cd -
|
fi
|
|
# Download and decompress source code packet
|
download $DL_ADDR
|
decompress_packet $DIR_NAME $PACK_SUFIX
|
|
if [ "$LINK_STATIC" == "YES" ] ; then
|
export CFLAGS=--static
|
export LDFLAGS=-static
|
CONFIG_LD_STATUS='--enable-static'
|
fi
|
|
echo "+------------------------------------------------------------------+"
|
echo "| Platform: $DIR_NAME for $ARCH "
|
echo "| Compiler: ${CROSS}gcc "
|
echo "+------------------------------------------------------------------+"
|
mkdir -p $PREFIX_PATH
|
|
cd $DIR_NAME
|
set -x
|
./configure ${CONFIG_CROSS} --prefix=${PREFIX_PATH} ${CONFIG_LD_STATUS} --with-random=/dev/urandom \
|
--disable-largefile --enable-debug --enable-curldebug --disable-optimize \
|
--enable-http --enable-ftp --disable-file --disable-file --disable-ldap --disable-ldaps --disable-proxy \
|
--disable-dict --disable-telnet --disable-tftp --disable-manual --disable-ipv6 -disable-thread --disable-ares \
|
--enable-verbose --disable-sspi -enable-crypto-auth --disable-cookies --disable-hidden-symbols --disable-soname-bump \
|
--without-krb4 --without-spnego --without-gssapi --with-ssl=${OPENSSL_PATH} --without-zlib --without-gnutls \
|
--without-nss --without-ca-bundle --without-libssh2 --without-libidn
|
|
make && make install
|
|
${STRIP} $PREFIX_PATH/bin/*
|
file $PREFIX_PATH/bin/*
|
|
if [ -n "$INST_PATH" -a -d "$INST_PATH" ] ; then
|
cp -f $PREFIX_PATH/bin/${APP_NAME} $INST_PATH
|
fi
|
set +x
|
|
echo "+------------------------------------------------------------------+"
|
echo "| Install Prefix: $PREFIX_PATH"
|
echo "| Install Path: $INST_PATH"
|
echo "+------------------------------------------------------------------+"
|
cd -
|