236 lines
4.5 KiB
Bash
236 lines
4.5 KiB
Bash
#!/bin/sh
|
|
|
|
# I have my automake
|
|
export ACLOCAL_PATH=/usr/share/aclocal
|
|
|
|
export ROKU_NFS_ROOT=$HOME/roku/nfs
|
|
export ROKU_NFS_IP=192.168.0.64
|
|
export EXPORTROOT=${ROKU_NFS_ROOT}
|
|
|
|
# This is needed to be able to set brake point on /bin/Application
|
|
export PAX_DEBUG=on
|
|
|
|
build_help()
|
|
{
|
|
cat <<EOF
|
|
platform:
|
|
bailey, marlin
|
|
icecream:
|
|
local, icecc
|
|
target:
|
|
all, addon-checksums, addon-checksum-check, clobber
|
|
EOF
|
|
}
|
|
|
|
completion_contains()
|
|
{
|
|
# Platforms
|
|
for WORD in "$@"; do
|
|
if [[ "${COMP_WORDS[*]}" =~ "$WORD" ]]; then
|
|
return 1
|
|
fi
|
|
done
|
|
return 0
|
|
}
|
|
|
|
completion_add_if()
|
|
{
|
|
completion_contains "$@"
|
|
if [[ $? == 0 ]]; then
|
|
CANDIDATES+=" $@"
|
|
fi
|
|
}
|
|
|
|
complete -F build_completion build
|
|
build_completion()
|
|
{
|
|
local CANDIDATES="help clobber tests addon-checksums"
|
|
|
|
# Docker
|
|
completion_add_if docker make
|
|
|
|
# Build hosts
|
|
completion_add_if icecc local
|
|
|
|
# Platforms
|
|
completion_add_if native marlin bailey loggan
|
|
|
|
COMPREPLY=($(compgen -W "$CANDIDATES" "${COMP_WORDS[${COMP_CWORD}]}"))
|
|
}
|
|
|
|
build()
|
|
{
|
|
local BUILD_PLATFORM=marlin
|
|
local ENABLE_ICECC=0
|
|
local JOBS=$(nproc)
|
|
local TARGET=all
|
|
local BUILD_MODE=dev
|
|
local PAX_DEBUG=on
|
|
local OPTIONS=
|
|
local DOCKER=1
|
|
|
|
local REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
if [ "$?" -ne "0" ]; then
|
|
REPO_ROOT=$(p4 -Ztag -F %clientRoot% info)
|
|
fi
|
|
local BUILD_ROOT=$REPO_ROOT/os
|
|
#echo $BUILD_ROOT
|
|
|
|
# args=$(getopt fhstuec $*)
|
|
# if [ $? -ne 0 ]; then
|
|
# usage
|
|
# fi
|
|
# set -- $args
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
tests|\
|
|
hostunittests|\
|
|
unittests)
|
|
TARGET=build-tests-all
|
|
PAX_DEBUG=off
|
|
BUILD_PLATFORM=hostunittests
|
|
;;
|
|
host|\
|
|
hoststatic|\
|
|
unity|\
|
|
native)
|
|
PAX_DEBUG=off
|
|
BUILD_PLATFORM=$1
|
|
DOCKER=1
|
|
;;
|
|
reno|\
|
|
bailey|\
|
|
marlin|\
|
|
loggan|\
|
|
madison)
|
|
BUILD_PLATFORM=$1
|
|
;;
|
|
icecc)
|
|
ENABLE_ICECC=1
|
|
JOBS=256
|
|
;;
|
|
local)
|
|
ENABLE_ICECC=0
|
|
JOBS=$(nproc)
|
|
;;
|
|
all|\
|
|
addon-checksums|\
|
|
addon-checksum-check|\
|
|
clean|\
|
|
clobber|\
|
|
build-tests-all|\
|
|
build-tests-ZipMountServerTest|\
|
|
build-tests-FuseServerTest|\
|
|
build-tests-PluginPackageManagemnetPluginUnitTests|\
|
|
clobber-all)
|
|
TARGET=$1
|
|
;;
|
|
build-integration-tests)
|
|
OPTIONS+="BUILD_INTEGRATION_TESTS=true"
|
|
;;
|
|
here)
|
|
BUILD_ROOT="."
|
|
;;
|
|
nopax)
|
|
PAX_DEBUG=off
|
|
;;
|
|
make)
|
|
DOCKER=0
|
|
;;
|
|
docker)
|
|
DOCKER=1
|
|
;;
|
|
debug)
|
|
BUILD_MODE=dbg
|
|
;;
|
|
help)
|
|
build_help
|
|
return
|
|
;;
|
|
*)
|
|
echo "Really? Do you mean that?"
|
|
return
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
|
|
if [ $DOCKER -eq 1 ]; then
|
|
$REPO_ROOT/os/scripts/docker/localcontainer/docker-u20-make \
|
|
ENABLE_ICECC=$ENABLE_ICECC \
|
|
BUILD_MODE=$BUILD_MODE \
|
|
PAX_DEBUG=$PAX_DEBUG \
|
|
BUILD_PLATFORM=$BUILD_PLATFORM \
|
|
$OPTIONS \
|
|
-j $JOBS \
|
|
-C $BUILD_ROOT $TARGET
|
|
else
|
|
make \
|
|
ENABLE_ICECC=$ENABLE_ICECC \
|
|
BUILD_MODE=$BUILD_MODE \
|
|
PAX_DEBUG=$PAX_DEBUG \
|
|
BUILD_PLATFORM=$BUILD_PLATFORM \
|
|
$OPTIONS \
|
|
-j $JOBS \
|
|
-C $BUILD_ROOT $TARGET
|
|
#make ENABLE_ICECC=1 PAX_DEBUG=on BUILD_PLATFORM=$1 -j $(nproc) -C os all
|
|
fi
|
|
}
|
|
###############################################################################
|
|
#
|
|
# Logging
|
|
#
|
|
LOGDIR="${HOME}/roku/logs"
|
|
|
|
lfile()
|
|
{
|
|
echo ${LOGDIR}/$(ls -t -1 ${LOGDIR} | head -1)
|
|
}
|
|
|
|
lless()
|
|
{
|
|
less $(lfile)
|
|
}
|
|
|
|
lcat()
|
|
{
|
|
cat $(lfile)
|
|
}
|
|
|
|
lgrep()
|
|
{
|
|
lcat | grep -a --color "$*"
|
|
}
|
|
|
|
ltail()
|
|
{
|
|
if [ $# -gt 0 ]; then
|
|
tail -f $(lfile) | grep "$*"
|
|
else
|
|
tail -f $(lfile)
|
|
fi
|
|
}
|
|
|
|
ldevice()
|
|
{
|
|
minicom "$@" -C $LOGDIR/minicom.log.$(date +%Y-%m-%d--%H-%M-%S)
|
|
}
|
|
|
|
|
|
|
|
rokuget()
|
|
{
|
|
wget --no-check-certificate --user=vkhachatryan --ask-password $1
|
|
}
|
|
|
|
###############################################################################
|
|
#
|
|
# Other helpers
|
|
#
|
|
startvnc()
|
|
{
|
|
x11vnc -safer -nopw -many --usepw --ncache 10
|
|
}
|