From 2f0e72df6578d0b5323a17dbd107d21cddde2838 Mon Sep 17 00:00:00 2001 From: simbit18 <101105604+simbit18@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:52:10 +0100 Subject: [PATCH] tools/ci/platforms/darwin.sh: Port NuttX CI Job to macOS-14 also runs old CI Job macOS-13 --- tools/ci/platforms/darwin.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index b300d94b2f102..a435d39d0e02d 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -31,6 +31,7 @@ set -e set -o xtrace +osarch=$(uname -m) add_path() { PATH=$1:${PATH} @@ -80,16 +81,29 @@ avr_gcc_toolchain() { command avr-gcc --version } +autoconf_brew() { + if ! type autoconf > /dev/null 2>&1; then + brew install autoconf + fi + + command autoconf --version +} + binutils() { - mkdir -p "${NUTTXTOOLS}"/bintools/bin add_path "${NUTTXTOOLS}"/bintools/bin if ! type objcopy > /dev/null 2>&1; then brew install binutils + mkdir -p "${NUTTXTOOLS}"/bintools/bin # It is possible we cached prebuilt but did brew install so recreate # symlink if it exists - rm -f "${NUTTXTOOLS}"/bintools/bin/objcopy - ln -s /usr/local/opt/binutils/bin/objcopy "${NUTTXTOOLS}"/bintools/bin/objcopy + if [ "X$osarch" == "Xarm64" ]; then + rm -f "${NUTTXTOOLS}"/bintools/bin/objcopy + ln -s /opt/homebrew/opt/binutils/bin/objcopy "${NUTTXTOOLS}"/bintools/bin/objcopy + else + rm -f "${NUTTXTOOLS}"/bintools/bin/objcopy + ln -s /usr/local/opt/binutils/bin/objcopy "${NUTTXTOOLS}"/bintools/bin/objcopy + fi fi command objcopy --version @@ -105,7 +119,7 @@ bloaty() { # https://github.com/google/bloaty/pull/326 git checkout 52948c107c8f81045e7f9223ec02706b19cfa882 mkdir -p "${NUTTXTOOLS}"/bloaty - cmake -B build/bloaty -D BLOATY_PREFER_SYSTEM_CAPSTONE=NO -D CMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty + cmake -B build/bloaty -GNinja -D BLOATY_PREFER_SYSTEM_CAPSTONE=NO -D CMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty cmake --build build/bloaty cmake --build build/bloaty --target install cd "${NUTTXTOOLS}" @@ -205,7 +219,11 @@ python_tools() { echo "export PIP_USER=yes" >> "${NUTTXTOOLS}"/env.sh echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin - + + if [ "X$osarch" == "Xarm64" ]; then + python3 -m venv --system-site-packages /opt/homebrew + fi + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" @@ -361,7 +379,7 @@ install_build_tools() { mkdir -p "${NUTTXTOOLS}" echo "#!/usr/bin/env sh" > "${NUTTXTOOLS}"/env.sh - install="arm_gcc_toolchain arm64_gcc_toolchain avr_gcc_toolchain binutils bloaty elf_toolchain gen_romfs gperf kconfig_frontends mips_gcc_toolchain ninja_brew python_tools riscv_gcc_toolchain rust dlang zig xtensa_esp32_gcc_toolchain u_boot_tools util_linux wasi_sdk c_cache" + install="ninja_brew autoconf_brew arm_gcc_toolchain arm64_gcc_toolchain avr_gcc_toolchain binutils bloaty elf_toolchain gen_romfs gperf kconfig_frontends mips_gcc_toolchain python_tools riscv_gcc_toolchain rust dlang zig xtensa_esp32_gcc_toolchain u_boot_tools util_linux wasi_sdk c_cache" mkdir -p "${NUTTXTOOLS}"/homebrew export HOMEBREW_CACHE=${NUTTXTOOLS}/homebrew