diff --git a/.editorconfig b/.editorconfig index 1ac25a4f58..e79eece0b4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,11 @@ max_line_length = 120 [*.yaml, *.yml] indent_style = space 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 diff --git a/.github/workflows/compile_macos.yml b/.github/workflows/compile_macos.yml index bb192687e1..6ea0e9687d 100644 --- a/.github/workflows/compile_macos.yml +++ b/.github/workflows/compile_macos.yml @@ -36,11 +36,6 @@ jobs: - name: setup run: | ./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 id: ccache_cache_timestamp diff --git a/Tools/setup/macos.sh b/Tools/setup/macos.sh index f0686ab6d4..a3457129ee 100755 --- a/Tools/setup/macos.sh +++ b/Tools/setup/macos.sh @@ -1,5 +1,18 @@ #! /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 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) @@ -18,37 +31,43 @@ do fi done +echo "[macos.sh] Installing the development dependencies for the PX4 Autopilot" + if ! command -v brew &> /dev/null then # 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)" fi # Install px4-dev formula 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 brew doctor + brew tap osx-cross/arm brew tap PX4/px4 + brew reinstall px4-dev - brew install ncurses - brew install python-tk + brew link --overwrite --force arm-gcc-bin@13 else if brew ls --versions px4-dev > /dev/null; then - echo "px4-dev already installed" + echo "[macos.sh] px4-dev already installed" 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 install px4-dev - brew install ncurses - brew install python-tk + brew link --overwrite --force arm-gcc-bin@13 fi fi # Python dependencies -echo "Installing PX4 Python3 dependencies" +echo "[macos.sh] Installing Python3 dependencies" # We need to have future to install pymavlink later. python3 -m pip install future python3 -m pip install --user -r ${DIR}/requirements.txt @@ -62,4 +81,4 @@ if [[ $INSTALL_SIM == "--sim-tools" ]]; then fi fi -echo "All set! PX4 toolchain installed!" +echo "[macos.sh] All set! The PX4 Autopilot toolchain was installed."