Profile split to multiple files.

This commit is contained in:
2023-01-05 14:43:07 +00:00
parent 8b2dd20a64
commit b2b8666da1
3 changed files with 312 additions and 189 deletions

View File

@@ -7,190 +7,6 @@ export ROKU_NFS_ROOT=$HOME/roku/nfs
export ROKU_NFS_IP=192.168.0.64 export ROKU_NFS_IP=192.168.0.64
export EXPORTROOT=${ROKU_NFS_ROOT} export EXPORTROOT=${ROKU_NFS_ROOT}
###############################################################################
#
# Build
#
# 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|\
nemo|\
rockett|\
bailey|\
marlin|\
brewster|\
benjamin|\
benjaminw|\
loggan|\
madison)
BUILD_PLATFORM=$1
;;
icecc)
ENABLE_ICECC=1
JOBS=256
;;
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)
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 # Logging
@@ -199,28 +15,33 @@ LOGDIR="${HOME}/roku/logs"
lfile() lfile()
{ {
echo ${LOGDIR}/$(ls -t -1 ${LOGDIR} | head -1) local Nth="-1"
if [ $# -gt 0 ]; then
Nth="$1"
fi
echo $(ls -tr -1 ${LOGDIR}/minicom.log.* | tail ${Nth} | head -1)
} }
lless() lless()
{ {
less $(lfile) less $(lfile "$@")
} }
lcat() lcat()
{ {
cat $(lfile) cat $(lfile "$@")
} }
lgrep() lgrep()
{ {
lcat | grep -a --color "$*" lcat | grep -a --color "$@"
} }
ltail() ltail()
{ {
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
tail -f $(lfile) | grep "$*" tail -f $(lfile) | grep "$@"
else else
tail -f $(lfile) tail -f $(lfile)
fi fi

262
.profile.roku.build Normal file
View File

@@ -0,0 +1,262 @@
#!/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 <<EOF
platform:
bailey, marlin, porting-kit-stb
icecream:
local, icecc
target:
all, addon-checksums, addon-checksum-check, clobber
EOF
}
__build_os()
{
eval $MAKE \
-C $BUILD_ROOT \
BUILD_PLATFORM=$BUILD_PLATFORM \
${BUILD_PLID:+BUILD_PLID=$BUILD_PLID} \
${PLATFORM_TYPE:+PLATFORM_TYPE=$PLATFORM_TYPE} \
ENABLE_ICECC=$ENABLE_ICECC \
PAX_DEBUG=$PAX_DEBUG \
${BUILD_MODE:+BUILD_MODE=$BUILD_MODE} \
$OPTIONS \
-j $JOBS \
$TARGET
}
__build_wdk()
{
echo test
}
__build_port()
{
eval $MAKE \
-C $BUILD_ROOT \
BUILD_PLATFORM=$BUILD_PLATFORM \
${BUILD_PLID:+BUILD_PLID=$BUILD_PLID} \
${PLATFORM_TYPE:+PLATFORM_TYPE=$PLATFORM_TYPE} \
ENABLE_ICECC=$ENABLE_ICECC \
${ROKU_OS_DIR:+ROKU_OS_DIR=$ROKU_OS_DIR} \
${ROKU_WLAN_DIR:+ROKU_WLAN_DIR=$ROKU_WLAN_DIR} \
$OPTIONS \
-j $JOBS \
$TARGET
}
build()
{
local REPO_ROKU_OS_DIR=$REPO_ROOT/os/dist/rootfs/Carbon14_dev_stb.OBJ/export/package/porting_kit/os
local REPO_DOCKER_MAKE=$REPO_ROOT/os/scripts/docker/localcontainer/docker-u20-make
local MAKE=$DOCKER_MAKE
local ROKU_OS_DIR=
local BUILD_PLATFORM=carbon
local PLATFORM_TYPE=
local ENABLE_ICECC=0
local JOBS=$(nproc)
local TARGET=all
local BUILD_MODE=dev
local PAX_DEBUG=on
local OPTIONS=
#
# Root of repository
#
local REPO_ROOT=$(git rev-parse --show-toplevel)
if [ "$?" -ne "0" ]; then
REPO_ROOT=$(p4 -Ztag -F %clientRoot% info)
fi
if [ -z "$REPO_ROOT" ] || [ ! -d "$REPO_ROOT" ]; then
echo "build: Cannot find workspace root directory." >&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}]}"))
}

40
.profile.roku.svin Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
###############################################################################
#
# Build
#
# This is needed to be able to set brake point on /bin/Application
export PAX_DEBUG=on
__svin_completion_contains()
{
# Platforms
for WORD in "$@"; do
if [[ "${COMP_WORDS[*]}" =~ "$WORD" ]]; then
return 1
fi
done
return 0
}
__svin_completion_add_if()
{
__svin_completion_contains "$@"
if [[ $? == 0 ]]; then
CANDIDATES+=" $@"
fi
}
complete -o nospace -o bashdefault -o default -F svin_completion svin
svin_completion()
{
local CANDIDATES="--help fetch init version worktree"
# Docker
# completion_add_if docker make
COMPREPLY=($(compgen -W "$CANDIDATES" "${COMP_WORDS[${COMP_CWORD}]}"))
}