Commit 8e1aa33c authored by 吴洲洋's avatar 吴洲洋

add build vpp script

parent 4ab49901
#!/bin/bash
################################################################################
################################################################################
# file build_upf
# brief
# author bupt
# company bupt
# email:
#
set -o pipefail
INSTALL_DIR=/usr/local/bin
################################
# include helper functions
################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
PWD=$(pwd)
BUILD_ROOT="build-root"
BUILD_DEBUG=0
BUILD_RELEASE=0
BUILD_DEBUG_PKG=0
BUILD_RELEASE_PKG=0
clear_all()
{
make wipe;
make wipe-relase;
rm -rf $PWD/${BUILD_ROOT}/build-test;
rm -rf $PWD/${BUILD_ROOT}/build-vpp_debug-native;
rm -rf $PWD/${BUILD_ROOT}/build-vpp-native;
rm -rf $PWD/${BUILD_ROOT}/install-vpp-native;
rm -rf $PWD/${BUILD_ROOT}/install-vpp_debug-native;
}
build_debug()
{
echo "make debug"
clear_all
make rebuild
}
build_release()
{
echo "make release"
clear_all
make rebuild-release
}
make_package()
{
#clear
rm -rf $PWD/${BUILD_ROOT}/.ccache;
find $PWD/${BUILD_ROOT}/ -name '*.c' -type f -print -exec rm -rf {} \;
find $PWD/${BUILD_ROOT}/ -name '*.o' -type f -print -exec rm -rf {} \;
find $PWD/${BUILD_ROOT}/ -name '*.o.cmd' -type f -print -exec rm -rf {} \;
find $PWD/${BUILD_ROOT}/ -name '*.debug' -type f -print -exec rm -rf {} \;
find $PWD/${BUILD_ROOT}/ -name '*.api.json' -type f -print -exec rm -rf {} \;
rm -rf $PWD/${BUILD_ROOT}/build-test;
#rm -rf $PWD/${BUILD_ROOT}/build-vpp_debug-native;
#rm -rf $PWD/${BUILD_ROOT}/build-vpp-native;
#pkg
tmp_time=$(date "+%Y-%m-%d-%H-%M-%S")
vpp_time_tar_gz="buptvppe-$1-${tmp_time}.tar.gz"
sudo tar -zcvf $vpp_time_tar_gz ${BUILD_ROOT}
sudo mv $vpp_time_tar_gz ../
}
build_debug_pkg()
{
echo "make debug pkg"
clear_all
make pkg-deb-debug
make_package debug
}
build_release_pkg()
{
echo "make release pkg"
clear_all
make pkg-deb
make_package release
}
build()
{
if [ $BUILD_DEBUG == 1 ]; then build_debug exit 1; fi
if [ $BUILD_RELEASE == 1 ]; then build_release exit 1; fi
if [ $BUILD_DEBUG_PKG == 1 ]; then build_debug_pkg exit 1; fi
if [ $BUILD_RELEASE_PKG == 1 ]; then build_release_pkg exit 1; fi
return 0
}
function help()
{
echo " "
echo "Usage: build_vpp [OPTION]..."
echo "-d | --debug Build vpp debug version."
echo "-r | --release Build vpp release version."
echo "-dp | --debug pkg Build vpp debug pakcage version."
echo "-rp | --release pkg BUILD vpp relase package version."
echo " "
}
function main()
{
if [ $# -eq 0 ];
then
help
exit
fi
until [ -z "$1" ]
do
case "$1" in
-d | --debug)
BUILD_DEBUG=1
shift;
;;
-r | --release)
BUILD_RELEASE=1
shift;
;;
-dp | --debug-pkg)
BUILD_DEBUG_PKG=1
shift;
;;
-rp | --release-pkg)
BUILD_RELEASE_PKG=1
shift;
;;
*)
echo "Unknown option $1"
help
return 1
;;
esac
done
##############################################################################
# build
##############################################################################
build
return 0
}
main "$@"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment