#!/bin/sh export ACLOCAL_PATH=/usr/share/aclocal # This is needed to be able to set brake point on /bin/Application export PAX_DEBUG=on __build_help() { cat <&2 exit 1 fi local BUILD_ROOT=$REPO_ROOT/os # # Parse arguments # while [ $# -gt 0 ]; do case "$1" in wdk) BUILD_ROOT=$REPO_ROOT/os BUILD_PLATFORM=carbon TARGET=wdk-kit BUILD_PLID=00 if [ "$1" == "streambar"]; then PLATFORM_TYPE=WDK_STREAMBAR else PLATFORM_TYPE=WDK_STB fi ;; porting-kit|\ streambar|\ stb) BUILD_ROOT=$REPO_ROOT/os BUILD_PLATFORM=carbon TARGET=porting-kit BUILD_PLID=00 if [ "$1" == "streambar"]; then PLATFORM_TYPE=STREAMBAR else PLATFORM_TYPE=STB fi ;; tests|\ unittests) BUILD_PLATFORM=host PLATFORM_TYPE=unittests TARGET=build-tests-all PAX_DEBUG=off ;; host|\ hoststatic|\ unity|\ native) BUILD_PLATFORM=$1 PAX_DEBUG=off MAKE=$DOCKER_MAKE TARGET=all ;; reno|\ nemo|\ rockett|\ bailey|\ marlin|\ brewster|\ benjamin|\ benjaminw|\ loggan|\ madison) local ROOT_DIR="$(basename $REPO_ROOT)" if [ "$ROOT_DIR" == "stark" ] || \ [ "$ROOT_DIR" == "hank" ]; then local BUILD_ROOT="$REPO_ROOT/$1" local ROKU_OS_DIR=$REPO_ROOT/../../../os/dist/rootfs/Carbon14_dev_stb.OBJ/export/package/porting_kit/os # local ROKU_WLAN_DIR=$REPO_ROOT/common/wlan local TARGET=image else local BUILD_ROOT=$REPO_ROOT/os fi BUILD_PLATFORM=$1 ;; icecc) ENABLE_ICECC=1 JOBS=256 ;; port-only) ROKU_OS_DIR=$REPO_ROKU_OS_DIR ;; local) ENABLE_ICECC=0 JOBS=$(nproc) ;; all|\ addon-checksums|\ addon-checksum-check|\ clean|\ cleanall|\ clobber|\ build-tests-all|\ build-tests-ZipMountServerTest|\ build-tests-FuseServerTest|\ build-tests-PluginPackageManagemnetPluginUnitTests|\ make_custom_package|\ clobber-all) TARGET=$1 ;; build-integration-tests) OPTIONS+="BUILD_INTEGRATION_TESTS=true" ;; here) BUILD_ROOT="." ;; nopax) PAX_DEBUG=off ;; make) MAKE=make ;; docker) MAKE=$DOCKER_MAKE ;; debug) BUILD_MODE=dbg ;; help) build_help return ;; *) echo "Really? Do you mean that?" return ;; esac shift done # Fallback to make if docker image not found. if [ -e $MAKE ]; then local MAKE=make fi if [ "$BUILD_PLATFORM" == "carbon" ]; then __build_os elif [ "$TARGET" == "image" ]; then __build_port else __build_legacy fi } ############################################################################### # # Build Completion # __build_completion_contains() { # Platforms for WORD in "$@"; do if [[ "${COMP_WORDS[*]}" =~ "$WORD" ]]; then return 1 fi done return 0 } __build_completion_add_if() { __build_completion_contains "$@" if [[ $? == 0 ]]; then CANDIDATES+=" $@" fi } complete -F __build_completion build __build_completion() { local CANDIDATES="help clobber tests addon-checksums" # Docker __build_completion_add_if docker make # Build hosts __build_completion_add_if icecc local # Port dir __build_completion_add_if port-only # Platforms __build_completion_add_if native marlin bailey loggan lockhart porting-kit streambar stb COMPREPLY=($(compgen -W "$CANDIDATES" "${COMP_WORDS[${COMP_CWORD}]}")) }