improvements to spinner

This commit is contained in:
2025-12-18 13:24:58 -06:00
parent ad5b8e4482
commit 65fb35877e
5 changed files with 46 additions and 18 deletions

5
Jenkinsfile vendored
View File

@@ -13,7 +13,10 @@ def withDockerCreds(body) {
pipeline { pipeline {
agent none agent none
environment { DEBUG = "1" } environment {
DEBUG = "1"
HEADLESS = "1"
}
options { buildDiscarder logRotator(numToKeepStr: '4') } options { buildDiscarder logRotator(numToKeepStr: '4') }
stages { stages {
stage('build docker image') { stage('build docker image') {

View File

@@ -510,17 +510,10 @@ do_build() {
echo_info -n "building ${build} " echo_info -n "building ${build} "
# build in background # build in background
local timeBefore=${EPOCHSECONDS} local timeBefore=${EPOCHSECONDS}
LOGNAME="${build}" echo_if_fail "build_${build}" & spinner start
local buildPid=$! LOGNAME="${build}" echo_if_fail "build_${build}"
# start spinner
spinner &
local spinPid=$!
# get build return code
wait ${buildPid}
local retval=$? local retval=$?
# stop spinner spinner stop
kill ${spinPid}
spinner reset
popd >/dev/null || return 1 popd >/dev/null || return 1
test ${retval} -eq 0 || return ${retval} test ${retval} -eq 0 || return ${retval}
@@ -693,6 +686,7 @@ build_cpuinfo() {
-DCPUINFO_BUILD_UNIT_TESTS=OFF \ -DCPUINFO_BUILD_UNIT_TESTS=OFF \
-DCPUINFO_BUILD_MOCK_TESTS=OFF \ -DCPUINFO_BUILD_MOCK_TESTS=OFF \
-DCPUINFO_BUILD_BENCHMARKS=OFF \ -DCPUINFO_BUILD_BENCHMARKS=OFF \
-DCPUINFO_LOG_TO_STDIO=ON \
-DUSE_SYSTEM_LIBS=ON || return 1 -DUSE_SYSTEM_LIBS=ON || return 1
sanitize_sysroot_libs libcpuinfo || return 1 sanitize_sysroot_libs libcpuinfo || return 1
} }
@@ -727,6 +721,12 @@ build_libopus() {
} }
build_libwebp() { build_libwebp() {
if is_android; then
replace_line CMakeLists.txt \
"if(ANDROID)" \
"if(FALSE)\n"
fi
meta_cmake_build || return 1 meta_cmake_build || return 1
sanitize_sysroot_libs libwebp libsharpyuv || return 1 sanitize_sysroot_libs libwebp libsharpyuv || return 1
} }
@@ -916,7 +916,7 @@ build_libx264() {
build_libmp3lame() { build_libmp3lame() {
# https://sourceforge.net/p/lame/mailman/message/36081038/ # https://sourceforge.net/p/lame/mailman/message/36081038/
if is_darwin; then if is_darwin || is_android; then
remove_line \ remove_line \
'include/libmp3lame.sym' \ 'include/libmp3lame.sym' \
'lame_init_old' || return 1 'lame_init_old' || return 1

View File

@@ -20,6 +20,7 @@ set_docker_run_flags() {
-v "${REPO_DIR}:${REPO_DIR}" -v "${REPO_DIR}:${REPO_DIR}"
-w "${REPO_DIR}" -w "${REPO_DIR}"
-e "DEBUG=${DEBUG}" -e "DEBUG=${DEBUG}"
-e "HEADLESS=${HEADLESS}"
) )
for opt in "${FB_COMP_OPTS[@]}"; do for opt in "${FB_COMP_OPTS[@]}"; do
declare -n defOptVal="DEFAULT_${opt}" declare -n defOptVal="DEFAULT_${opt}"

View File

@@ -91,6 +91,10 @@ print_req_pkgs() {
git gnuplot bison rsync ragel git gnuplot bison rsync ragel
zip unzip gperf build-essential zip unzip gperf build-essential
binutils ninja ndk-multilib-native-static binutils ninja ndk-multilib-native-static
libandroid-posix-semaphore
libandroid-posix-semaphore-static
libandroid-shmem
libandroid-shmem-static
) )
# shellcheck disable=SC2034 # shellcheck disable=SC2034
local msys_ucrt_pkgs=( local msys_ucrt_pkgs=(

View File

@@ -324,18 +324,16 @@ bash_sort() {
printf '%s\n' "${arr[@]}" printf '%s\n' "${arr[@]}"
} }
spinner() { _start_spinner() {
if [[ $1 == 'reset' ]]; then
echo -ne ' \n'
return 0
fi
local spinChars=( local spinChars=(
"-" "-"
'\' '\'
"|" "|"
"/" "/"
) )
sleep 1
while true; do while true; do
for ((ind = 0; ind < "${#spinChars[@]}"; ind++)); do for ((ind = 0; ind < "${#spinChars[@]}"; ind++)); do
echo -ne "${spinChars[${ind}]}" '\b\b' echo -ne "${spinChars[${ind}]}" '\b\b'
@@ -344,6 +342,28 @@ spinner() {
done done
} }
spinner() {
local action="$1"
local spinPidFile="${TMP_DIR}/.spinner-pid"
case "${action}" in
start)
test -f "${spinPidFile}" &&
rm "${spinPidFile}"
# don't want to clutter logs if running headless
test "${HEADLESS}" == '1' &&
return
_start_spinner &
echo $! >"${spinPidFile}"
;;
stop)
test -f "${spinPidFile}" && kill "$(<"${spinPidFile}")"
echo -ne ' \n'
;;
esac
}
get_pkgconfig_version() { get_pkgconfig_version() {
local pkg="$1" local pkg="$1"
pkg-config --modversion "${pkg}" pkg-config --modversion "${pkg}"