[TCT][TPK scripts][NONACR][updated scripts for different CMakefile formats]
authorShobhit Verma <shobhit.v@samsung.com>
Wed, 3 Aug 2016 13:06:17 +0000 (18:36 +0530)
committerShobhit Verma <shobhit.v@samsung.com>
Wed, 3 Aug 2016 13:06:17 +0000 (18:36 +0530)
Change-Id: Iab9cdfc83505b64990e2fbea33699bd5871b2988
Signed-off-by: Shobhit Verma <shobhit.v@samsung.com>
scripts_tpk/mobile.sed
scripts_tpk/tpk_create.sh
scripts_tpk/wearable.sed

index b0ae4df..882dc63 100755 (executable)
@@ -5,6 +5,7 @@
 #define ERR_LOG        "/tmp/tclog"\
 #define ERR_UTC_LOG    "/tmp/utclog"\
 #define DEBUG 0\
-#define MOBILE 1
+#define MOBILE 1\
+#define INTERVAL 500
 d
 }
index 981d90c..c130f56 100755 (executable)
@@ -36,6 +36,24 @@ RunCommand () {
 fi
 }
 
+copy_native_core()
+{
+       if [ "$3" == "utc" ]; then
+               if [[ $2 =~ "dali-" ]]; then
+                       cp $2/*core.cpp $1/src/.
+               else
+                       cp $2/*core.c $1/src/.
+               fi
+       else
+               if [[ $2 =~ "dali-" ]]; then
+                       cp $2/*native.cpp $1/src/.
+               else
+                       cp $2/*native.c $1/src/.
+               fi
+                               
+       fi
+}
+
 deploySourceFile() {
        rm -rf $1/src/*.c
        rm -rf $1/inc/*.h
@@ -45,6 +63,9 @@ deploySourceFile() {
        #copying common source and header files 
        cp $2/../../common/*.c $1/src/.
        cp $2/../../common/*.h $1/inc/.
+       if [[ $2 =~ "dali-" ]]; then
+               cp $2/../../common/*.cpp $1/src/.
+       fi
        
        #copying module specific header files 
        find $2 -name "*.h" | xargs cp -t $1/inc/
@@ -56,44 +77,69 @@ deploySourceFile() {
        elif [ "$3" == "wearable" ]; then
                macro="WEARABLE"
        fi
-       
-       CmakeFlag=0
+
+
        while read line
-       do    
-               if [[ $line =~ $macro ]]
-               then
-                       flag=1
-                       if [ 1 == "$flag" ]; then
+
+       #Copy c/cpp files as per entry in CMakeFile for common files
+       do      
+               if ! [[ $lastline =~ $macro ]]; then
+                       if [[ $line =~ "SET(TC_SOURCES" || $line =~ "GLOB TC_SOURCES" ]]; then  
                                while true
                                do
                                        read srcFile
                                        substring=$(echo $srcFile | tail -c 3)
                                        if [ "$substring" == ".c" ]; then
-                                               CmakeFlag=1
                                                cp $2/$srcFile $1/src/.
                                        fi
-                                       if [[ $srcFile == *"ENDIF"* ]]; then
-                                               flag=0
-                                               if [ "$5" == "utc" ]; then
-                                                       cp $2/*core.c $1/src/.
-                                               else
-                                               cp $2/*native.c $1/src/.
-                                               fi
+                                       substring=$(echo $srcFile | tail -c 5)
+                                       if [ "$substring" == ".cpp" ]; then
+                                               cp $2/$srcFile $1/src/.
+                                       fi
+
+                                       substring=$(echo $srcFile | tail -c 2)
+                                       if [ "$substring" == ")" ]; then
+                                               chCount=${#srcFile} 
+                                               chCount=$((chCount-1))
+                                               substring=$(echo $srcFile | head -c $chCount)
+                                               cp $2/$substring $1/src/.
+                                               copy_native_core $1 $2 $5
+                                               break
+                                       elif [[ $srcFile == ")" ]]; then
+                                               copy_native_core $1 $2 $5
                                                break
                                        fi
                                done 
+                       
                        fi
                fi
+               lastline=$line
        done < $2/CMakeLists.txt
-       
-       #copying module source files not having device specific macros in CMakeLists.txt
-       if [ $CmakeFlag -eq 0 ]; then
-               if [[ $2 =~ "dali-" ]]; then
-                       find $2 -name "*.cpp" | xargs cp -t $1/src/
-               else
-                       find $2 -name "*.c" | xargs cp -t $1/src/
+
+       #Copy profile specific (mobile/wearable) c/cpp files as per entry in CMakeFile
+       while read line
+       do    
+               if [[ $line =~ $macro ]]
+               then
+                       
+                       while true
+                       do
+                               read srcFile
+                               substring=$(echo $srcFile | tail -c 3)
+                               if [ "$substring" == ".c" ]; then
+                                       cp $2/$srcFile $1/src/.
+                               fi
+                               if [[ $srcFile == *"ENDIF"* ]]; then
+                                       if [ "$5" == "utc" ]; then
+                                               cp $2/*core.c $1/src/.
+                                       else
+                                               cp $2/*native.c $1/src/.
+                                       fi
+                               break
+                               fi
+                       done 
                fi
-       fi
+       done < $2/CMakeLists.txt
        
        # copying data and shared data 
        find $2/. -type f ! -iname "*.c" ! -iname "*.h" ! -iname "*.tpk"  ! -iname "CMakeLists.txt" -exec cp  {} $1/shared/res \;
@@ -107,17 +153,24 @@ deploySourceFile() {
        sed -i -f scripts_tpk/$3.sed $1/inc/tct_common.h
        
        # include tct_common.h in utc source files
-       if [ "$5" == "utc" ]; then
+       if [[ $2 =~ "dali-" ]]; then
+               for srcFile in `ls $1/src/`
+               do
+                       sed -i '1i\#include <tct_common.h>' $1/src/$srcFile
+               done
+       elif [ "$5" == "utc" ]; then
                for srcFile in `ls $1/src/ | grep -v core | grep -v common`
                do
                        sed -i '1i\#include <tct_common.h>' $1/src/$srcFile
                done
        fi
        
+       
        cd $1
        
        if [[ $2 =~ "dali-" ]]; then
                find ./src -iname *.cpp -print0 | tr '\0' ' ' > test.files
+               find ./src -iname *.c -print0 | tr '\0' ' ' >> test.files
        else
                find ./src -iname *.c -print0 | tr '\0' ' ' > test.files
        fi
index 4d2ee45..fc65281 100755 (executable)
@@ -5,6 +5,7 @@
 #define ERR_LOG        "/tmp/tclog"\
 #define ERR_UTC_LOG    "/tmp/utclog"\
 #define DEBUG 0\
-#define WEARABLE 1
+#define WEARABLE 1\
+#define INTERVAL 500
 d
 }