Tools: Update macos dependencies (#25361)

* tools: macos.sh update cross-compiler

* tools: editor styleguide for bash scripts

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche 2025-08-04 19:15:30 -07:00 committed by GitHub
parent 50fce15a75
commit e021a1c946
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 14 deletions

View File

@ -12,3 +12,11 @@ max_line_length = 120
[*.yaml, *.yml] [*.yaml, *.yml]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[*.sh]
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
# Not in the official standard, but supported by many editors
max_line_length = 80

View File

@ -36,11 +36,6 @@ jobs:
- name: setup - name: setup
run: | run: |
./Tools/setup/macos.sh ./Tools/setup/macos.sh
./Tools/setup/macos.sh
brew unlink gcc-arm-none-eabi
brew tap osx-cross/arm
brew install arm-gcc-bin@13
brew link --force arm-gcc-bin@13
- name: Prepare ccache timestamp - name: Prepare ccache timestamp
id: ccache_cache_timestamp id: ccache_cache_timestamp

View File

@ -1,5 +1,18 @@
#! /usr/bin/env bash #! /usr/bin/env bash
## Basch script to setup the PX4 development environment on macOS
## Works for Intel and Arm based Apple hardware
##
## Installs:
## - Common dependencies and tools for building PX4
## - Cross compilers for building hardware targets using NuttX
## - Can also install the default simulation provided by the px4-sim homebrew
## Formula
##
## For more information regarding the Homebrew Formulas see:
## https://github.com/PX4/homebrew-px4/
##
# script directory # script directory
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
@ -18,37 +31,43 @@ do
fi fi
done done
echo "[macos.sh] Installing the development dependencies for the PX4 Autopilot"
if ! command -v brew &> /dev/null if ! command -v brew &> /dev/null
then then
# install Homebrew if not installed yet # install Homebrew if not installed yet
echo "[macos.sh] Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi fi
# Install px4-dev formula # Install px4-dev formula
if [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then if [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
echo "Re-installing PX4 general dependencies (homebrew px4-dev)" echo "[macos.sh] Re-installing dependencies (homebrew px4-dev)"
# confirm Homebrew installed correctly # confirm Homebrew installed correctly
brew doctor brew doctor
brew tap osx-cross/arm
brew tap PX4/px4 brew tap PX4/px4
brew reinstall px4-dev brew reinstall px4-dev
brew install ncurses brew link --overwrite --force arm-gcc-bin@13
brew install python-tk
else else
if brew ls --versions px4-dev > /dev/null; then if brew ls --versions px4-dev > /dev/null; then
echo "px4-dev already installed" echo "[macos.sh] px4-dev already installed"
else else
echo "Installing PX4 general dependencies (homebrew px4-dev)" echo "[macos.sh] Installing general dependencies (homebrew px4-dev)"
brew tap osx-cross/arm
brew tap PX4/px4 brew tap PX4/px4
brew install px4-dev brew install px4-dev
brew install ncurses brew link --overwrite --force arm-gcc-bin@13
brew install python-tk
fi fi
fi fi
# Python dependencies # Python dependencies
echo "Installing PX4 Python3 dependencies" echo "[macos.sh] Installing Python3 dependencies"
# We need to have future to install pymavlink later. # We need to have future to install pymavlink later.
python3 -m pip install future python3 -m pip install future
python3 -m pip install --user -r ${DIR}/requirements.txt python3 -m pip install --user -r ${DIR}/requirements.txt
@ -62,4 +81,4 @@ if [[ $INSTALL_SIM == "--sim-tools" ]]; then
fi fi
fi fi
echo "All set! PX4 toolchain installed!" echo "[macos.sh] All set! The PX4 Autopilot toolchain was installed."