"cmake_targets/build_oai" did not exist on "9e0d42a0732019226e57ec9bd82cbbc09e3072d3"
build_oai 35.6 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"
laurent's avatar
laurent committed
45
UESIM_EXPANSION="False"
46
PRINT_STATS="False"
thomasl's avatar
thomasl committed
47
VCD_TIMING="False"
laurent's avatar
laurent committed
48
DEADLINE_SCHEDULER_FLAG_USER=""
yilmazt's avatar
yilmazt committed
49
CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False
50
REL="Rel15"
51
HW="None"
52
TP="None"
Lionel Gauthier's avatar
Lionel Gauthier committed
53
EPC=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"
70
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
71 72
trap handle_ctrl_c INT

73
function print_help() {
Cedric Roux's avatar
Cedric Roux committed
74
  echo_info "
75
This program installs OpenAirInterface Software
laurent's avatar
laurent committed
76
You should have ubuntu 16.xx or 18.04 updated
77 78
Options
-c | --clean
Cedric Roux's avatar
Cedric Roux committed
79
   Erase all files to make a rebuild from start
80
-C | --clean-all
Cedric Roux's avatar
Cedric Roux committed
81
   Erase all files made by previous compilations, installations
82 83
--clean-kernel
   Erase previously installed features in kernel: iptables, drivers, ...
Lionel Gauthier's avatar
Lionel Gauthier committed
84
-I | --install-external-packages
85 86 87 88
   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
89 90 91
-i | --install-system-files
   Install OpenAirInterface required files in Linux system
   This option will require root password
92 93 94 95 96
-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
97
--eNB
Guy De Souza's avatar
Guy De Souza committed
98
  Makes the LTE softmodem
hardy's avatar
hardy committed
99 100 101
--eNBocp
  Makes the OCP LTE softmodem
-gNB
Guy De Souza's avatar
Guy De Souza committed
102 103 104
  Makes the NR softmodem
--nrUE
  Makes the NR UE softmodem
105
--UE
106
   Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
Cedric Roux's avatar
Cedric Roux committed
107 108 109 110
--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
111 112
--HWLAT
    Makes test program for haw latency tests
113 114
-a | --agent
   Enables agent for software-defined control of the eNB
115
-w | --hardware
116
   EXMIMO, USRP, BLADERF, LMSSDR, IRIS, ADRV9371_ZC706, SIMU, None (Default)
117
   Adds this RF board support (in external packages installation and in compilation)
118
-P | --phy_simulators
119
   Makes the unitary tests Layer 1 simulators
120
-S | --core_simulators
121 122 123
   Makes the core security features unitary simulators
-s | --check
   runs a set of auto-tests based on simulators and several compilation tests
124 125
--run-group 
   runs only specified test cases specified here. This flag is only valid with -s
126 127
-V | --vcd
   Adds a debgging facility to the binary files: GUI with major internal synchronization events
128 129
--verbose-compile
   Shows detailed compilation instructions in makefile
130 131
--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
132 133
--build-doxygen
   Builds doxygen based documentation.
134 135
--build-coverity-scan
   Builds Coverity-Scan objects for upload
136
--disable-deadline
137 138
   Disables deadline scheduler of Linux kernel (>=3.14.x).
--enable-deadline
laurent's avatar
laurent committed
139
   Enable deadline scheduler of Linux kernel (>=3.14.x). 
140
--disable-cpu-affinity
141
   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
142
--enable-cpu-affinity
143 144
--disable-T-Tracer
   Disables the T tracer.
Rohit Gupta's avatar
Rohit Gupta committed
145 146
--disable-hardware-dependency
   Disable HW dependency during installation
147
--ue-autotest-trace
148
   Enable specific traces for UE autotest framework
gabrielC's avatar
gabrielC committed
149
--ue-trace
150
   Enable traces for UE debugging
gabrielC's avatar
gabrielC committed
151
--ue-timing
152 153 154
   Enable traces for timing
--uhd-images-dir
   Download UHD images in the indicated location
155
--build-eclipse
156
   Build eclipse project files.
157
--build-lib <libraries>
158
   Build optional shared library, <libraries> can be one or several of $OPTIONAL_LIBRARIES or \"all\"
159 160
--usrp-recplay
   Build for I/Q record-playback modes
161 162
-k | --skip-shared-libraries
   Skip build for shared libraries to reduce compilation time when building frequently for debugging purposes
163 164
-h | --help
   Print this help
165

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


function main() {
175

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

yilmazt's avatar
yilmazt committed
431 432 433
  ###################################
  # Check if cov-build is installed #
  ###################################
434 435 436 437 438 439 440 441 442 443
  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

444 445
  CMAKE_CMD="$CMAKE_CMD .."
  echo_info "CMAKE_CMD=$CMAKE_CMD"
Guy De Souza's avatar
Guy De Souza committed
446

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

470
  echo_info "RF HW set to $HW" 
471 472
  # 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
473
      case "$HW" in
474
          "EXMIMO")
yilmazt's avatar
yilmazt committed
475 476
		      DEADLINE_SCHEDULER_FLAG_USER="True"
		      ;;
477
          *)
yilmazt's avatar
yilmazt committed
478 479 480
		      DEADLINE_SCHEDULER_FLAG_USER="False"
		      ;;
      esac
481 482
  fi

483
  #Disable CPU Affinity for deadline scheduler
laurent's avatar
laurent committed
484
  if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then 
485 486
     CPU_AFFINITY_FLAG_USER="False"
  fi
487

laurent's avatar
laurent committed
488
  echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
489
  echo_info "Flags for CPU Affinity: $CPU_AFFINITY_FLAG_USER"
Aikaterini's avatar
Aikaterini committed
490

491 492 493 494
  if [ -n "$UHD_IMAGES_DIR" ] && [ -z "$INSTALL_EXTERNAL" ]; then
    echo_error "UHD images download settings will not be applied without -I present"
    exit
  fi
yilmazt's avatar
yilmazt committed
495 496 497 498
  
  #######################################################
  # Setting and printing OAI envs, we should check here #
  #######################################################
Lionel Gauthier's avatar
Lionel Gauthier committed
499

500
  echo_info "2. Setting the OAI PATHS ..."
thomasl's avatar
thomasl committed
501

502
  cecho "OPENAIR_DIR    = $OPENAIR_DIR" $green
thomasl's avatar
thomasl committed
503

504 505 506 507 508 509 510 511 512 513
  # 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
514

515 516 517 518
  if [ "$CLEAN_ALL" = "1" ] ; then
    clean_all_files
    echo_info "Erased all previously producted files"
  fi
519

520 521 522 523 524 525 526
  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
527 528 529
    if [ "$HW" == "OAI_USRP" ] ; then
      echo_info "installing packages for USRP support"
      check_install_usrp_uhd_driver
530
      if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
531
        install_usrp_uhd_driver $UHD_IMAGES_DIR
532
      fi
533
    fi 
frobinet's avatar
frobinet committed
534 535 536 537
#    if [ "$HW" == "OAI_ADRV9371_ZC706" ] ; then
#      echo_info "\nInstalling packages for ADRV9371_ZC706 support"
#      check_install_libiio_driver
#    fi 
538
    if [ "$HW" == "OAI_BLADERF" ] ; then
539
      echo_info "installing packages for BLADERF support"
540
      check_install_bladerf_driver
541 542 543
      if [ ! "$DISABLE_HARDWARE_DEPENDENCY" == "True" ]; then
        flash_firmware_bladerf
      fi
544
    fi
545 546 547 548 549 550
    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
551
    fi
552 553 554
    echo_info "installing protobuf/protobuf-c for flexran agent support"
    install_protobuf_from_source
    install_protobuf_c_from_source
555 556 557 558 559 560 561
  fi

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

562 563
  
  
564 565 566
  echo_info "3. building the compilation directives ..."

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

579 580 581
# configuration module libraries, one currently available, using libconfig 
  config_libconfig_shlib=params_libconfig
  
582
  # first generate the CMakefile in the right directory
hardy's avatar
hardy committed
583
  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" ] ; then
584

Guy De Souza's avatar
Guy De Souza committed
585
    # softmodem compilation
586

Guy De Souza's avatar
Guy De Souza committed
587
    cmake_file=$DIR/$build_dir/CMakeLists.txt
yilmazt's avatar
yilmazt committed
588
    echo "cmake_minimum_required(VERSION 2.8)"                             >  $cmake_file
Laurent's avatar
Laurent committed
589
    echo "project (OpenAirInterface)"                                    >> $cmake_file
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
    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 ( UESIM_EXPANSION $UESIM_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
607
    echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )"             >> $cmake_file
608
    echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)'         >> $cmake_file
Guy De Souza's avatar
Guy De Souza committed
609
    cd  $DIR/$build_dir/build
610
    eval $CMAKE_CMD
611

612 613 614 615
    execlist=""
    if [ "$eNB" = "1" ] ; then
      execlist="$execlist lte-softmodem"
    fi
hardy's avatar
hardy committed
616 617 618
    if [ "$eNBocp" = "1" ] ; then
      execlist="$execlist ocp-enb"
    fi
619 620 621 622 623 624 625 626 627
    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
628

629 630
    for f in $execlist ; do
      echo_info "Compiling $f..."
631
      compilations \
632 633 634
        $build_dir $f \
        $f $dbin/$f.$REL
    done
635

636

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

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

642 643 644
      compilations \
        $build_dir $config_libconfig_shlib \
        lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
645

646 647 648
      compilations \
        $build_dir coding \
        libcoding.so $dbin/libcoding.so
yilmazt's avatar
yilmazt committed
649

650 651 652
      compilations \
        $build_dir nasmesh \
        CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
653

654 655 656
      compilations \
        $build_dir rb_tool \
        rb_tool $dbin/rb_tool
yilmazt's avatar
yilmazt committed
657
      cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
658
    fi
yilmazt's avatar
yilmazt committed
659

660
  fi
661

yilmazt's avatar
yilmazt committed
662
  if [ "$UE" = 1 ] ; then
663

664 665
    echo_info "Compiling UE specific part"
    compilations \
Guy De Souza's avatar
Guy De Souza committed
666
      $build_dir ue_ip \
Lionel Gauthier's avatar
Lionel Gauthier committed
667
      CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
668

Lionel Gauthier's avatar
Lionel Gauthier committed
669 670
#    mkdir -p $DIR/at_commands/build
#    cd $DIR/at_commands/build
671
#    eval $CMAKE_CMD
Lionel Gauthier's avatar
Lionel Gauthier committed
672 673 674
#    compilations \
#      at_commands at_nas_ue \
#      at_nas_ue $dbin/at_nas_ue
675

