Initial commit
[o-du/l2.git] / build / scripts / build_prereq
diff --git a/build/scripts/build_prereq b/build/scripts/build_prereq
new file mode 100755 (executable)
index 0000000..f266ab0
--- /dev/null
@@ -0,0 +1,78 @@
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+
+#! /bin/sh
+
+function printUsageAndExit(){
+   echo "Usage: $0  -m (TDD | FDD)  <dir_to_be_created>"
+   echo ""
+   echo "Mandatory arguments"
+   echo "==================="
+   echo "   -m, --mode (TDD | FDD)     Mode has to be either TDD or FDD"
+   echo "Optional arguments" 
+   echo "==================="
+   echo "   <dir_to_be_created>        Desitnation directory where compilation will be done"
+   echo "   <PKG> or <EVAL>            Package or EVAL yes"
+   echo ""
+   exit 1;
+}
+
+DIR=$PWD/../..
+MODE=
+TARGET_DIRS_FOUND=0
+PKG="NO"
+OLD_MODE="TDD"
+
+while [ "$1" != "" ]; do
+   case $1 in
+      -m | --mode )  shift
+                     MODE=$1
+                     ;;
+      -PKG )         PKG="YES"
+                     ;;
+      -h | --help )   printUsageAndExit
+                     ;;
+      * )            DIR=$1
+                     TARGET_DIRS_FOUND=`expr $TARGET_DIRS_FOUND + 1`
+    esac
+shift
+done
+
+if [ "$MODE" != "FDD" ] && [ "$MODE" != "TDD" ]
+then
+  echo "Invalid mode specified $MODE"
+  printUsageAndExit
+fi
+
+SRC_PATH=$DIR/src
+BIN_PATH=$DIR/bin
+
+echo $PWD $SRC_PATH $BIN_PATH
+
+#******************************************* Implemented Local Build Functionalities ******************************************
+BLD_PATH=$SRC_PATH/../build/
+BuildFileResult=$BLD_PATH/targetbuild.txt
+rm -f $BuildFileResult
+echo $MODE > $BuildFileResult
+#*******************************************************************************************************************************
+
+#Remvoing unwanted files from the package 
+find $SRC_PATH -name  "*.tmp"  -exec rm -f {} \;
+find $SRC_PATH -name  "*.keep"  -exec rm -f {} \;
+find $SRC_PATH -name  "*.contrib"  -exec rm -f {} \;
+find $SRC_PATH -name  "*.contrib.1"  -exec rm -f {} \;
+find $SRC_PATH -name  "*.contrib.2"  -exec rm -f {} \;
+