#!/bin/sh
|
|
#+--------------------------------------------------------------------------------------------
|
#|Description: This shell script used to download dhcp 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=dhcp
|
DIR_NAME="dhcp-4.0.3"
|
PACK_SUFIX="tar.gz"
|
DL_ADDR="ftp://ftp.isc.org/isc/dhcp/$DIR_NAME.$PACK_SUFIX"
|
#DL_ADDR="ftp://ftp.isc.org/isc/dhcp/4.2.3/$DIR_NAME.$PACK_SUFIX"
|
|
PRJ_PATH=`pwd`
|
INST_PATH=${PRJ_PATH}/../mnt/usr/sbin/
|
|
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}
|
|
# 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='--disable-shared --enable-static'
|
else
|
CONFIG_LD_STATUS='--enable-shared --disable-static'
|
fi
|
|
echo "+------------------------------------------------------------------+"
|
echo "| Platform: $DIR_NAME for $ARCH "
|
echo "| Compiler: ${CROSS}gcc "
|
echo "+------------------------------------------------------------------+"
|
mkdir -p $PREFIX_PATH
|
|
|
cd $DIR_NAME
|
set -x
|
echo "ac_cv_file__dev_random=yes" > linux.cache
|
./configure --prefix=$PREFIX_PATH CC=${CROSS}gcc ${CONFIG_CROSS} \
|
--cache-file=linux.cache -with-srv-lease-file=/tmp/dhcpd.leases \
|
--with-srv-pid-file=/var/run/dhcpd.pid --with-relay-pid-file=/var/run/dhcrelay.pid
|
make
|
rm -f linux.cache
|
|
make install
|
|
${STRIP} $PREFIX_PATH/sbin/*
|
file $PREFIX_PATH/sbin/*
|
|
if [ -n "$INST_PATH" -a -d "$INST_PATH" ] ; then
|
cp $PREFIX_PATH/sbin/dhcpd $INST_PATH
|
fi
|
set +x
|
|
echo "+------------------------------------------------------------------+"
|
echo "| Install Prefix: $PREFIX_PATH"
|
echo "| Install Path: $INST_PATH"
|
echo "+------------------------------------------------------------------+"
|
|
cd -
|