Lionel Gauthier's avatar
Lionel Gauthier committed
676
    [ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
677 678
    mkdir -p $DIR/nas_sim_tools/build
    cd $DIR/nas_sim_tools/build
679

680
    eval $CMAKE_CMD
thomasl's avatar
thomasl committed
681
    compilations \
682 683
      nas_sim_tools usim \
      usim $dbin/usim
thomasl's avatar
thomasl committed
684
    compilations \
685 686
      nas_sim_tools nvram \
      nvram $dbin/nvram
thomasl's avatar
thomasl committed
687
    compilations \
688 689
      nas_sim_tools conf2uedata \
      conf2uedata $dbin/conf2uedata
690 691

    # generate USIM data
692 693
    if [ -f $dbin/conf2uedata ]; then
      install_nas_tools $conf_nvram_path $gen_nvram_path
Guy De Souza's avatar
Guy De Souza committed
694 695 696 697
      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
698 699 700
    else
      echo_warning "not generated UE NAS files: binaries not found"
    fi
701
  fi
thomasl's avatar
thomasl committed
702

703
  if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then
704
    cd  $DIR/$build_dir/build
705
    eval $CMAKE_CMD
706
  fi
707

yilmazt's avatar
yilmazt committed
708 709 710
  ##################
  # PHY simulators #
  ##################
711
  if [ "$SIMUS_PHY" = "1" ] ; then
yilmazt's avatar
yilmazt committed
712
    echo_info "Compiling physical unitary tests simulators"
713
    # TODO: fix: dlsim_tm4 pucchsim prachsim pdcchsim pbchsim mbmssim
714
    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
715
	# simlist="ldpctest"
716 717
    for f in $simlist ; do
      compilations \
yilmazt's avatar
yilmazt committed
718 719
        phy_simulators $f \
	    $f $dbin/$f.$REL
720
    done
721
    compilations \
yilmazt's avatar
yilmazt committed
722 723
      phy_simulators coding \
      libcoding.so $dbin/libcoding.so
724
#    compilations \
yilmazt's avatar
yilmazt committed
725 726
#	   lte-simulators $config_libconfig_shlib \
#	   lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
727
  fi
thomasl's avatar
thomasl committed
728

yilmazt's avatar
yilmazt committed
729 730 731
  ###################
  # Core simulators #
  ###################
732
  if [ "$SIMUS_CORE" = "1" ] ; then
yilmazt's avatar
yilmazt committed
733
    echo_info "Compiling security unitary tests simulators"
734 735 736
    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
737 738
	    phy_simulators test_$f \
	    test_$f $dbin/test_$f.$REL
739 740
    done
  fi
thomasl's avatar
thomasl committed
741

yilmazt's avatar
yilmazt committed
742 743 744
  ####################################
  # EXMIMO drivers & firmware loader #
  ####################################
745
  if [ "$HW" = "EXMIMO" ] ; then
746 747
    echo_info "Compiling Express MIMO 2 board drivers"
    compilations \
yilmazt's avatar
yilmazt committed
748 749
      $build_dir openair_rf \
      CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko
750
    compilations \
Guy De Souza's avatar
Guy De Souza committed
751
	  $build_dir updatefw \
Lionel Gauthier's avatar
Lionel Gauthier committed
752
	  updatefw $dbin/updatefw
753
    echo_info "Compiling oarf tools. The logfile for compilation is here: $dlog/oarf.txt"
Guy De Souza's avatar
Guy De Souza committed
754 755
    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
756
    if [ -s $dbin/oarf_config_exmimo.oct ] ; then
yilmazt's avatar
yilmazt committed
757
	  echo_success "oarf tools compiled"
758
    else
yilmazt's avatar
yilmazt committed
759
	  echo_error "oarf tools compilation failed"
760
    fi
761
    cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
762
  fi
763
  
yilmazt's avatar
yilmazt committed
764 765 766
  ######################
  # Optional libraries #
  ######################
767 768 769
  if [ ! -z "$BUILD_OPTLIB" ] ; then 
     for oklib in $BUILD_OPTLIB ; do
         compilations \
yilmazt's avatar
yilmazt committed
770
             $build_dir $oklib \
771
             lib${oklib}.so $dbin/lib${oklib}.so
772
     done
yilmazt's avatar
yilmazt committed
773
  fi
thomasl's avatar
thomasl committed
774

775
  #####################
yilmazt's avatar
yilmazt committed
776
  # HWLAT compilation #
root's avatar
root committed
777 778 779
  #####################
  if [ "$HWLAT" = "1" ] ; then

yilmazt's avatar
yilmazt committed
780 781
      hwlat_exec=lte-hwlat
      hwlat_build_dir=lte-hwlat
root's avatar
root committed
782
     
yilmazt's avatar
yilmazt committed
783
      echo_info "Compiling $hwlat_exec ..."
root's avatar
root committed
784
    
yilmazt's avatar
yilmazt committed
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
      [ "$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
801 802
  fi  
 
yilmazt's avatar
yilmazt committed
803 804 805
  ##########################
  # HWLAT_TEST compilation #
  ##########################
root's avatar
root committed
806 807
  if [ "$HWLAT_TEST" = "1" ] ; then

yilmazt's avatar
yilmazt committed
808 809
      hwlat_test_exec=lte-hwlat-test
      hwlat_test_build_dir=lte-hwlat-test
root's avatar
root committed
810
     
yilmazt's avatar
yilmazt committed
811
      echo_info "Compiling $hwlat_test_exec ..."
root's avatar
root committed
812
    
yilmazt's avatar
yilmazt committed
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
      [ "$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
829
  fi
yilmazt's avatar
yilmazt committed
830 831 832 833
  
  ####################################################
  # Build RF device and transport protocol libraries #
  ####################################################
Raphael Defosseux's avatar
Raphael Defosseux committed
834
  if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
835

836
      # build RF device libraries
837
      if [ "$HW" != "None" ] ; then
yilmazt's avatar
yilmazt committed
838 839 840 841 842
          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
843
              compilations \
yilmazt's avatar
yilmazt committed
844
                  $build_dir oai_exmimodevif \
845
                  liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
yilmazt's avatar
yilmazt committed
846

847 848 849 850
              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
851 852 853
              compilations \
                  $build_dir oai_usrpdevif \
                  liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
854

yilmazt's avatar
yilmazt committed
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873
              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
874

yilmazt's avatar
yilmazt committed
875 876 877
              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"	 
878
          elif [ "$HW" == "OAI_IRIS" ] ; then
yilmazt's avatar
yilmazt committed
879 880 881
              compilations \
                  $build_dir oai_irisdevif \
                  liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
882 883 884 885

              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
886 887 888 889 890 891 892 893 894 895 896 897
          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"
898 899 900
          else
              echo_info "liboai_device.so is not linked to any device library"
          fi
901
      fi
902

yilmazt's avatar
yilmazt committed
903
      #build simulators devices
904
      if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
905 906 907 908 909
          echo_info "Compiling rfsimulator"
          compilations \
              $build_dir rfsimulator \
              librfsimulator.so $dbin/librfsimulator.so.$REL

910
          echo_info "Compiling tcp_bridge_oai"
911 912 913
          compilations \
              $build_dir tcp_bridge_oai \
              libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
914
      fi
915

yilmazt's avatar
yilmazt committed
916
      #build transport protocol libraries (currently only ETHERNET is available)
917
      if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
918 919 920 921 922 923 924 925 926
          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"
927
      fi
yilmazt's avatar
yilmazt committed
928
  fi
929

yilmazt's avatar
yilmazt committed
930 931 932 933
  ###################
  # Doxygen Support #
  ###################
  if [ "$BUILD_DOXYGEN" = "1" ] ; then
934
    doxygen_log=$OPENAIR_DIR/cmake_targets/log/doxygen.log
yilmazt's avatar
yilmazt committed
935 936 937
    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"
938 939 940 941
    (
    [ "$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
942
    eval $CMAKE_CMD
943 944
    make doc
    ) >& $doxygen_log
945 946
  fi

yilmazt's avatar
yilmazt committed
947 948 949 950
  ##############
  # Auto-tests #
  ##############
  if [ "$OAI_TEST" = "1" ] ; then
thomasl's avatar
thomasl committed
951
    echo_info "10. Running OAI pre commit tests (pre-ci) ..."
952 953 954 955
    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 "
956 957
    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
958
    echo_info "You can hit CTRL-C at any time to terminate the autotests..."
959 960 961
    echo "Current User Name: $USER"
    read -s -p "Enter Password: " mypassword
    echo -e "\n"
962 963
    rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
    mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
964
    if [ "$RUN_GROUP" -eq "1" ]; then
965
        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
966
    else
967
        $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -p $mypassword >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
968
    fi
969
    wait
Lionel Gauthier's avatar
Lionel Gauthier committed
970
  else
thomasl's avatar
thomasl committed
971
    echo_info "10. Bypassing the Tests ..."
972
    echo_success "BUILD SHOULD BE SUCCESSFUL"
Lionel Gauthier's avatar
Lionel Gauthier committed
973
  fi
974

975 976 977
}

main "$@"