#!/bin/bash SCRIPT_PATH=$(dirname `which $0`) SOURCE_PATH=`pwd` PROFILE= ROOTSTRAP_URL="http://10.113.136.32/download_trbs/public_mirror/tizen/unified/latest/builddata/private-sdk-rootstrap/" SERVER_USERNAME= SERVER_PASSWORD= CERT_GIT="https://git.tizen.org/cgit/tizen/hash-signer.git -b tizen" CERT_AUTHOR=${ABS_AUTHOR_CERT_FILE} CERT_AUTHOR_PASS=${ABS_AUTHOR_CERT_PASS} CERT_DIST=${ABS_DISTRIBUTOR_CERT_FILE} CERT_DIST_PASS=${ABS_DISTRIBUTOR_CERT_PASS} COMPILER="llvm" BUILD_MODE="Release" SDK_PATH="/home/build/tizen-studio" META_DIR=".abs_meta" TOOL_GIT="https://git.tizen.org/cgit/sdk/tools/sdk-build.git -b tizen" ROOTSTRAP_DIR="${META_DIR}/rootstraps" TOOL_DIR="$(dirname $SDK_PATH)/sdk-build" CERT_DIR="$(dirname $SDK_PATH)/hash-signer" PLATFORM_TYPE="" DEVICE_PROFILE="" TARGET_ARCH="" while [[ $# -gt 0 ]] do key="$1" case $key in -s|--sourcepath) SOURCE_PATH="$2" shift shift ;; -p|--profile) PROFILE="$2" shift shift ;; -u|--rootstrapurl) ROOTSTRAP_URL="$2" shift shift ;; -c|--certgit) CERT_GIT="$2" shift shift ;; -a|--certauthor) CERT_AUTHOR="$2" shift shift ;; -b|--certauthorpass) CERT_AUTHOR_PASS="$2" shift shift ;; -d|--certdist) CERT_DIST="$2" shift shift ;; -e|--certdistpass) CERT_DIST_PASS="$2" shift shift ;; -c|--compiler) COMPILER="$2" shift shift ;; -m|--conf) BUILD_MODE="$2" shift shift ;; -i|--username) SERVER_USERNAME="$2" shift shift ;; -w|--password) SERVER_PASSWORD="$2" shift shift ;; -k|--sdkpath) SDK_PATH="$2" shift shift ;; -t|--platformtype) PLATFORM_TYPE="$2" shift shift ;; -v|--deviceprofile) DEVICE_PROFILE="$2" shift shift ;; -h|--targetarch) TARGET_ARCH="$2" shift shift ;; --default) shift ;; *) shift ;; esac done # Get profile if not specified if [ -z ${PROFILE} ]; then if [ ! -z ${PLATFORM_TYPE} ] && [ ${PLATFORM_TYPE} == "flutter" ]; then PROFILE=`${SCRIPT_PATH}/utils/find_attribute_from_property_flutter ${SOURCE_PATH} profile` else PROFILE=`${SCRIPT_PATH}/utils/find_attribute_from_property ${SOURCE_PATH} profile` fi fi # Inject tidlc path TIDLC_PATH=`sed -n '/tidl/p' /home/build/.bashrc | cut -f2 -d':'` if [ ! -z ${TIDLC_PATH} ]; then echo "PATH=\$PATH:${TIDLC_PATH}" >> /home/build/.profile; export PATH="$PATH:${TIDLC_PATH}" fi # Prepare Tizen Studio tools for installing rootstraps if [ ! -d ${TOOL_DIR} ]; then git clone ${TOOL_GIT} ${TOOL_DIR} > /dev/null 2>&1 fi # Prepare Certificates if [ ! -d ${CERT_DIR} ]; then git clone ${CERT_GIT} ${CERT_DIR} > /dev/null 2>&1 fi if [ ! "${ROOTSTRAP_URL}" = "SKIP" ]; then # Find candidate rootstraps candidate=`${SCRIPT_PATH}/utils/find_latest_rootstrap ${ROOTSTRAP_URL} ${SERVER_USERNAME} ${SERVER_PASSWORD}` echo "CANDIDATE ROOTSTRAP URL: ${candidate}" # Download rootstraps rm -rf ${ROOTSTRAP_DIR} || true mkdir ${ROOTSTRAP_DIR} || true if [ ! -z ${SERVER_USERNAME} ] && [ ! -z ${SERVER_PASSWORD} ]; then wget --user ${SERVER_USERNAME} --password ${SERVER_PASSWORD} -q -r -nH --no-parent --reject index.htm* ${candidate} --directory-prefix=${ROOTSTRAP_DIR} --cut-dirs=100 else wget -q -r -nH --no-parent --reject index.htm* ${candidate} --directory-prefix=${ROOTSTRAP_DIR} --cut-dirs=100 fi # Install rootstraps # FIXME: flutter _RS_PREFIX=${PROFILE} if [ "${PLATFORM_TYPE}" = "flutter" ] && [ ${PROFILE} = "common" ]; then _RS_PREFIX="tizeniot" fi for x in `ls ${ROOTSTRAP_DIR}/${_RS_PREFIX}*.zip`; do echo "Installing rootstrap ${x}" ${TOOL_DIR}/pkg-cli install-file -P ${x} -l ${SDK_PATH} --force > /dev/null 2>&1 done # Register security profiles #${SDK_PATH}/tools/ide/bin/tizen security-profiles remove --name ABS || true #${SDK_PATH}/tools/ide/bin/tizen security-profiles add --name ABS \ # --author ${CERT_DIR}/certificates/${CERT_AUTHOR} --password ${CERT_AUTHOR_PASS} \ # --dist ${CERT_DIR}/certificates/${CERT_DIST} --dist-password ${CERT_DIST_PASS} fi echo ${PLATFORM_TYPE} if [ ! -z ${PLATFORM_TYPE} ] && [ ${PLATFORM_TYPE} == "flutter" ]; then bash ${META_DIR}/build-flutter ${SOURCE_PATH} ${TARGET_ARCH} ${DEVICE_PROFILE} ${BUILD_MODE} exit 0 fi #FIXME: remove hard-coded expression if [ "${PROFILE}" = "da-hfp" ]; then rs_list=`sudo su - build -c "${SDK_PATH}/tools/ide/bin/tizen list rootstrap | grep ${PROFILE}-.*device.core.private.* | cut -d ' ' -f 1"` else rs_list=`sudo su - build -c "${SDK_PATH}/tools/ide/bin/tizen list rootstrap | grep ${PROFILE}-.*.core.private.* | cut -d ' ' -f 1"` fi #FIXME: Use previous efl-tool before official SDK release top_platform=$(ls ${SDK_PATH}/platforms/ | sort -r | head -n1) for pfm in $(ls ${SDK_PATH}/platforms/ | sort -r); do if [[ -d ${SDK_PATH}/platforms/${pfm}/common/efl-tool ]]; then if [ "${top_platform}" = "${pfm}" ]; then echo "OK. We have efl-tool" else echo "Try link efl-tool from ${pfm}" mkdir -p ${SDK_PATH}/platforms/${top_platform}/common/ || true ln -s ${SDK_PATH}/platforms/${pfm}/common/efl-tool ${SDK_PATH}/platforms/${top_platform}/common/efl-tool || true ln -s ${SDK_PATH}/platforms/${pfm}/common/tidl ${SDK_PATH}/platforms/${top_platform}/common/tidl || true fi break fi done # Build with every rootstraps for rs in ${rs_list}; do if [[ ${rs} == *".core.private"* ]]; then ${META_DIR}/abs build --sdkpath ${SDK_PATH} -r ${rs} -w ${SOURCE_PATH} -s ABS -c Release --profile-to-search ${PROFILE} --compiler ${COMPILER} --conf ${BUILD_MODE} -j 4; if [ $? -ne 0 ]; then exit 1; fi fi done