Download this file
| 1 | #!/usr/bin/env bash |
| 2 | # The C compiler Spinel calls for an arm64 build (see spinel-cross). |
| 3 | # Rewrites the host Spinel's runtime paths to the arm64 Spinel's, copies |
| 4 | # the generated C into the work directory (which the arm64 root can see), |
| 5 | # and runs a static link with the arm64 root's gcc and glibc. |
| 6 | set -euo pipefail |
| 7 | here=$(cd "$(dirname "$0")" && pwd) |
| 8 | repo=$(cd "$here/../../.." && pwd) |
| 9 | host_lib="$(dirname "${SPINEL_HOST:?}")/../lib" |
| 10 | arm_lib="$(dirname "${SPINEL_ARM64:?}")/../lib" |
| 11 | work=${ARM64_WORK:?} |
| 12 | mkdir -p "$work" |
| 13 | args=() |
| 14 | for a in "$@"; do |
| 15 | case "$a" in |
| 16 | *"$host_lib"*) a="${a//"$host_lib"/"$arm_lib"}" ;; |
| 17 | */spinel_out_*.c) cp "$a" "$work/app.c"; a="$work/app.c" ;; |
| 18 | esac |
| 19 | args+=("$a") |
| 20 | done |
| 21 | exec "$repo/scripts/arm64.sh" cc -static -s -L"${ARM64_LIB_DIR:?}" "${args[@]}" -lz -lzstd |
| 22 | |