Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF-Simple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-SMF-Simple
Commits
7dc9f39e
Commit
7dc9f39e
authored
Mar 21, 2019
by
gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
install deps scripts
parent
d706d828
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1438 additions
and
0 deletions
+1438
-0
build/scripts/build_helper
build/scripts/build_helper
+302
-0
build/scripts/build_helper.fb_folly
build/scripts/build_helper.fb_folly
+108
-0
build/scripts/build_helper.libconfig
build/scripts/build_helper.libconfig
+95
-0
build/scripts/build_helper.spgw
build/scripts/build_helper.spgw
+525
-0
build/scripts/build_spgwc
build/scripts/build_spgwc
+207
-0
build/scripts/build_spgwu
build/scripts/build_spgwu
+201
-0
No files found.
build/scripts/build_helper
0 → 100644
View file @
7dc9f39e
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper
# brief
# author Laurent Thomas, Lionel GAUTHIER
#
#######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04"
if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac
SUDO='sudo -S -E'
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
#-------------------------------------------------------------------------------
cecho() {
# Color-echo
# arg1 = message
# arg2 = color
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
#-------------------------------------------------------------------------------
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
# arg1 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# arg2 is a dotted (or not) version number (ex 4.10.6.56-ubunutu)
# return 0 if $1 lower or equal $2, else 1
version_le() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_lt() {
[ "$1" = "$2" ] && return 1 || version_le $1 $2
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_ge() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | tail -n1`" ]
}
# From https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
version_gt() {
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
}
########################
# distribution helpers #
########################
#-------------------------------------------------------------------------------
# This function return a string to identify the distribution we are running
# If we can't check the distribution, it returns "Unknown"
# This function return always true as exit code by design
# Examples:
# ubuntu18.04
# debian8.5
get_distribution_release() {
if [[ ! -z "$OS_DISTRO$OS_RELEASE" ]]; then
echo -n "$OS_DISTRO$OS_RELEASE"
else
echo -n Unknown
fi
}
check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
#"rhel7") return 0 ;;
#"centos7") return 0 ;;
esac
return 1
}
###########################
# Cleaners
###########################
#-------------------------------------------------------------------------------
clean_kernel() {
$SUDO modprobe ip_tables
$SUDO modprobe x_tables
$SUDO iptables -P INPUT ACCEPT
$SUDO iptables -F INPUT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO iptables -F OUTPUT
$SUDO iptables -P FORWARD ACCEPT
$SUDO iptables -F FORWARD
$SUDO iptables -t nat -F
$SUDO iptables -t mangle -F
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
}
#-------------------------------------------------------------------------------
disable_ipv6() {
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
}
#-------------------------------------------------------------------------------
# Compare two versions of software. Returns true if $version is greater than $req_version
# arg1 = version
# arg2 = req_version
#
function version_gt() {
test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
}
###################################
# Compilers
###################################
# From https://stackoverflow.com/a/20473191
# test if a list include item
# arg1 is list, ex "item1 item2 ..."
# arg2 is item
function list_include_item {
local list="$1"
local item="$2"
if [[ $list =~ (^|[[:space:]])"$item"($|[[:space:]]) ]] ; then
# yes, list include item
result=0
else
result=1
fi
return $result
}
# arg 1 Build directory OPENAIR_DIR/build/?/build
# arg 2 Executable target name
# arg 3 Executable name (no path)
# arg 4 Verbose (1 or 0)
compilations() {
echo_info "Compilation log for $3 is here: $dlog/$2.txt"
cd $OPENAIRCN_DIR/build/$1/build
if [ "a$4" == "a1" ]; then
set -o pipefail
{
rm -f $3
make $make_args $2
} | tee $dlog/$2.txt
else
{
rm -f $3
make $make_args $2
} > $dlog/$2.txt 2>&1
fi
if [ $? == 0 -a -s $3 ] ; then
echo_success "$2 compiled"
return 0
else
echo_error "$2 compilation failed"
return 1
fi
}
###################################
# make test
###################################
# arg 1 Build directory OPENAIRCN_DIR/build/?/build
# arg 2 Executable target name
# arg 3 Executable name (no path)
# arg 4 Verbose (1 or 0)
make_test() {
echo_success "unit tests start"
cd $OPENAIRCN_DIR/build/$1/build
if [ "a$4" == "a1" ]; then
{
make test ARGS="-V"
} | tee $dlog/$2_test.txt
else
{
make test
} > $dlog/$2_test.txt 2>&1
fi
echo_success "unit tests end"
}
#-------------------------------------------------------------------------------
# arg1 is package name
test_install_package() {
# usage: test_install_package package_name
if [ $# -eq 1 ]; then
dpkg -s "$1" > /dev/null 2>&1 && {
echo "$1 is installed."
} || {
echo "$1 is not installed."
$SUDO apt-get install --force-yes $1
}
fi
}
#-------------------------------------------------------------------------------
update_package_db() {
if [ ! -f /tmp/no_more_update_package_db ]; then
$SUDO $INSTALLER update
[[ $? -ne 0 ]] && return $?
touch /tmp/no_more_update_package_db
[[ $? -ne 0 ]] && return $?
else
let elapsed_time=$(expr `date +%s` - `stat -c %Y /tmp/no_more_update_package_db`)
if [ $elapsed_time -gt 3600 ]; then
$SUDO $INSTALLER update
[[ $? -ne 0 ]] && return $?
touch /tmp/no_more_update_package_db
[[ $? -ne 0 ]] && return $?
fi
fi
return 0
}
#-------------------------------------------------------------------------------
check_enable_epel_repos() {
# on Enterprise Linuxes, ensure EPEL repos are installed
# (provides: libidn2-devel, vconfig, iperf, phpMyAdmin, dkms, ...)
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
if rpm -q epel-release > /dev/null; then
echo "EPEL repos already present. Good."
else
echo "EPEL repos not present. Installing them."
$SUDO $INSTALLER install $OPTION https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
fi
fi
}
################################
# set_openair_env
###############################
#-------------------------------------------------------------------------------
set_openair_env(){
fullpath=`readlink -f $BASH_SOURCE`
[ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath`
openair_path=${fullpath%/build/*}
openair_path=${openair_path%/scripts/*}
openair_path=${openair_path%/src/nas/*}
openair_path=${openair_path%/src/s6a/*}
export OPENAIRCN_DIR=$openair_path
}
build/scripts/build_helper.fb_folly
0 → 100644
View file @
7dc9f39e
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper.fb_folly
# brief
# author Lionel GAUTHIER
#
#######################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
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 \
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
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \
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
$SUDO rm -rf /tmp/folly
git clone https://github.com/facebook/folly.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd 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
return 0
}
build/scripts/build_helper.libconfig
0 → 100644
View file @
7dc9f39e
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper.libconfig
# brief
# author Lionel GAUTHIER
#
#######################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#-------------------------------------------------------------------------------
# Motivation: seems libconfig++ need to be compiled with same application C++ compiler,
# otherwise you encounter strange linker errors. (ubuntu 16.04)
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_libconfig_from_source(){
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install libconfig (github)? <y/N> " prompt
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
build-essential \
flex \
gcc \
libtool"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
patch \
flex \
gcc \
libtool \
textinfo"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
pushd /tmp
$SUDO rm -rf /tmp/libconfig
git clone https://github.com/hyperrealm/libconfig.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd libconfig
autoreconf -fi
./configure
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc` > /tmp/log_compile_config 2>&1
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
return 0
}
build/scripts/build_helper.spgw
0 → 100644
View file @
7dc9f39e
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper.spgw
# brief
# author Laurent Thomas, Lionel GAUTHIER
#
#######################################
################################
# include helper functions
################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.libconfig
source $THIS_SCRIPT_PATH/build_helper.fb_folly
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fmt() {
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
echo "Install fmt from source"
if [[ $prompt =~ [yY](es)* ]]
then
cd /tmp
echo "Downloading fmt"
$SUDO rm -rf /tmp/fmt*
git clone https://github.com/fmtlib/fmt.git
ret=$?;[[ $ret -ne 0 ]] && return $ret
cd fmt
cmake .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO make install
cd /tmp
rm -rf /tmp/fmt*
fi
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() {
if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
GIT_URL=https://github.com/gabime/spdlog.git
echo "Install spdlog from $GIT_URL"
pushd $OPENAIRCN_DIR/build/ext
echo "Downloading spdlog"
if [[ $OPTION =~ -[yY](es)* ]]
then
$SUDO rm -rf spdlog
fi
git clone $GIT_URL
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_spgwc_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")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt11-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libssl-dev \
libtool \
libxml2 \
libxml2-dev \
openssl \
python \
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 fmt lib included in spdlog
#install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_spgwc_min_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="\
gdb"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gdb"
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")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
libtool"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
libtool"
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
# Networking
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
specific_packages="iproute2"
;;
esac
PACKAGE_LIST="\
$specific_packages \
ethtool \
iptables \
vlan"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
ethtool \
iperf \
iproute \
iptables \
vconfig"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install networking tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_spgwu_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 \
doxygen \
flex \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
$CMAKE \
cppcheck \
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")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt11-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libssl-dev \
libtool \
libxml2 \
libxml2-dev \
openssl \
python \
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 fmt lib included in spdlog
#install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_spgwu_min_deps() {
if [ $1 -gt 0 ]; then
OPTION="-y"
else
OPTION=""
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="\
gdb "
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gdb "
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
# Networking
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
specific_packages="iproute2"
;;
esac
PACKAGE_LIST="\
$specific_packages \
ethtool \
iptables \
vlan"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
ethtool \
iproute \
vconfig"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install networking tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
return 0
}
build/scripts/build_spgwc
0 → 100755
View file @
7dc9f39e
#!/bin/bash
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_spgwc
# brief
# author Lionel Gauthier
# company Eurecom
# email: lionel.gauthier@eurecom.fr
#
set
-o
pipefail
INSTALL_DIR
=
/usr/local/bin
################################
# include helper functions
################################
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_SCRIPT_PATH
/build_helper.spgw
function
help
()
{
echo_error
" "
echo_error
"Usage: build_spgwc [OPTION]..."
echo_error
"Build the SPGW-C executable."
echo_error
" "
echo_error
"Options:"
echo_error
"Mandatory arguments to long options are mandatory for short options too."
echo_error
" -b, --build-type Build type as defined in cmake, allowed values are: Debug Release RelWithDebInfo MinSizeRel"
echo_error
" -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error
" -f, --force No interactive script for installation of software packages."
echo_error
" -h, --help Print this help."
echo_error
" -I, --install-deps Check installed software necessary to build and run S/P-GW-C (support
$SUPPORTED_DISTRO
)."
echo_error
" -i, --install-min-deps Check installed software necessary to run a statically linked S/P-GW-C (support
$SUPPORTED_DISTRO
)."
echo_error
" -v, --verbose Build process verbose."
echo_error
" -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
echo_error
" "
}
function
main
()
{
local
-i
clean
=
0
local
-i
force
=
0
local
-i
debug
=
0
local
-i
verbose
=
0
local
-i
var_check_install_min_deps
=
0
local
-i
var_check_install_deps
=
0
local
cmake_args
=
" "
export
make_args
=
"-j
`
nproc
`
"
until
[
-z
"
$1
"
]
do
case
"
$1
"
in
-a
|
--auto-test
)
cmake_args
=
"
$cmake_args
-DSGW_AUTOTEST=1"
shift
;
;;
-b
|
--build-type
)
list_include_item
"Debug Release RelWithDebInfo MinSizeRel"
$2
[[
$?
-ne
0
]]
&&
echo_error
"Build type
$2
not recognized"
&&
return
$?
cmake_args
=
"
$cmake_args
-DCMAKE_BUILD_TYPE=
$2
"
list_include_item
"Debug"
$2
[[
$?
-ne
0
]]
&&
debug
=
1
shift
2
;
;;
-c
|
--clean
)
clean
=
1
echo
"Clean the build generated files (build from scratch)"
shift
;
;;
-f
|
--force
)
force
=
1
echo
"Force set (no interactive)"
shift
;
;;
-h
|
--help
)
help
shift
;
return
0
;;
-I
|
--install-deps
)
echo
"Check installed software necessary to build and run S/P-GW-C (support
$SUPPORTED_DISTRO
):"
set_openair_env
var_check_install_deps
=
1
shift
;
;;
-i
|
--install-min-deps
)
echo
"Check installed software necessary to run S/P-GW-C (support
$SUPPORTED_DISTRO
):"
set_openair_env
var_check_install_min_deps
=
1
shift
;
;;
-v
|
--verbose
)
echo
"Make build process verbose"
cmake_args
=
"
$cmake_args
-DCMAKE_VERBOSE_MAKEFILE=ON"
make_args
=
"VERBOSE=1
$make_args
"
verbose
=
1
shift
;
;;
-V
|
--Verbose
)
echo
"CMake build process verbose"
verbose
=
1
shift
;
;;
*
)
echo
"Unknown option
$1
"
help
return
1
;;
esac
done
if
[
!
-d
/usr/local/etc/oai
]
;
then
$SUDO
mkdir
-m
777
-p
/usr/local/etc/oai
fi
set_openair_env
local
dlog
=
$OPENAIRCN_DIR
/build/log
local
dext
=
$OPENAIRCN_DIR
/build/ext
mkdir
-m
777
-p
$dlog
mkdir
-m
777
-p
$dext
if
[
$var_check_install_min_deps
-gt
0
]
;
then
disable_ipv6
check_install_spgwc_min_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error: SPGW-C minimal deps installation failed"
return
1
else
echo_success
"SPGW-C minimal deps installation successful"
echo_warning
"SPGW-C not compiled, to compile it, re-run build_spgwc without -i option"
return
0
fi
fi
if
[
$var_check_install_deps
-gt
0
]
;
then
disable_ipv6
check_install_spgwc_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error: SPGW-C deps installation failed"
return
1
else
echo_success
"SPGW-C deps installation successful"
echo_warning
"SPGW-C not compiled, to compile it, re-run build_spgwc without -I option"
return
0
fi
fi
cmake_args
=
"
$cmake_args
-DBUILD_SHARED_LIBS=OFF"
##############################################################################
# Clean
##############################################################################
cd
$OPENAIRCN_DIR
/build/spgw_c
if
[
$clean
-ne
0
]
;
then
if
[[
$verbose
-eq
1
]]
;
then
echo
"Cleaning S/P-GW-C: generated configuration files, obj files, executable"
fi
rm
-Rf
$OPENAIRCN_DIR
/build/spgw_c/build 2>&1
mkdir
-m
777
-p
-v
build
fi
##############################################################################
# Compile S/P-GW
##############################################################################
cd
$OPENAIRCN_DIR
/build/spgw_c
if
[
!
-d
./build
]
;
then
mkdir
-m
777
-p
-v
build
fi
cd
./build
$CMAKE
$cmake_args
..
>
/dev/null
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
compilations spgw_c spgwc
$OPENAIRCN_DIR
/build/spgw_c/build/spgwc
$verbose
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
# For daemon should not be group writable
$SUDO
chmod
755
$OPENAIRCN_DIR
/build/spgw_c/build/spgwc
$SUDO
cp
-upv
$OPENAIRCN_DIR
/build/spgw_c/build/spgwc
$INSTALL_DIR
&&
$SUDO
chmod
755
$INSTALL_DIR
/spgwc
&&
echo_success
"spgwc installed"
return
0
}
main
"
$@
"
build/scripts/build_spgwu
0 → 100755
View file @
7dc9f39e
#!/bin/bash
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the Apache License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_spgwu
# brief
# author Lionel Gauthier
# company Eurecom
# email: lionel.gauthier@eurecom.fr
#
set
-o
pipefail
INSTALL_DIR
=
/usr/local/bin
################################
# include helper functions
################################
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_SCRIPT_PATH
/build_helper.spgw
function
help
()
{
echo_error
" "
echo_error
"Usage: build_spgwu [OPTION]..."
echo_error
"Build the SPGW-U executable."
echo_error
" "
echo_error
"Options:"
echo_error
"Mandatory arguments to long options are mandatory for short options too."
echo_error
" -b, --build-type Build type as defined in cmake, allowed values are: Debug Release RelWithDebInfo MinSizeRel"
echo_error
" -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error
" -f, --force No interactive script for installation of software packages."
echo_error
" -h, --help Print this help."
echo_error
" -I, --install-deps Check installed software necessary to build and run S/P-GW-U (support
$SUPPORTED_DISTRO
)."
echo_error
" -i, --install-min-deps Check installed software necessary to run a statically linked S/P-GW-U (support
$SUPPORTED_DISTRO
)."
echo_error
" -v, --verbose Build process verbose."
echo_error
" -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
echo_error
" "
}
function
main
()
{
local
-i
clean
=
0
local
-i
force
=
0
local
-i
debug
=
0
local
-i
verbose
=
0
local
-i
var_check_install_min_deps
=
0
local
-i
var_check_install_deps
=
0
local
cmake_args
=
" "
export
make_args
=
"-j
`
nproc
`
"
until
[
-z
"
$1
"
]
do
case
"
$1
"
in
-b
|
--build-type
)
list_include_item
"Debug Release RelWithDebInfo MinSizeRel"
$2
[[
$?
-ne
0
]]
&&
echo_error
"Build type
$2
not recognized"
&&
return
$?
cmake_args
=
"
$cmake_args
-DCMAKE_BUILD_TYPE=
$2
"
list_include_item
"Debug"
$2
[[
$?
-ne
0
]]
&&
debug
=
1
shift
2
;
;;
-c
|
--clean
)
clean
=
1
echo
"Clean the build generated files (build from scratch)"
shift
;
;;
-f
|
--force
)
force
=
1
echo
"Force set (no interactive)"
shift
;
;;
-h
|
--help
)
help
shift
;
return
0
;;
-I
|
--install-deps
)
echo
"Check installed software necessary to build and run S/P-GW-U (support
$SUPPORTED_DISTRO
):"
set_openair_env
var_check_install_deps
=
1
shift
;
;;
-i
|
--install-min-deps
)
echo
"Check installed software necessary to run S/P-GW-U (support
$SUPPORTED_DISTRO
):"
set_openair_env
var_check_install_min_deps
=
1
shift
;
;;
-v
|
--verbose
)
echo
"Make build process verbose"
cmake_args
=
"
$cmake_args
-DCMAKE_VERBOSE_MAKEFILE=ON"
make_args
=
"VERBOSE=1
$make_args
"
verbose
=
1
shift
;
;;
-V
|
--Verbose
)
echo
"CMake build process verbose"
verbose
=
1
shift
;
;;
*
)
echo
"Unknown option
$1
"
help
return
1
;;
esac
done
if
[
!
-d
/usr/local/etc/oai
]
;
then
$SUDO
mkdir
-m
777
-p
/usr/local/etc/oai
fi
set_openair_env
local
dlog
=
$OPENAIRCN_DIR
/build/log
local
dext
=
$OPENAIRCN_DIR
/build/ext
mkdir
-m
777
-p
$dlog
mkdir
-m
777
-p
$dext
if
[
$var_check_install_min_deps
-gt
0
]
;
then
disable_ipv6
check_install_spgwu_min_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error: SPGW-U minimal deps installation failed"
return
1
else
echo_success
"SPGW-U minimal deps installation successful"
echo_warning
"SPGW-U not compiled, to compile it, re-run build_spgwu without -i option"
return
0
fi
fi
if
[
$var_check_install_deps
-gt
0
]
;
then
disable_ipv6
check_install_spgwu_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error: SPGW-U deps installation failed"
return
1
else
echo_success
"SPGW-U deps installation successful"
echo_warning
"SPGW-U not compiled, to compile it, re-run build_spgwu without -I option"
return
0
fi
fi
cmake_args
=
"
$cmake_args
-DBUILD_SHARED_LIBS=OFF"
##############################################################################
# Clean
##############################################################################
cd
$OPENAIRCN_DIR
/build/spgw_u
if
[
$clean
-ne
0
]
;
then
if
[[
$verbose
-eq
1
]]
;
then
echo
"Cleaning S/P-GW-U: generated configuration files, obj files, executable"
fi
rm
-Rf
$OPENAIRCN_DIR
/build/spgw_u/build 2>&1
mkdir
-m
777
-p
-v
build
fi
##############################################################################
# Compile S/P-GW
##############################################################################
cd
$OPENAIRCN_DIR
/build/spgw_u
if
[
!
-d
./build
]
;
then
mkdir
-m
777
-p
-v
build
fi
cd
./build
$CMAKE
$cmake_args
..
>
/dev/null
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
compilations spgw_u spgwu
$OPENAIRCN_DIR
/build/spgw_u/build/spgwu
$verbose
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
# For daemon should not be group writable
$SUDO
chmod
755
$OPENAIRCN_DIR
/build/spgw_u/build/spgwu
$SUDO
cp
-upv
$OPENAIRCN_DIR
/build/spgw_u/build/spgwu
$INSTALL_DIR
&&
$SUDO
chmod
755
$INSTALL_DIR
/spgwu
&&
echo_success
"spgwu installed"
return
0
}
main
"
$@
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment