From ab734739fe5c45214aa22cbe0879d04cb9d3a26e Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 28 Jul 2026 20:03:31 +0800 Subject: [PATCH 1/2] Fix ABI detection on the BSDs tools/abiname.sh created its temporary file with a three-X mktemp template. GNU mktemp accepts that, but BSD mktemp(1) requires at least six Xs and fails with "insufficient number of Xs in template", which made the Makefile abort with "Could not determine platform". Use a six-X template, which is valid for both. --- CHANGELOG.md | 3 +++ tools/abiname.sh | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80fb048..e2a90a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- ABI detection now works on the BSDs: `tools/abiname.sh` used a `mktemp` template with three `X`s, which BSD `mktemp(1)` rejects. + ## [1.2.5] - 2026-06-23 ### Changed diff --git a/tools/abiname.sh b/tools/abiname.sh index 472c012..d4fd663 100644 --- a/tools/abiname.sh +++ b/tools/abiname.sh @@ -61,7 +61,8 @@ abi_from_target_triple() { mkdir -p "${here}/tmp" # Clean up any stale temp files first rm -f "${here}/tmp"/abiname*.c "${here}/tmp"/abiname*.c.out -tmp=$(mktemp "${here}/tmp/abinameXXX.c") +# BSD mktemp(1) requires at least six trailing Xs; GNU mktemp accepts them too. +tmp=$(mktemp "${here}/tmp/abinameXXXXXX.c") #1 create the preprocessed file CC=${1:-cc} From 8febe73a6585fc8b81a2a79056ed677c49cd47f0 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 28 Jul 2026 20:03:48 +0800 Subject: [PATCH 2/2] CI: build and test on FreeBSD, OpenBSD and NetBSD Add a separate workflow that builds the library and runs the full test suite on the three BSDs in a real VM, using the vmactions VM actions on the ubuntu-latest runner. The existing workflow is left untouched. No new ABI, assembly file or platform.h branch is needed: the BSDs on amd64 use the same sysv_amd64 ABI as Linux, and the existing ELF paths in the assembly sources apply unchanged. Consequently the jobs do not upload a library artifact, which would only duplicate the Linux one. GNU make is installed in the prepare step because the Makefile uses GNU make syntax while the BSD base system make is bmake. Closes #15 --- .github/workflows/buildbsd.yml | 64 ++++++++++++++++++++++++++++++++++ CHANGELOG.md | 3 ++ README.md | 8 +++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/buildbsd.yml diff --git a/.github/workflows/buildbsd.yml b/.github/workflows/buildbsd.yml new file mode 100644 index 0000000..4851278 --- /dev/null +++ b/.github/workflows/buildbsd.yml @@ -0,0 +1,64 @@ +name: build and test bsd + +on: + push: + branches: [ master, dev ] + + pull_request: + branches: [ master ] + +# The BSDs use the same sysv_amd64 ABI as Linux, so these jobs build and test +# the existing sources rather than producing an additional library artifact. +# Each job runs in a real VM on the ubuntu-latest runner; GNU make is required +# because the Makefile uses GNU make syntax, while the BSD base system make +# is bmake. + +jobs: + + build-freebsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6.0.2 + - name: build and test + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + cache-after-prepare: true + prepare: | + pkg install -y gmake + run: | + set -ex + gmake all + gmake test + + build-openbsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6.0.2 + - name: build and test + uses: vmactions/openbsd-vm@v1 + with: + usesh: true + cache-after-prepare: true + prepare: | + pkg_add -I gmake + run: | + set -ex + gmake all + gmake test + + build-netbsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6.0.2 + - name: build and test + uses: vmactions/netbsd-vm@v1 + with: + usesh: true + cache-after-prepare: true + prepare: | + /usr/sbin/pkg_add gmake + run: | + set -ex + gmake all + gmake test diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a90a2..49f2c42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- FreeBSD, OpenBSD and NetBSD (amd64, `sysv_amd64` ABI) are built and tested on every commit by a new `build and test bsd` workflow. + ### Fixed - ABI detection now works on the BSDs: `tools/abiname.sh` used a `mktemp` template with three `X`s, which BSD `mktemp(1)` rejects. diff --git a/README.md b/README.md index 1b6326d..1e770b8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![build test and commit](https://github.com/stackless-dev/stackman/actions/workflows/buildcommit.yml/badge.svg)](https://github.com/stackless-dev/stackman/actions/workflows/buildcommit.yml) +[![build and test bsd](https://github.com/stackless-dev/stackman/actions/workflows/buildbsd.yml/badge.svg)](https://github.com/stackless-dev/stackman/actions/workflows/buildbsd.yml) ``` @@ -101,9 +102,16 @@ calling convention, plus archive format: - win_x86 (32-bit) - win_x64 (64-bit) - win_arm64 (64-bit ARM) + - **FreeBSD, OpenBSD, NetBSD (System V ABI)** + - sysv_amd64 (64-bit x86_64) All platforms are automatically built and tested by GitHub Actions CI on every commit. +The BSDs share the `sysv_amd64` ABI with Linux and therefore need no separate +assembly implementation or pre-built library; they are built and tested from +source by the `build and test bsd` workflow. Note that the Makefile requires +GNU make, which on the BSDs is `gmake` rather than the base system `make`. + ### Supported toolchains: - Gnu C