Skip to content

stm32CubeProg.sh: missing MacPorts getopt support #115

Description

@rodprice
  • OS: macOS Tahoe

  • Arduino IDE version: 2.3.10

  • Upload method: SWD

  • Board Name: SMT32F1 BluePill

STM32Tools version: 2.4.0
OS: macOS [your version, e.g. Sequoia 15.x]
Arduino IDE version: [yours]
Package manager: MacPorts

Problem 1: GNU getopt detection doesn't include MacPorts path

The script checks for GNU getopt only at Homebrew paths:

  • /usr/local/opt/gnu-getopt/bin/getopt
  • /opt/homebrew/opt/gnu-getopt/bin/getopt

MacPorts installs GNU getopt at /opt/local/bin/getopt, which is not
checked. When neither Homebrew path exists, GNU_GETOPT is set to n
even if a valid GNU getopt is available.

Fix: add a MacPorts check before falling back to n:

elif command -v /opt/local/bin/getopt >/dev/null 2>&1; then
    export PATH="/opt/local/bin:$PATH"

Problem 2: Missing short options in getopt option string

Arduino passes -a, -m, and -s to the script but the getopt option
string hi:ef:o:c:r:d:v:p: doesn't include them. Fix: add a:m:s:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions