Skip to content

Native MacOS hello world#10309

Merged
thebentern merged 6 commits into
developfrom
macos
Apr 27, 2026
Merged

Native MacOS hello world#10309
thebentern merged 6 commits into
developfrom
macos

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

Only in simulator mode for now, but it does compile and run

@thebentern thebentern requested review from Copilot and vidplace7 April 26, 2026 12:10
@github-actions github-actions Bot added needs-review Needs human review enhancement New feature or request labels Apr 26, 2026
@thebentern thebentern added the hardware-support Hardware related: new devices or modules, problems specific to hardware label Apr 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new PlatformIO environment to build and run the Portduino-native meshtasticd on macOS (Darwin), primarily for simulator (-s) workflows, with a set of compatibility tweaks to avoid Linux-only headers/APIs and Clang-specific compile issues.

Changes:

  • Introduces a native-macos PlatformIO env and refactors shared vs Linux-only Portduino build flags.
  • Gates Linux-only input/Bluetooth/GPIO codepaths and switches Portduino RNG to arc4random_buf() on non-Linux hosts.
  • Makes small portability fixes (header includes, type aliases, enum sentinel handling) to compile under Apple Clang.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
variants/native/portduino/platformio.ini Adds env:native-macos with macOS-specific build flags/src filters and lib ignores
variants/native/portduino.ini Pins updated platform-native and splits build flags into common vs Linux-only
src/platform/portduino/USBHal.h Portability include + namespace-qualified strncpy usage
src/platform/portduino/PortduinoGlue.cpp Wraps Linux-only includes and MAC derivation via BlueZ with PORTDUINO_LINUX_HARDWARE guards
src/mqtt/MQTT.cpp Switches IPAddress include form for compatibility
src/mesh/RadioLibInterface.h Replaces ulong with unsigned long in receiveDetected signature
src/mesh/RadioLibInterface.cpp Matches receiveDetected signature change
src/mesh/MeshRadio.h Changes modem-preset sentinel to static const to avoid invalid constexpr on newer Clang
src/mesh/HardwareRNG.cpp Uses getrandom() on Linux, arc4random_buf() on Darwin/BSD for Portduino RNG
src/input/LinuxInputImpl.h Restricts evdev implementation to Linux Portduino builds
src/input/LinuxInput.h Restricts evdev input to Linux Portduino builds and documents why
src/input/InputBroker.cpp Only instantiates LinuxInputImpl on Linux hosts
src/RedirectablePrint.h Adjusts Print.h include style for portability
src/Power.cpp Only de-inits Linux input implementation on Linux during Portduino reboot
bin/build-native.sh Names release artifact by OS + arch (e.g., meshtasticd_darwin_arm64)

Comment thread src/platform/portduino/USBHal.h
Comment thread variants/native/portduino/platformio.ini Outdated
Comment thread variants/native/portduino/platformio.ini
Comment thread src/platform/portduino/PortduinoGlue.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@jp-bennett jp-bennett left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not break Linux builds, so looks good to me!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@thebentern thebentern merged commit 06a6c3e into develop Apr 27, 2026
66 checks passed
thebentern added a commit that referenced this pull request Apr 27, 2026
* Native MacOS hello world

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update variants/native/portduino/platformio.ini

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: ensure null-termination in getSerialString() and handle len==0

Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212

Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>

---------

Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
mariotti pushed a commit to mariotti/firmware that referenced this pull request May 6, 2026
* Native MacOS hello world

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update variants/native/portduino/platformio.ini

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: ensure null-termination in getSerialString() and handle len==0

Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212

Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>

---------

Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@caveman99 caveman99 deleted the macos branch June 7, 2026 20:56
Evil8it pushed a commit to Evil8it/ME4TACTNK that referenced this pull request Jun 10, 2026
* Native MacOS hello world

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update variants/native/portduino/platformio.ini

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: ensure null-termination in getSerialString() and handle len==0

Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/e5647919-2255-48ad-bcaa-7a2c2fdbf212

Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>

---------

Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request hardware-support Hardware related: new devices or modules, problems specific to hardware needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants