build_oai 36.3 KB
Newer Older
thomasl's avatar
thomasl committed
1
#!/bin/bash
2 3 4 5 6
#/*
# * 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
7
# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# * 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
# */

23
# file build_oai
thomasl's avatar
thomasl committed
24 25 26
# brief OAI automated build tool that can be used to install, compile, run OAI.
# author  Navid Nikaein, Lionel GAUTHIER, Laurent Thomas

27
set -e
thomasl's avatar
thomasl committed
28

yilmazt's avatar
yilmazt committed
29
# Include helper functions
thomasl's avatar
thomasl committed
30
ORIGIN_PATH=$PWD
thomasl's avatar
thomasl committed
31
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
32
source $THIS_SCRIPT_PATH/tools/build_helper
thomasl's avatar
thomasl committed
33

yilmazt's avatar
yilmazt committed
34
# Set environment variables (OPENAIR_HOME, ...)
35 36
set_openair_env

yilmazt's avatar
yilmazt committed
37
# Variables for UE data generation
38 39 40
gen_nvram_path=$OPENAIR_DIR/targets/bin
conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf

41
MSC_GEN=0
42
XFORMS="True"
43
SKIP_SHARED_LIB_FLAG="False"
Xu Bo's avatar
Xu Bo committed
44
UE_EXPANSION="False"
45
PRINT_STATS="False"
thomasl's avatar
thomasl committed
46
VCD_TIMING="False"
laurent's avatar
laurent committed
47
DEADLINE_SCHEDULER_FLAG_USER=""
yilmazt's avatar
yilmazt committed
48
CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False
49
REL="Rel15"
50
HW="None"
51
TP="None"
Lionel Gauthier's avatar
Lionel Gauthier committed
52
EPC=0
53
VERBOSE_CI=0
54
VERBOSE_COMPILE=0
55
CFLAGS_PROCESSOR_USER=""
56 57
RUN_GROUP=0
TEST_CASE_GROUP=""
58
BUILD_DOXYGEN=0
59
BUILD_COVERITY_SCAN=0
60
T_TRACER="True"
Rohit Gupta's avatar
Rohit Gupta committed
61
DISABLE_HARDWARE_DEPENDENCY="False"
62
CMAKE_BUILD_TYPE=""
63
CMAKE_CMD="$CMAKE"
64
UE_AUTOTEST_TRACE="False"
gabrielC's avatar
gabrielC committed
65 66
UE_DEBUG_TRACE="False"
UE_TIMING_TRACE="False"
67
USRP_REC_PLAY="False"
68
BUILD_ECLIPSE=0
Guy De Souza's avatar
Guy De Souza committed
69
NR="False"
heshanyun's avatar
heshanyun committed
70
ITTI_SIM="False"
71
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
72 73
trap handle_ctrl_c INT

74
function print_help() {
Cedric Roux's avatar
Cedric Roux committed
75
  echo_info "
76
This program installs OpenAirInterface Software
laurent's avatar
laurent committed
77
You should have ubuntu 16.xx or 18.04 updated
78 79
Options
-c | --clean
Cedric Roux's avatar
Cedric Roux committed
80
   Erase all files to make a rebuild from start
81
-C | --clean-all
Cedric Roux's avatar
Cedric Roux committed
82
   Erase all files made by previous compilations, installations
83 84
--clean-kernel
   Erase previously installed features in kernel: iptables, drivers, ...
Lionel Gauthier's avatar
Lionel Gauthier committed
85
-I | --install-external-packages
86 87 88 89
   Installs required packages such as LibXML, asn1.1 compiler, freediameter, ...
   This option will require root password
--install-optional-packages
   Install useful but not mandatory packages such as valgrind
90 91 92
-i | --install-system-files
   Install OpenAirInterface required files in Linux system
   This option will require root password
93 94 95 96 97
-g | --run-with-gdb <Release | RelWithDebInfo | MinSizeRel | Debug
  specify the build mode used by cmake. defaults to Debug mode if -g is used alone, with no mode parameter
  if -g is not specifies, Release mode is used.
-G | --cmaketrace
   enable cmake debugging messages
98
--eNB
Guy De Souza's avatar
Guy De Souza committed
99
  Makes the LTE softmodem
hardy's avatar
hardy committed
100 101 102
--eNBocp
  Makes the OCP LTE softmodem
-gNB
Guy De Souza's avatar
Guy De Souza committed
103 104 105
  Makes the NR softmodem
--nrUE
  Makes the NR UE softmodem
106
--UE
107
   Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
Cedric Roux's avatar
Cedric Roux committed
108 109 110 111
--UE-conf-nvram [configuration file]
   Specify conf_nvram_path (default \"$conf_nvram_path\")
--UE-gen-nvram [output path]
   Specify gen_nvram_path (default \"$gen_nvram_path\")
root's avatar
root committed
112 113
--HWLAT
    Makes test program for haw latency tests
114 115
-a | --agent
   Enables agent for software-defined control of the eNB
116
-w | --hardware
117
   EXMIMO, USRP, BLADERF, LMSSDR, IRIS, ADRV9371_ZC706, SIMU, None (Default)
118
   Adds this RF board support (in external packages installation and in compilation)
119
-P | --phy_simulators
120
   Makes the unitary tests Layer 1 simulators
121
-S | --core_simulators
122 123 124
   Makes the core security features unitary simulators
-s | --check
   runs a set of auto-tests based on simulators and several compilation tests
125 126
--run-group 
   runs only specified test cases specified here. This flag is only valid with -s
127 128
-V | --vcd
   Adds a debgging facility to the binary files: GUI with major internal synchronization events
129 130
--verbose-compile
   Shows detailed compilation instructions in makefile
131 132
--cflags_processor
   Manually Add CFLAGS of processor if they are not detected correctly by script. Only add these flags if you know your processor supports them. Example flags: -msse3 -msse4.1 -msse4.2 -mavx2
133 134
--build-doxygen
   Builds doxygen based documentation.
135 136
--build-coverity-scan
   Builds Coverity-Scan objects for upload
137
--disable-deadline
138 139
   Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
laurent's avatar
laurent committed
140
   Enable deadline scheduler of Linux kernel (>=3.14.x). 
141
--disable-cpu-affinity
142
   Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads
143
--enable-cpu-affinity
144 145
--disable-T-Tracer
   Disables the T tracer.
Rohit Gupta's avatar
Rohit Gupta committed
146 147
--disable-hardware-dependency
   Disable HW dependency during installation
148
--ue-autotest-trace
149
   Enable specific traces for UE autotest framework
gabrielC's avatar
gabrielC committed
150
--ue-trace
151
   Enable traces for UE debugging
gabrielC's avatar
gabrielC committed
152
--ue-timing
153 154 155
   Enable traces for timing
--uhd-images-dir
   Download UHD images in the indicated location
156
--build-eclipse
157
   Build eclipse project files.
158
--build-lib <libraries>
159
   Build optional shared library, <libraries> can be one or several of $OPTIONAL_LIBRARIES or \"all\"
160 161
--usrp-recplay
   Build for I/Q record-playback modes
162 163
-k | --skip-shared-libraries
   Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes
heshanyun's avatar
heshanyun committed
164 165
--ittiSIM
  Makes the itti simulator
166 167
-h | --help
   Print this help
168

169
Usage (first build):
yilmazt's avatar
yilmazt committed
170 171
 NI/ETTUS B201  + COTS UE : ./build_oai -I -i --eNB -w USRP
Usage (regular):
172 173
 Eurecom EXMIMO + OAI ENB : ./build_oai --eNB  
 NI/ETTUS B201  + OAI ENB : ./build_oai --eNB -w USRP"
174 175 176 177
}


function main() {
178

179 180
  until [ -z "$1" ]
  do
181
    case "$1" in
182 183 184 185 186
       -c | --clean)
            CLEAN=1
            shift;;
       -C | --clean-all)
            CLEAN_ALL=1
thomasl's avatar
thomasl committed
187
            shift;;
188 189 190
       --clean-kernel)
            clean_kernel
            echo_info "Erased iptables config and removed modules from kernel"
thomasl's avatar
thomasl committed
191
            shift;;
192
       -I | --install-external-packages)
193
            INSTALL_EXTERNAL=1
194
            echo_info "Will install external packages"
thomasl's avatar
thomasl committed
195
            shift;;
196
       --install-optional-packages)
thomasl's avatar
thomasl committed
197 198 199
            INSTALL_OPTIONAL=1
            echo_info "Will install optional packages"
            shift;;
200 201 202 203
       -i | --install-system-files)
            INSTALL_SYSTEM_FILES=1
            echo_info "Will copy OpenAirInterface files in Linux directories"
            shift;;
204
       -g | --run-with-gdb)
205 206 207 208 209 210 211 212 213 214 215 216
            case "$2" in
                "Release")
                    GDB=0
                    CMAKE_BUILD_TYPE="Release"
                    echo_info "Will Compile without gdb symbols and with compiler optimization"
                    CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Release"
                    shift
                    ;;
                "RelWithDebInfo")
                    GDB=0
                    CMAKE_BUILD_TYPE="RelWithDebInfo"
                    echo_info "Will Compile with gdb symbols"
217
                    CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
218 219 220 221 222 223
                    shift
                    ;;
                "MinSizeRel")
                    GDB=0
                    CMAKE_BUILD_TYPE="MinSizeRel"
                    echo_info "Will Compile for minimal exec size"
224
                    CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=MinSizeRel"
225
                    shift
226
                    ;;
227 228 229 230 231 232
                "Debug" | *)
                    GDB=1
                    CMAKE_BUILD_TYPE="Debug"
                    echo_info "Will Compile with gdb symbols and disable compiler optimization"
                    CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
                    if [ "$2" == "Debug" ] ; then
233
                        shift
234 235 236
                    fi
                    ;;
            esac
thomasl's avatar
thomasl committed
237
            shift;;
238
       -G | --cmaketrace)
239
            CMAKE_CMD="$CMAKE_CMD --trace-expand"
thomasl's avatar
thomasl committed
240
            shift;;
241 242 243 244
       --eNB)
            eNB=1
            echo_info "Will compile eNB"
            shift;;
hardy's avatar
hardy committed
245 246 247 248 249
       --eNBocp)
            eNBocp=1
            echo_info "Will compile OCP eNB"
            shift;;
      --gNB)
Guy De Souza's avatar
Guy De Souza committed
250 251 252 253
            gNB=1
            NR="True"
            echo_info "Will compile gNB"
            shift;;
254
       -a | --agent)
Guy De Souza's avatar
Guy De Souza committed
255 256
            echo_info "FlexRAN support is always compiled into the eNB"
            shift;;
257 258 259 260
       --UE)
            UE=1
            echo_info "Will compile UE"
            shift;;
Guy De Souza's avatar
Guy De Souza committed
261 262 263 264 265
       --nrUE)
            nrUE=1
            NR="True"
            echo_info "Will compile NR UE"
            shift;;
Xu Bo's avatar
Xu Bo committed
266 267 268 269
       --mu)
            UE_EXPANSION="True"
            echo_info "Will compile with UE_EXPANSION"
            shift;;
Cedric Roux's avatar
Cedric Roux committed
270
       --UE-conf-nvram)
271
            conf_nvram_path=$(readlink -f $2)
Cedric Roux's avatar
Cedric Roux committed
272
            shift 2;;
273
       --UE-gen-nvram)
274 275
            gen_nvram_path=$(readlink -f $2)
            shift 2;;
thomasl's avatar
thomasl committed
276
       -w | --hardware)
277 278 279 280 281 282 283 284 285 286 287 288 289
            # Use OAI_USRP as the key word USRP is used inside UHD driver           
            case "$2" in
                "EXMIMO")
                    HW="EXMIMO"
                    ;;
                "USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "ADRV9371_ZC706" | "SIMU")
                    HW="OAI_"$2
                    ;;
                "None")
                    HW="None"
                    ;;
                *)
                    echo_fatal "Unknown HW type $HW: exit..."
290
            esac
291
			echo_info "Setting hardware to: $HW"
thomasl's avatar
thomasl committed
292
            shift 2;;
293
       -P | --phy_simulators)
thomasl's avatar
thomasl committed
294
            SIMUS_PHY=1
295 296
            echo_info "Will compile dlsim, ulsim, ..."
            shift;;
297
       -S | --core_simulators)
298 299 300
            SIMUS_CORE=1
            echo_info "Will compile security unitary tests"
            shift;;
thomasl's avatar
thomasl committed
301 302
       -s | --check)
            OAI_TEST=1
303
            echo_info "Will run auto-tests"
thomasl's avatar
thomasl committed
304
            shift;;
305 306 307 308 309
       --run-group)
            RUN_GROUP=1
            TEST_CASE_GROUP=$2
            echo_info "executing test cases only in group: $TEST_CASE_GROUP"
            shift 2;;
thomasl's avatar
thomasl committed
310
       -V | --vcd)
311
            echo_info "Setting gtk-wave output"
thomasl's avatar
thomasl committed
312 313
            VCD_TIMING=1
            EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
thomasl's avatar
thomasl committed
314
            shift;;
thomasl's avatar
thomasl committed
315
       -x | --xforms)
316
            XFORMS=1
thomasl's avatar
thomasl committed
317
            EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
318
            echo_info "Will generate the software oscilloscope features"
thomasl's avatar
thomasl committed
319
            shift;;
root's avatar
root committed
320 321 322 323 324 325 326 327
       --HWLAT)
            HWLAT=1
            echo_info "Will compile hw latency test program"
            shift;;
       --HWLAT_TEST)
            HWLAT_TEST=1
            echo_info "Will compile hw latency test program"
            shift;;
328 329 330 331
       --verbose-ci)
	        VERBOSE_CI=1
            echo_info "Will compile with verbose instructions in CI Docker env"
            shift;;
332
       --verbose-compile)
333
	        VERBOSE_COMPILE=1
334 335
            echo_info "Will compile with verbose instructions"
            shift;;
336 337
       --cflags_processor)
            CFLAGS_PROCESSOR_USER=$2
338
            echo_info "Setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
339
            shift 2;;
340
       --build-doxygen)
341
	        BUILD_DOXYGEN=1
342 343
            echo_info "Will build doxygen support"
            shift;;     
344
       --build-coverity-scan)
345
            BUILD_COVERITY_SCAN=1
346 347
            echo_info "Will build Coverity-Scan objects for upload"
            shift;;
348
       --disable-deadline)
349
            DEADLINE_SCHEDULER_FLAG_USER="False"
350 351
            echo_info "Disabling the usage of deadline scheduler"
            shift 1;;
352
       --enable-deadline)
353
            DEADLINE_SCHEDULER_FLAG_USER="True"
354 355
            echo_info "Enabling the usage of deadline scheduler"
            shift 1;;
Florian Kaltenberger's avatar
Florian Kaltenberger committed
356 357 358 359
       --enable-cpu-affinity)
            CPU_AFFINITY_FLAG_USER="True"
            echo_info "Enabling CPU Affinity (only valid when not using deadline scheduler)"
            shift 1;;
360 361 362 363
       --disable-cpu-affinity)
            CPU_AFFINITY_FLAG_USER="False"
            echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)"
            shift 1;;
364 365 366
       --disable-T-Tracer)
            T_TRACER="False"
            echo_info "Disabling the T tracer"
367
            shift 1;;
368 369 370 371
       --disable-hardware-dependency)
            echo_info "Disabling hardware dependency for compiling software"
            DISABLE_HARDWARE_DEPENDENCY="True"
            shift 1;;
372
       --ue-autotest-trace)
373 374 375
            UE_AUTOTEST_TRACE="True"
            echo_info "Enabling autotest specific trace for UE"
            shift 1;;
376
       --ue-trace)
gabrielC's avatar
gabrielC committed
377 378 379
            UE_DEBUG_TRACE="True"
            echo_info "Enabling UE trace for debug"
            shift 1;;
380
       --ue-timing)
gabrielC's avatar
gabrielC committed
381 382 383
            UE_TIMING_TRACE="True"
            echo_info "Enabling UE timing trace"
            shift 1;;
384
       --uhd-images-dir)
385 386 387
            UHD_IMAGES_DIR=$2
            echo_info "Downloading UHD images in the indicated location"
            shift 2;;
388 389 390 391
       --build-eclipse)
            BUILD_ECLIPSE=1
            CMAKE_CMD="$CMAKE_CMD"' -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -G"Eclipse CDT4 - Unix Makefiles"'
            echo_info "Enabling build eclipse project support"
oai's avatar
oai committed
392
            shift 1;;
393 394
       --build-lib) 
            BUILD_OPTLIB="" 
395 396 397 398 399
            if [  "$2" == "all" ] ; then
              BUILD_OPTLIB="$OPTIONAL_LIBRARIES"
              echo_info "Enabling build of all optional shared libraries ($OPTIONAL_LIBRARIES)" 
            else
              for alib in $2 ; do 
400
                for oklib in $OPTIONAL_LIBRARIES ; do
401 402 403 404 405
                  if [ "$alib" = "$oklib" ] ; then
                    BUILD_OPTLIB="$BUILD_OPTLIB $alib" 
                    echo_info "Enabling build of lib${alib}.so" 
                    fi   
                  done
406
                done
407 408 409
	          if [ "${BUILD_OPTLIB## }" != "$2" ] ; then
                 echo_fatal "Unknown optional library in $2, valid libraries are $OPTIONAL_LIBRARIES" 
              fi
410 411
            fi
            shift 2;;		
412 413 414 415
        --usrp-recplay)
            USRP_REC_PLAY="True"
            echo_info "Enabling USRP record playback mode"
            shift 1;;
416 417
        -k | --skip-shared-libraries)
            SKIP_SHARED_LIB_FLAG="True"
418
            echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries"
419
            shift;;
laurent's avatar
laurent committed
420 421 422 423
    --ninja)
        CMAKE_CMD="$CMAKE_CMD -GNinja"
	MAKE_CMD=ninja
	shift;;
heshanyun's avatar
heshanyun committed
424 425 426 427 428
      --ittiSIM)
            ittiSIM=1
            ITTI_SIM="True"
            echo_info "Will compile itti simulator"
            shift;;
thomasl's avatar
thomasl committed
429 430 431
        -h | --help)
            print_help
            exit 1;;
Lionel Gauthier's avatar
Lionel Gauthier committed
432
	*)
433 434
	    print_help
            echo_fatal "Unknown option $1"
thomasl's avatar
thomasl committed
435
            break;;
thomasl's avatar
thomasl committed
436
   esac
437
  done
438

yilmazt's avatar
yilmazt committed
439 440 441
  ###################################
  # Check if cov-build is installed #
  ###################################
442 443 444 445 446 447 448 449 450 451
  if [ "$BUILD_COVERITY_SCAN" == "1" ] ; then
      echo_info "Checking cov-build is installed"
      IS_INSTALLED=`which cov-build | grep -c cov-build || true`
      if [ $IS_INSTALLED -eq 1 ] ; then
          echo_info "Found cov-build"
      else
          echo_fatal "Did NOT find cov-build in PATH!"
      fi
  fi

452 453
  CMAKE_CMD="$CMAKE_CMD .."
  echo_info "CMAKE_CMD=$CMAKE_CMD"
Guy De Souza's avatar
Guy De Souza committed
454

yilmazt's avatar
yilmazt committed
455 456 457
  ########################################################
  # Check validity of HW and TP parameters for eNB / gNB #
  ########################################################
Aikaterini's avatar
Aikaterini committed
458
  # to be discussed
459
  
hardy's avatar
hardy committed
460
  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then
461
      if [ "$HW" = "None" -a  "$TP" = "None" ] ; then
yilmazt's avatar
yilmazt committed
462
	      echo_info "No local radio head and no transport protocol selected"
463
      fi
464
      if [ "$HW" = "None" ] ; then 
yilmazt's avatar
yilmazt committed
465
	      echo_info "No radio head has been selected (HW set to $HW)"	
466
      fi
467
      if [ "$TP" = "None" ] ; then
yilmazt's avatar
yilmazt committed
468
	      echo_info "No transport protocol has been selected (TP set to $TP)"	
469 470 471
      fi
  fi
  
root's avatar
root committed
472 473
  if [ "$HWLAT" = "1" ] ; then
      if [ "$HW" = "None" ] ; then
yilmazt's avatar
yilmazt committed
474
          echo_info "No radio head has been selected (HW set to $HW)" 
root's avatar
root committed
475 476 477
      fi
  fi

478
  echo_info "RF HW set to $HW" 
479 480
  # If the user doesn't specify the Linux scheduler to use, we set a value
  if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then
yilmazt's avatar
yilmazt committed
481
      case "$HW" in
482
          "EXMIMO")
yilmazt's avatar
yilmazt committed
483 484
		      DEADLINE_SCHEDULER_FLAG_USER="True"
		      ;;
485
          *)
yilmazt's avatar
yilmazt committed
486 487 488
		      DEADLINE_SCHEDULER_FLAG_USER="False"
		      ;;
      esac
489 490
  fi

491
  #Disable CPU Affinity for deadline scheduler
laurent's avatar
laurent committed
492
  if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then 
493 494
     CPU_AFFINITY_FLAG_USER="False"
  fi
495

laurent's avatar
laurent committed
496
  echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
497
  echo_info "Flags for CPU Affinity: $CPU_AFFINITY_FLAG_USER"
Aikaterini's avatar
Aikaterini committed
498

yilmazt's avatar
yilmazt committed
499 500 501
  #######################################################
  # Setting and printing OAI envs, we should check here #
  #######################################################
Lionel Gauthier's avatar
Lionel Gauthier committed
502

503
  echo_info "2. Setting the OAI PATHS ..."
thomasl's avatar
thomasl committed
504

505
  cecho "OPENAIR_DIR    = $OPENAIR_DIR" $green
thomasl's avatar
thomasl committed
506

507 508 509 510 511 512 513 514 515 516
  # for conf files copy in this bash script
  if [ -d /usr/lib/freeDiameter ]; then
    export FREEDIAMETER_PREFIX=/usr
  else
    if [ -d /usr/local/lib/freeDiameter ]; then
      export FREEDIAMETER_PREFIX=/usr/local
    else
      echo_warning "FreeDiameter prefix not found, install freeDiameter if EPC, HSS"
    fi
  fi
thomasl's avatar
thomasl committed
517

518 519 520 521
  if [ "$CLEAN_ALL" = "1" ] ; then
    clean_all_files
    echo_info "Erased all previously producted files"
  fi
522

523 524 525 526 527 528 529
  dbin=$OPENAIR_DIR/targets/bin
  dlog=$OPENAIR_DIR/cmake_targets/log
  mkdir -p $dbin $dlog

  if [ "$INSTALL_EXTERNAL" = "1" ] ; then
    echo_info "Installing packages"
    check_install_oai_software
530 531 532
    if [ "$HW" == "OAI_USRP" ] ; then
      echo_info "installing packages for USRP support"
      check_install_usrp_uhd_driver
533
      if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
534
        install_usrp_uhd_driver $UHD_IMAGES_DIR
535
      fi
536
    fi 
frobinet's avatar
frobinet committed
537 538 539 540
#    if [ "$HW" == "OAI_ADRV9371_ZC706" ] ; then
#      echo_info "\nInstalling packages for ADRV9371_ZC706 support"
#      check_install_libiio_driver
#    fi 
541
    if [ "$HW" == "OAI_BLADERF" ] ; then
542
      echo_info "installing packages for BLADERF support"
543
      check_install_bladerf_driver
544 545 546
      if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
        flash_firmware_bladerf
      fi
547
    fi
548 549 550 551 552 553
    if [ "$HW" == "OAI_IRIS" ] ; then
      echo_info "installing packages for IRIS support"
      check_install_soapy
      #if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
      #  flash_firmware_iris
      #fi
554
    fi
555
    echo_info "Installing protobuf/protobuf-c for flexran agent support"
556 557
    install_protobuf_from_source
    install_protobuf_c_from_source
558
    echo_success "protobuf/protobuf-c installation successful"
559 560 561 562 563 564 565
  fi

  if [ "$INSTALL_OPTIONAL" = "1" ] ; then
    echo_info "Installing optional packages"
    check_install_additional_tools
  fi

566 567
  
  
568 569 570
  echo_info "3. building the compilation directives ..."

  DIR=$OPENAIR_DIR/cmake_targets
571 572
  if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
    build_dir=phy_simulators
573
  else
574
    if [ "$T_TRACER" =  "False" ] ; then
575
      build_dir=ran_build_noLOG
576
    else
yilmazt's avatar
yilmazt committed
577
      build_dir=ran_build  
578
    fi
579
  fi
580 581
  [ "$CLEAN" = "1" ] && rm -rf $DIR/$build_dir/build
  mkdir -p $DIR/$build_dir/build
582

583 584 585
# configuration module libraries, one currently available, using libconfig 
  config_libconfig_shlib=params_libconfig
  
586
  # first generate the CMakefile in the right directory
heshanyun's avatar
heshanyun committed
587
  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then
588

Guy De Souza's avatar
Guy De Souza committed
589
    # softmodem compilation
590

Guy De Souza's avatar
Guy De Souza committed
591
    cmake_file=$DIR/$build_dir/CMakeLists.txt
yilmazt's avatar
yilmazt committed
592
    echo "cmake_minimum_required(VERSION 2.8)"                             >  $cmake_file
Laurent's avatar
Laurent committed
593
    echo "project (OpenAirInterface)"                                    >> $cmake_file
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
    echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )"                     >> $cmake_file
    echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )"       >> $cmake_file
    echo "set ( UE_EXPANSION $UE_EXPANSION )"                             >> $cmake_file
#    echo "set ( PHY_TX_THREAD $UE_EXPANSION )"                            >> $cmake_file
    echo "set ( PRE_SCD_THREAD $UE_EXPANSION )"                           >> $cmake_file
    echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )"                            >> $cmake_file
    echo "set ( RF_BOARD \"${HW}\")"                                      >> $cmake_file
    echo "set ( TRANSP_PRO \"${TP}\")"                                    >> $cmake_file
    echo "set ( PACKAGE_NAME \"${exec}\")"                                >> $cmake_file
    echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file
    echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )"             >> $cmake_file
    echo "set ( T_TRACER $T_TRACER )"                                     >> $cmake_file
    echo "set ( UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE )"                   >> $cmake_file
    echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )"                         >> $cmake_file
    echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )"                       >> $cmake_file
    echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )"                           >> $cmake_file
610
    echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )"             >> $cmake_file
heshanyun's avatar
heshanyun committed
611
    echo "set ( ITTI_SIM $ITTI_SIM )"                                     >> $cmake_file
612
    echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)'         >> $cmake_file
Guy De Souza's avatar
Guy De Souza committed
613
    cd  $DIR/$build_dir/build
614
    eval $CMAKE_CMD
615

616 617 618 619
    execlist=""
    if [ "$eNB" = "1" ] ; then
      execlist="$execlist lte-softmodem"
    fi
hardy's avatar
hardy committed
620 621 622
    if [ "$eNBocp" = "1" ] ; then
      execlist="$execlist ocp-enb"
    fi
623 624 625 626 627 628 629 630 631
    if [ "$gNB" = "1" ] ; then
      execlist="$execlist nr-softmodem"
    fi
    if [ "$UE" = 1 ] ; then
      execlist="$execlist lte-uesoftmodem"
    fi
    if [ "$nrUE" = 1 ] ; then
      execlist="$execlist nr-uesoftmodem"
    fi
632

heshanyun's avatar
heshanyun committed
633 634 635 636
    if [ "$ittiSIM" = "1" ] ; then
      execlist="$execlist nr-ittisim"
    fi

637 638
    for f in $execlist ; do
      echo_info "Compiling $f..."
639
      compilations \
640 641 642
        $build_dir $f \
        $f $dbin/$f.$REL
    done
643

644

yilmazt's avatar
yilmazt committed
645 646
# mandatory shared libraries common to UE and (e/g)NB

647
    if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
648
      echo_info "Building shared libraries common to UE and gNB"
yilmazt's avatar
yilmazt committed
649

650 651 652
      compilations \
        $build_dir $config_libconfig_shlib \
        lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
653

654 655 656
      compilations \
        $build_dir coding \
        libcoding.so $dbin/libcoding.so
yilmazt's avatar
yilmazt committed
657

658

659 660 661 662 663 664 665 666 667 668 669 670 671
      #check if we run inside a container or not
      #IS_CONTAINER variable is defined in build_helper file
      #compile  nasmesh and rb_tool only if NOT running in a container
      if [ $IS_CONTAINER -eq 0 ]
      then
        compilations \
          $build_dir nasmesh \
          CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko

        compilations \
          $build_dir rb_tool \
          rb_tool $dbin/rb_tool

672 673
        cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
      fi #IS_CONTAINER
674
    fi
yilmazt's avatar
yilmazt committed
675

676
  fi
677

yilmazt's avatar
yilmazt committed
678
  if [ "$UE" = 1 ] ; then
679

680
    echo_info "Compiling UE specific part"
681 682 683 684 685 686 687 688 689 690

    if [ $IS_CONTAINER -eq 0 ]
    then
      echo_info "Building ue_ip module"
      compilations \
        $build_dir ue_ip \
        CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
    else
      echo_info "Bypassing ue_ip build"
    fi #IS_CONTAINER
691

Lionel Gauthier's avatar
Lionel Gauthier committed
692 693
#    mkdir -p $DIR/at_commands/build
#    cd $DIR/at_commands/build
694
#    eval $CMAKE_CMD
Lionel Gauthier's avatar
Lionel Gauthier committed
695 696 697
#    compilations \
#      at_commands at_nas_ue \
#      at_nas_ue $dbin/at_nas_ue
698

