Initial commit
[o-du/l2.git] / build / scripts / build_prereq
1 ################################################################################
2 #   Copyright (c) [2017-2019] [Radisys]                                        #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16
17 #! /bin/sh
18
19 function printUsageAndExit(){
20    echo "Usage: $0  -m (TDD | FDD)  <dir_to_be_created>"
21    echo ""
22    echo "Mandatory arguments"
23    echo "==================="
24    echo "   -m, --mode (TDD | FDD)     Mode has to be either TDD or FDD"
25    echo "Optional arguments" 
26    echo "==================="
27    echo "   <dir_to_be_created>        Desitnation directory where compilation will be done"
28    echo "   <PKG> or <EVAL>            Package or EVAL yes"
29    echo ""
30    exit 1;
31 }
32
33 DIR=$PWD/../..
34 MODE=
35 TARGET_DIRS_FOUND=0
36 PKG="NO"
37 OLD_MODE="TDD"
38
39 while [ "$1" != "" ]; do
40    case $1 in
41       -m | --mode )  shift
42                      MODE=$1
43                      ;;
44       -PKG )         PKG="YES"
45                      ;;
46       -h | --help )   printUsageAndExit
47                      ;;
48       * )            DIR=$1
49                      TARGET_DIRS_FOUND=`expr $TARGET_DIRS_FOUND + 1`
50     esac
51 shift
52 done
53
54 if [ "$MODE" != "FDD" ] && [ "$MODE" != "TDD" ]
55 then
56   echo "Invalid mode specified $MODE"
57   printUsageAndExit
58 fi
59
60 SRC_PATH=$DIR/src
61 BIN_PATH=$DIR/bin
62
63 echo $PWD $SRC_PATH $BIN_PATH
64
65 #******************************************* Implemented Local Build Functionalities ******************************************
66 BLD_PATH=$SRC_PATH/../build/
67 BuildFileResult=$BLD_PATH/targetbuild.txt
68 rm -f $BuildFileResult
69 echo $MODE > $BuildFileResult
70 #*******************************************************************************************************************************
71
72 #Remvoing unwanted files from the package 
73 find $SRC_PATH -name  "*.tmp"  -exec rm -f {} \;
74 find $SRC_PATH -name  "*.keep"  -exec rm -f {} \;
75 find $SRC_PATH -name  "*.contrib"  -exec rm -f {} \;
76 find $SRC_PATH -name  "*.contrib.1"  -exec rm -f {} \;
77 find $SRC_PATH -name  "*.contrib.2"  -exec rm -f {} \;
78