Add glibc support(default)

Change-Id: I7675edcf14df8707ecd424a962e4cc464a4c6ae4
diff --git a/build.sh b/build.sh
index 8e42da0..f730e53 100755
--- a/build.sh
+++ b/build.sh
@@ -10,9 +10,6 @@
 export BUILD_LIB_TYPE=shared
 # gcc-4.9 / gcc-8.4
 
-# glibc / musl
-export BUILD_STD_LIBC=musl
-
 ROOT_DIR=`pwd`
 
 cd ..
@@ -24,8 +21,19 @@
 fi
 
 export BUILD_BRANCH=`git branch | grep "*" | cut -d " " -f 2`
-BUILD_PROJECT_TEMP=`cat build_version | grep PROJECT | cut -d '=' -f 2`
-echo "BUILD_PROJECT_TEMP=$BUILD_PROJECT_TEMP"
+cd $ROOT_DIR
+
+BUILD_PROJECT_TEMP=`cat config | grep CONFIG_PROJECT | cut -d '=' -f 2`
+if [ "$BUILD_PROJECT_TEMP" == "DEFAULT" ];then
+	BUILD_PROJECT_TEMP=`cat ../build_version | grep PROJECT | cut -d '=' -f 2`
+fi
+
+BUILD_LIBC_TEMP=`cat config | grep CONFIG_MBTK_LIBC | cut -d '=' -f 2`
+if [ "$BUILD_LIBC_TEMP" == "musl" ];then
+	export BUILD_STD_LIBC=musl
+else
+	export BUILD_STD_LIBC=glibc
+fi
 
 if [ "$BUILD_PLATFORM" == "master" ];then
 	if [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L509" ];then
@@ -57,11 +65,32 @@
 	fi
 fi
 
-cd $ROOT_DIR
+export MBTK_AF_SUPPORT=`cat config | grep CONFIG_AF_SUPPORT | cut -d '=' -f 2`
+export MBTK_YX_SUPPORT=`cat config | grep CONFIG_YX_SUPPORT | cut -d '=' -f 2`
+export MBTK_SG_SUPPORT=`cat config | grep CONFIG_SG_SUPPORT | cut -d '=' -f 2`
+export MBTK_ALL_CID_SUPPORT=`cat config | grep CONFIG_MBTK_ALL_CID_SUPPORT | cut -d '=' -f 2`
+export MBTK_GNSS_MODE=`cat config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2`
+export MBTK_DUMP_SUPPORT=`cat config | grep CONFIG_MBTK_DUMP_SUPPORT | cut -d '=' -f 2`
+
+# 赛格默认打开 ALL_CID_SUPPORT 
+if [ "$MBTK_SG_SUPPORT" == "y" ];then
+	export MBTK_ALL_CID_SUPPORT=y
+	export BUILD_STD_LIBC=musl
+fi
+
+# 安付默认打开 ALL_CID_SUPPORT 
+if [ "$MBTK_AF_SUPPORT" == "y" ];then
+	export BUILD_STD_LIBC=musl
+fi
+
+
+# musl 不支持mbtk dump
+if [ "$BUILD_STD_LIBC" == "musl" ];then
+	export MBTK_DUMP_SUPPORT=n
+fi
 
 export STAGING_DIR=
 
-
 #TOOLCHAIN_DIR=$ROOT_DIR/toolchain/$BUILD_PLATFORM
 #echo "toolchain : $ROOT_DIR"
 
@@ -135,6 +164,12 @@
 	[ -f out/bin/mbtk_gnssd ] && cp -f out/bin/mbtk_gnssd $1/bin
 	[ -f out/bin/mbtk_version ] && cp -f out/bin/mbtk_version $1/bin
 	[ -f out/bin/mbtk_servicesd ] && cp -f out/bin/mbtk_servicesd $1/bin
+	[ -f out/bin/aboot-tiny ] && cp -f out/bin/aboot-tiny $1/bin
+	
+	
+	# Copy GNSS(5311) bin files.
+	[ -f mbtk/aboot-tiny/files/release/jacana_fw.bin ] && cp -f mbtk/aboot-tiny/files/release/jacana_fw.bin $1/etc
+	[ -f mbtk/aboot-tiny/files/config/jacana_pvt.bin ] && cp -f mbtk/aboot-tiny/files/config/jacana_pvt.bin $1/etc
 }
 
 function file_copy()
@@ -187,6 +222,18 @@
 	fi
 }
 
+function print_arg()
+{
+	echo BUILD_PROJECT=$BUILD_PROJECT
+	echo BUILD_STD_LIBC=$BUILD_STD_LIBC
+	echo MBTK_GNSS_MODE=$MBTK_GNSS_MODE
+	echo MBTK_AF_SUPPORT=$MBTK_AF_SUPPORT
+	echo MBTK_YX_SUPPORT=$MBTK_YX_SUPPORT
+	echo MBTK_SG_SUPPORT=$MBTK_SG_SUPPORT
+	echo MBTK_ALL_CID_SUPPORT=$MBTK_ALL_CID_SUPPORT
+	echo MBTK_DUMP_SUPPORT=$MBTK_DUMP_SUPPORT
+}
+
 function main()
 {
 	if [ -n "$1" ] ;then
@@ -196,6 +243,8 @@
 
 	if [ -d out/bin -a -d out/lib ];then
 		build
+		
+		print_arg
 
 		file_copy
 	else
@@ -208,6 +257,8 @@
 		fi
 
 		build
+		
+		print_arg
 
 		file_copy
 	fi
@@ -215,4 +266,7 @@
 	temp_mbtk_copy
 }
 
-main $1
\ No newline at end of file
+# exit 1
+print_arg
+
+main $1