Lionel Gauthier's avatar
Lionel Gauthier committed
699
    [ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
700 701
    mkdir -p $DIR/nas_sim_tools/build
    cd $DIR/nas_sim_tools/build
702

703
    eval $CMAKE_CMD
thomasl's avatar
thomasl committed
704
    compilations \
705 706
      nas_sim_tools usim \
      usim $dbin/usim
thomasl's avatar
thomasl committed
707
    compilations \
708 709
      nas_sim_tools nvram \
      nvram $dbin/nvram
thomasl's avatar
thomasl committed
710
    compilations \
711 712
      nas_sim_tools conf2uedata \
      conf2uedata $dbin/conf2uedata
713 714

    # generate USIM data
715 716
    if [ -f $dbin/conf2uedata ]; then
      install_nas_tools $conf_nvram_path $gen_nvram_path
Guy De Souza's avatar
Guy De Souza committed
717 718 719 720
      echo_info "Copying UE specific part to $DIR/$build_dir/build"
      cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$build_dir/build
      cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build
      cp -Rvf $dbin/.usim.nvram0 $DIR/$build_dir/build
721 722 723
    else
      echo_warning "not generated UE NAS files: binaries not found"
    fi
724
  fi
thomasl's avatar
thomasl committed
725

726
  if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
727
    cd  $DIR/$build_dir/build
728
    eval $CMAKE_CMD
729
  fi
730

yilmazt's avatar
yilmazt committed
731 732 733
  ##################
  # PHY simulators #
  ##################
734
  if [ "$SIMUS_PHY" = "1" ] ; then
yilmazt's avatar
yilmazt committed
735
    echo_info "Compiling physical unitary tests simulators"
736
    # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
737
    simlist="dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim"
WANG Tsu-Han's avatar
WANG Tsu-Han committed
738
	# simlist="ldpctest"
739 740
    for f in $simlist ; do
      compilations \
yilmazt's avatar
yilmazt committed
741 742
        phy_simulators $f \
	    $f $dbin/$f.$REL
743
    done
744
    compilations \
yilmazt's avatar
yilmazt committed
745 746
      phy_simulators coding \
      libcoding.so $dbin/libcoding.so
747
#    compilations \
yilmazt's avatar
yilmazt committed
748 749
#	   lte-simulators $config_libconfig_shlib \
#	   lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
750
  fi
thomasl's avatar
thomasl committed
751

yilmazt's avatar
yilmazt committed
752 753 754
  ###################
  # Core simulators #
  ###################
755
  if [ "$SIMUS_CORE" = "1" ] ; then
yilmazt's avatar
yilmazt committed
756
    echo_info "Compiling security unitary tests simulators"
757 758 759
    simlist="secu_knas_encrypt_eia1 secu_kenb aes128_ctr_encrypt aes128_ctr_decrypt secu_knas_encrypt_eea2 secu_knas secu_knas_encrypt_eea1 kdf aes128_cmac_encrypt secu_knas_encrypt_eia2"
    for f in $simlist ; do
      compilations \
yilmazt's avatar
yilmazt committed
760 761
	    phy_simulators test_$f \
	    test_$f $dbin/test_$f.$REL
762 763
    done
  fi
thomasl's avatar
thomasl committed
764

yilmazt's avatar
yilmazt committed
765 766 767
  ####################################
  # EXMIMO drivers & firmware loader #
  ####################################
768
  if [ "$HW" = "EXMIMO" ] ; then
769 770
    echo_info "Compiling Express MIMO 2 board drivers"
    compilations \
yilmazt's avatar
yilmazt committed
771 772
      $build_dir openair_rf \
      CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko
773
    compilations \
Guy De Souza's avatar
Guy De Souza committed
774
	  $build_dir updatefw \
Lionel Gauthier's avatar
Lionel Gauthier committed
775
	  updatefw $dbin/updatefw
776
    echo_info "Compiling oarf tools. The logfile for compilation is here: $dlog/oarf.txt"
Guy De Souza's avatar
Guy De Souza committed
777 778
    make -C $OPENAIR_DIR/cmake_targets/$build_dir/build oarf > $dlog/oarf.txt 2>&1
    cp $OPENAIR_DIR/cmake_targets/$build_dir/build/*.oct $dbin
779
    if [ -s $dbin/oarf_config_exmimo.oct ] ; then
yilmazt's avatar
yilmazt committed
780
	  echo_success "oarf tools compiled"
781
    else
yilmazt's avatar
yilmazt committed
782
	  echo_error "oarf tools compilation failed"
783
    fi
784
    cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
785
  fi
786
  
yilmazt's avatar
yilmazt committed
787 788 789
  ######################
  # Optional libraries #
  ######################
790 791 792
  if [ ! -z "$BUILD_OPTLIB" ] ; then 
     for oklib in $BUILD_OPTLIB ; do
         compilations \
yilmazt's avatar
yilmazt committed
793
             $build_dir $oklib \
794
             lib${oklib}.so $dbin/lib${oklib}.so
795
     done
yilmazt's avatar
yilmazt committed
796
  fi
thomasl's avatar
thomasl committed
797

798
  #####################
yilmazt's avatar
yilmazt committed
799
  # HWLAT compilation #
root's avatar
root committed
800 801 802
  #####################
  if [ "$HWLAT" = "1" ] ; then

yilmazt's avatar
yilmazt committed
803 804
      hwlat_exec=lte-hwlat
      hwlat_build_dir=lte-hwlat
root's avatar
root committed
805
     
yilmazt's avatar
yilmazt committed
806
      echo_info "Compiling $hwlat_exec ..."
root's avatar
root committed
807
    
yilmazt's avatar
yilmazt committed
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823
      [ "$CLEAN" = "1" ] && rm -rf $DIR/lte-hwlat/build 
      mkdir -p $DIR/$hwlat_build_dir/build
      cmake_file=$DIR/$hwlat_build_dir/CMakeLists.txt
      echo "cmake_minimum_required(VERSION 2.8)"                             > $cmake_file
      echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )"                     >> $cmake_file
      echo "set ( RF_BOARD \"${HW}\")"                                      >> $cmake_file
      echo 'set ( PACKAGE_NAME "\"lte-hwlat\"")'                            >> $cmake_file
      echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file
      echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )"             >> $cmake_file
      echo "set ( HWLAT \"${HWLAT}\" )"                                     >> $cmake_file
      echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)'         >> $cmake_file    
      cd $DIR/$hwlat_build_dir/build
      cmake ..
      compilations \
          lte-hwlat lte-hwlat \
          lte-hwlat $dbin/lte-hwlat
root's avatar
root committed
824 825
  fi  
 
yilmazt's avatar
yilmazt committed
826 827 828
  ##########################
  # HWLAT_TEST compilation #
  ##########################
root's avatar
root committed
829 830
  if [ "$HWLAT_TEST" = "1" ] ; then

yilmazt's avatar
yilmazt committed
831 832
      hwlat_test_exec=lte-hwlat-test
      hwlat_test_build_dir=lte-hwlat-test
root's avatar
root committed
833
     
yilmazt's avatar
yilmazt committed
834
      echo_info "Compiling $hwlat_test_exec ..."
root's avatar
root committed
835
    
yilmazt's avatar
yilmazt committed
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
      [ "$CLEAN" = "1" ] && rm -rf $DIR/lte-hwlat-test/build 
      mkdir -p $DIR/$hwlat_test_build_dir/build
      cmake_file=$DIR/$hwlat_test_build_dir/CMakeLists.txt
      echo "cmake_minimum_required(VERSION 2.8)"                             > $cmake_file
      echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )"                     >> $cmake_file
      echo "set ( RF_BOARD \"${HW}\")"                                      >> $cmake_file
      echo 'set ( PACKAGE_NAME "\"lte-hwlat-test\"")'                       >> $cmake_file
      echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file
      echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )"             >> $cmake_file
      echo "set ( HWLAT \"${HWLAT}\" )"                                     >> $cmake_file
      echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)'         >> $cmake_file    
      cd $DIR/$hwlat_test_build_dir/build
      cmake ..
      compilations \
          lte-hwlat-test lte-hwlat-test \
          lte-hwlat-test $dbin/lte-hwlat-test
852
  fi
yilmazt's avatar
yilmazt committed
853 854 855 856
  
  ####################################################
  # Build RF device and transport protocol libraries #
  ####################################################
Raphael Defosseux's avatar
Raphael Defosseux committed
857
  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
858

859
      # build RF device libraries
860
      if [ "$HW" != "None" ] ; then
yilmazt's avatar
yilmazt committed
861 862 863 864 865
          rm -f liboai_device.so
          rm -f $dbin/liboai_device.so

          # link liboai_device.so with the selected RF device library
          if [ "$HW" == "EXMIMO" ] ; then
866
              compilations \
yilmazt's avatar
yilmazt committed
867
                  $build_dir oai_exmimodevif \
868
                  liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
yilmazt's avatar
yilmazt committed
869

870 871 872 873
              ln -sf liboai_exmimodevif.so liboai_device.so
              ln -sf $dbin/liboai_exmimodevif.so.$REL $dbin/liboai_device.so
              echo_info "liboai_device.so is linked to EXMIMO device library"
          elif [ "$HW" == "OAI_USRP" ] ; then
874 875 876
              compilations \
                  $build_dir oai_usrpdevif \
                  liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
877

yilmazt's avatar
yilmazt committed
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896
              ln -sf liboai_usrpdevif.so liboai_device.so
              ln -sf $dbin/liboai_usrpdevif.so.$REL $dbin/liboai_device.so
              echo_info "liboai_device.so is linked to USRP device library"        
          elif [ "$HW" == "OAI_BLADERF" ] ; then
              if [ -f "/usr/include/libbladeRF.h" ] ; then
                  compilations \
                      $build_dir oai_bladerfdevif \
                      liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
              fi

              ln -sf liboai_bladerfdevif.so liboai_device.so
              ln -sf $dbin/liboai_bladerfdevif.so.$REL $dbin/liboai_device.so
              echo_info "liboai_device.so is linked to BLADERF device library"	 
          elif [ "$HW" == "OAI_LMSSDR" ] ; then
#              if [ -f "/usr/include/libbladeRF.h" ] ; then
                  compilations \
                      $build_dir oai_lmssdrdevif \
                      liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
#              fi
897

yilmazt's avatar
yilmazt committed
898 899 900
              ln -sf liboai_lmssdrdevif.so liboai_device.so
              ln -sf $dbin/liboai_lmssdrdevif.so.$REL $dbin/liboai_device.so
              echo_info "liboai_device.so is linked to LMSSDR device library"	 
901
          elif [ "$HW" == "OAI_IRIS" ] ; then
yilmazt's avatar
yilmazt committed
902 903 904
              compilations \
                  $build_dir oai_irisdevif \
                  liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
905 906 907 908

              ln -s liboai_irisdevif.so liboai_device.so
              ln -s $dbin/liboai_irisdevif.so.$REL $dbin/liboai_device.so
              echo_info "liboai_device.so is linked to IRIS device library"
yilmazt's avatar
yilmazt committed
909 910 911 912 913 914 915 916 917 918 919 920
          elif [ "$HW" == "OAI_ADRV9371_ZC706" ] ; then
              SYRIQ_KVER=$(uname -r)
              SYRIQ_KMAJ=$(echo $SYRIQ_KVER | sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
              SYRIQ_KMIN=$(echo $SYRIQ_KVER | sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
#              echo $SYRIQ_KMAJ$SYRIQ_KMIN
              if [ "$SYRIQ_KMAJ$SYRIQ_KMIN" == "319" ] || [ "$SYRIQ_KMAJ$SYRIQ_KMIN" == "410" ] || [ "$SYRIQ_KMAJ$SYRIQ_KMIN" == "415" ] ; then
#                  echo "Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN detected"
                  ln -sf /usr/local/lib/syriq/libadrv9371zc706.so liboai_device.so
              else
                  echo_error "== FAILED == Unexpected Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
              fi
              echo_info "liboai_device.so is linked to ADRV9371_ZC706 device library for Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
921 922 923
          else
              echo_info "liboai_device.so is not linked to any device library"
          fi
924
      fi
925

yilmazt's avatar
yilmazt committed
926
      #build simulators devices
927
      if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
928 929 930 931 932
          echo_info "Compiling rfsimulator"
          compilations \
              $build_dir rfsimulator \
              librfsimulator.so $dbin/librfsimulator.so.$REL

933
          echo_info "Compiling tcp_bridge_oai"
934 935 936
          compilations \
              $build_dir tcp_bridge_oai \
              libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
937
      fi
938

yilmazt's avatar
yilmazt committed
939
      #build transport protocol libraries (currently only ETHERNET is available)
940
      if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
941 942 943 944 945 946 947 948 949
          echo_info "Building transport protocol libraries"
          rm -f liboai_transpro.so
          rm -f $dbin/liboai_transpro.so
          compilations \
              $build_dir oai_eth_transpro \
              liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
          ln -sf liboai_eth_transpro.so liboai_transpro.so
          ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
          echo_info "liboai_transpro.so is linked to ETHERNET transport"
950
      fi
yilmazt's avatar
yilmazt committed
951
  fi
952

yilmazt's avatar
yilmazt committed
953 954 955 956
  ###################
  # Doxygen Support #
  ###################
  if [ "$BUILD_DOXYGEN" = "1" ] ; then
957
    doxygen_log=$OPENAIR_DIR/cmake_targets/log/doxygen.log
yilmazt's avatar
yilmazt committed
958 959 960
    echo_info "Building Doxygen based documentation. The documentation file is located here: $OPENAIR_DIR/targets/DOCS/html/index.html"
    echo_info "Doxygen generation log is located here: $doxygen_log"
    echo_info "Generating Doxygen files....please wait"
961 962 963 964
    (
    [ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/doxygen/build
    mkdir -p $OPENAIR_DIR/cmake_targets/doxygen/build
    cd $OPENAIR_DIR/cmake_targets/doxygen/build
965
    eval $CMAKE_CMD
966 967
    make doc
    ) >& $doxygen_log
968 969
  fi

yilmazt's avatar
yilmazt committed
970 971 972 973
  ##############
  # Auto-tests #
  ##############
  if [ "$OAI_TEST" = "1" ] ; then
thomasl's avatar
thomasl committed
974
    echo_info "10. Running OAI pre commit tests (pre-ci) ..."
975 976 977 978
    echo_error "These scripts ASSUME that user is in /etc/sudoers and can execute commands without PASSWORD prompt"
    echo_error "Add the following lines in /etc/sudoers file to make your __user_name__ sudo without password prompt"
    echo_error " __your_user_name__ ALL = (ALL:ALL) NOPASSWD: ALL"
    echo_error " __your_user_name__ ALL = (ALL) NOPASSWD: ALL "
979 980
    echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log "
    echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
yilmazt's avatar
yilmazt committed
981
    echo_info "You can hit CTRL-C at any time to terminate the autotests..."
982 983 984
    echo "Current User Name: $USER"
    read -s -p "Enter Password: " mypassword
    echo -e "\n"
985 986
    rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
    mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
987
    if [ "$RUN_GROUP" -eq "1" ]; then
988
        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
989
    else
990
        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
991
    fi
992
    wait
Lionel Gauthier's avatar
Lionel Gauthier committed
993
  else
thomasl's avatar
thomasl committed
994
    echo_info "10. Bypassing the Tests ..."
995
    echo_success "BUILD SHOULD BE SUCCESSFUL"
Lionel Gauthier's avatar
Lionel Gauthier committed
996
  fi
997

998 999 1000
}

main "$@"