Support for netbsd_amd64?

pkgsrc maintainers have asked me to add platformio to pkgsrc but I think it would be best to start from scratch instead of downloading pio cli and then trying to adapt it but not including the supported boards, etc. What would be the best place to start? It would be good to make it usable on more than just netbsd-amd64 since pkgsrc is designed to be used on a host of platforms. Thanks

pkgsrc has mechanisms built in to deal with many of these issues plus I can get more eyes on the problems. Thanks

Your plan is to create something that builds all the toolchains and tools from source for the target platform?

For some closed-sourced tools or older toolchains like avr-gcc variants used by Arduino this might not be feasable.

pkgsrc is absolutely entirely not closed source. https://www.pkgsrc.org/ "pkgsrc is a framework for managing third-party software on UNIX-like systems, currently containing over 26,000 packages. It is the default package manager for NetBSD and SmartOS, and can be used to enable freely available software to be built easily on a large number of other UNIX-like platforms. The binary packages that are produced by pkgsrc can be used without having to compile anything from source. It can be easily used to complement the software on an existing system.

pkgsrc is very versatile and configurable, supporting building packages for an arbitrary installation prefix, allowing multiple branches to coexist on one machine, a build options framework, and a compiler transformation framework, among other advanced features. Unprivileged use and installation is also supported.

NetBSD already contains the necessary tools for using pkgsrc; on other platforms you need to bootstrap pkgsrc to get the package management tools installed."

II have been using pkgsrc since 1998 and I believe it is the first open package system out there and handles more platforms and OSes than any other package system.

Pkgsrc is typically built from sources on the host machines that people use, though binaries are also available for selected platforms. It runs on all of the *BSD OSes, Linux, MacOS, Windows and
many more. If platform IO is dropped into pkgsrc and is maintained with help or by pkgsrc maintainers, it would be available for almost any OS platform you wish it to be used on.

I used to build pkgsrc binaries for MacOS, Windows, Solaris, FreeBSD and NetBSD for use by many laboratories at prominent research institutes where I worked before retirement.

This could be restricted to toolchains that are not closed-source. I personally don’t want to use closed-source tools. Each package can have its own license restrictions. Users have to agree to the license agreements in order to build or use the packages.

PlatformIO could be divided into smaller packages, each for a specific purpose and then bound together using a meta-package. See meta-pkgs - The NetBSD Packages Collection
This could be for the initial installation, your custom python tools, and open-source cross-compiling tools. Most of the build tools are already in pkgsrc. The board support and other things could still be downloaded using your current system once things are up and running, A package typically starts with a distribution tarball or such to download and start compiling but can use
git crates also.

espressif/crosstool-NG is now in /usr/pkgsrc/wip/crosstool-esp32/ and it builds and packages. Should work for about any platform that uses pkgsrc

wip/crosstool-esp32/PLIST lists the installed package contents, including:
bin/ct-ng
libexec/crosstool-ng/conf
libexec/crosstool-ng/mconf
libexec/crosstool-ng/nconf
man/man1/ct-ng.1
and a host of files in the share directory.
ct-ng executes properly. I will continue to work on further support for netbsd

at packages/toolchain-gccarmnoneeabi@1.70201.0
$ pio project init --board wemos_d1_mini32
Resolving samd21-dev-usb dependencies…
Tool Manager: Installing platformio/toolchain-gccarmnoneeabi @ ~1.70201.0
UnknownPackageError: Could not find the package with ‘platformio/toolchain-gccarmnoneeabi @ ~1.70201.0’ requirements for your system ‘netbsd_amd64’

The latest version is 1.140201.0 Which should be used?

Different platforms or even frameworks require different versions of that ARM GCC toolchain. So ideally you would provide exactly the version that each platform is asking for.

You can see for e.g. the atmelsam platform, that the default ARM GCC is “7.2.1”

…but the Adafruit Arduino core variant needs 9.3.1

… and Zephyr is using 8.2.1

I have looked all over and can’t locate the source for this. Where on github is it? github can’t find it. Is there a tarball or zip of it?

https://developer.arm.com/downloads/-/gnu-rm

Got it. What are the specific licenses that cover this source? I can’t find one specifically regarding this toolchain at arm. Is it the pio gnu-gpl-v2 AND gnu-lgpl-v2?

Per package.json

  "license": "GPL-2.0-or-later",

You could also get it from

https://github.com/gcc-mirror/gcc/tree/releases/gcc-7.2.0

I think. Not sure if ARM made any additional changes or additions to the source. But, GCC being GPL licensed, all modifications to it can also only be GPL licensed. Same goes the newlib C library implementation (or newlib-nano, git://sourceware.org/git/newlib-cygwin.git). Same for the binutils (arm-none-eabi-objcopy, arm-none-eabi-gdb, …, https://sourceware.org/git/binutils-gdb.git).

You may also find https://github.com/earlephilhower/pico-quick-toolchain/blob/master/Makefile interesting, that’s for the RP2040 and RP2350 (ARM Cortex-M0+ and ARM Cortex-M33), building the toolchains straight from the original sources.

Thanks!! I thought so, as per gnu-gpl-v2.