Files
MeowOS-For-R3P2/patch_v2/ncm_app/libs_common.sh
T

22 lines
938 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 公共编译/测量环境。被各 build_*.sh 引用。
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENDOR="$ROOT/vendor"
OUT="$ROOT/out"
CC_MIPS="/home/Aska/Project/R3ProII/.tools/zig-mipsel-cc"
AR_MIPS="/home/Aska/Project/R3ProII/.tools/zig-env/bin/zig ar"
CC_HOST="gcc"
SZ_HOST="size"
# 交叉 bin 是 x86_64 的,本机(aarch64)跑不了;统一用 host `size`(可读任意 ELF)+ zig ar。
# 注意:build 目录在 patch_v2/ncm_app 内,符号用绝对路径由各脚本自行 source 本文件。
# measure_archive <lib.a> : 统计归档全部成员 text/data/bss。flash≈text,RAM≈data+bss
measure_archive() {
local a="$1"
if [ ! -s "$a" ]; then echo " (missing/empty: $a)"; return; fi
$SZ_HOST "$a" | awk '
/^[[:space:]]*[0-9]+[[:space:]]/ { t+=$1; d+=$2; b+=$3 }
END { printf " text=%-8d data=%-8d bss=%-8d (flash~%s KB RAM~%s KB)\n", t, d, b, t/1024.0, (d+b)/1024.0 }
'
}