#!/bin/bash #/***************************************************************************** # * # Copyright 2019 AT&T Intellectual Property * # Copyright 2019 Nokia * # * # Licensed 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. * # * #******************************************************************************/ set -e E2SIM_VERSION='1.4.0' export E2SIM_DIR=$PWD source $E2SIM_DIR/tools/build_helper.bash DOCKER_IMAGE='e2sim' print_help() { echo " This program installs E2 Simulator You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14 The program is run by default with no option USAGE: ./build_e2sim [OPTIONS] OPTIONS: --clean Erase all files to make a rebuild from start --docker Build docker image -h Print this help " } function main(){ case "$1" in --clean) echo_info "Will clean all previously producted files under build/" rm -rf $E2SIM_DIR/build echo_success "Clean Done" exit ;; --docker) echo "Will build docker image ${DOCKER_IMAGE}:${E2SIM_VERSION}" sudo docker build -f docker/Dockerfile -t $DOCKER_IMAGE:$E2SIM_VERSION . exit ;; "") ;; -h) print_help exit 1;; *) echo_error "Unknown option $1" exit esac BUILD_DIR=$E2SIM_DIR/build mkdir -p $BUILD_DIR echo_info "Will build e2sim" cd $BUILD_DIR rm -rf CMakeCache.txt cmake .. make -j`nproc` echo_success "e2sim compiled" } main "$@"