Commit 4e789fa2 authored by chen2022's avatar chen2022

补充build_helper.local

parent 30bfcfa6
...@@ -28,7 +28,7 @@ INSTALL_DIR=/usr/local/bin ...@@ -28,7 +28,7 @@ INSTALL_DIR=/usr/local/bin
################################ ################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source ${THIS_SCRIPT_PATH}/build_helper.amf source ${THIS_SCRIPT_PATH}/build_helper.amf
#source ${THIS_SCRIPT_PATH}/build_helper.local
function help() function help()
{ {
echo_error " " echo_error " "
......
# file build_helper.local
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#--------openxg-cnlibs-----------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_cnlibs() {
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source cnlibs for C++ ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
echo "Install cnlibs from source"
##----------------------------------------------------------------
if [[ $prompt =~ [yY](es)* ]]
then
cd /tmp
echo "Downloading cnlibs"
$SUDO rm -rf /tmp/openxg-cnlibs*
git clone http://git.opensource5g.org/openxg/openxg-cnlibs.git
ret=$?;[[ $ret -ne 0 ]] && return $ret
##fmt
cd openxg-cnlibs/fmt
cmake -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO make install
##json
cd openxg-cnlibs/json
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
##pistache
cd openxg-cnlibs/pistache
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
##spdlog
cd openxg-cnlibs/spdlog
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
# enable syslog, Useless (defined in SMF code)
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd
##folly
cd openxg-cnlibs/folly
mkdir _build && cd _build
cmake ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
##https://github.com/google/googletest/archive/release-1.8.0.tar.gz --------------
if [[ $prompt =~ [yY](es)* ]]
then
$SUDO apt-get install $OPTION \
g++ \
cmake \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
libiberty-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
wget \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
pkg-config
ret=$?;[[ $ret -ne 0 ]] && return $ret
pushd /tmp
if [ $debug -eq 1 ]; then
# For advanced debugging options
$SUDO apt-get install $OPTION \
libunwind8-dev \
libelf-dev \
libdwarf-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
cmake . && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd ..
fi
fi
##
cd /tmp
rm -rf /tmp/openxg-cnlibs*
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_amf_deps(){
if [ $1 -gt 0 ]; then
OPTION="-y"
else
OPTION=""
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
echo "Check supported distribution"
check_supported_distribution
[[ $? -ne 0 ]] && return $?
# prevent lock on /var/lib/dpkg/lock
if [[ $OS_DISTRO == "ubuntu" ]]; then
#$SUDO systemctl mask apt-daily.service
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
update_package_db
check_enable_epel_repos
# Compilers, generators, ...
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
build-essential \
cmake \
daemon \
doxygen \
flex \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
$CMAKE \
doxygen \
flex \
gdb \
git"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Libraries
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
fi
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
mysql-server \
mysql-client \
libmysqlclient-dev \
libcpprest-dev \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt11-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libsctp-dev \
libssl-dev \
libtool \
libxml2 \
libxml2-dev \
openssl \
python \
nettle-dev \
libcurl4 \
net-tools \
pkg-config"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn2-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
libtool \
libxml2 \
libxml2-devel \
openssl \
check \
python \
pkgconfig"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use cnlibs
install_cnlibs $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig
return 0
}
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