Skip to content

Add macOS (Apple Silicon) build support#3

Merged
pinkhasn merged 3 commits into
mainfrom
macos-build-support
Jun 6, 2026
Merged

Add macOS (Apple Silicon) build support#3
pinkhasn merged 3 commits into
mainfrom
macos-build-support

Conversation

@pinkhasn

@pinkhasn pinkhasn commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

The hprscript source was already POSIX-portable (mmap/posix_madvise/read, C++17 <filesystem>) — only the build configuration was Linux/GCC-specific. This makes the build, CI, and docs cross-platform so it builds on macOS in addition to Linux.

(iOS is intentionally not targeted — it has no user-accessible shell or PATH for a CLI tool to run in.)

Changes

  • Makefile: detect Darwin via uname -s; on macOS drop -static-libstdc++/-static-libgcc (Apple clang has no such flags, and libc++ is OS-provided + ABI-stable) and use otool -L instead of ldd. Linux behavior unchanged.
  • CI (.github/workflows/build.yml): add a macos-14 (Apple Silicon) job to the build matrix; split dependency install into apt (Linux) and brew (macOS); replace nproc with portable getconf _NPROCESSORS_ONLN; ship a hprscript-macos-arm64 release asset. The Linux x86-64 asset keeps the name hprscript so the documented releases/latest/download/hprscript URL stays stable.
  • Docs (README.md, HPRSCRIPT.md): document macOS install, Homebrew build deps, otool verification, and a Gatekeeper quarantine note. Also corrects a stale "Built for Linux x86-64" string left over from the Vectorscan switch.

Build matrix

os arch runner release asset
linux x86_64 ubuntu-22.04 hprscript
linux arm64 ubuntu-22.04-arm hprscript-linux-arm64
macos arm64 macos-14 hprscript-macos-arm64

Testing

  • ✅ Linux x86-64 build verified locally (make clean, only libc/libm/ld-linux dynamic).
  • ⚠️ The macOS job is unverified until this PR's CI runs — the most likely friction point is the one-time Vectorscan/SIMDe build on Apple Silicon. Watch the macos-14 job before tagging a release.

🤖 Generated with Claude Code

pinkhasn and others added 3 commits June 6, 2026 20:16
The source was already POSIX-portable; only the build config was Linux/GCC
specific. Make the build, CI, and docs cross-platform.

- Makefile: detect Darwin via uname; drop -static-libstdc++/-static-libgcc
  (Apple clang has no such flags, libc++ is OS-provided and ABI-stable) and
  use otool -L instead of ldd.
- CI: add a macos-14 (Apple Silicon) job to the build matrix; split deps into
  apt (Linux) and brew (macOS); use portable getconf for job count; ship a
  hprscript-macos-arm64 release asset (Linux x86-64 asset name unchanged).
- Docs: README/HPRSCRIPT.md now document macOS install, Homebrew build deps,
  otool verification, and a Gatekeeper quarantine note. Also corrects the
  stale "Built for Linux x86-64" string left over from the Vectorscan switch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The macOS CI job failed building Vectorscan's hscollider tool, which needs
pcre.h (pkg-config found Homebrew libpcre but the header isn't on clang's
default include path). hprscript only links libhs.a, so build just the
library: -DBUILD_TOOLS=OFF -DBUILD_UNIT=OFF -DBUILD_EXAMPLES=OFF
-DBUILD_BENCHMARKS=OFF. Also removes an unneeded PCRE dependency and
substantially speeds up the one-time Vectorscan build on every platform.

Applied to both the CI workflow and the README build-from-source recipe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BSD/macOS `wc -l` left-pads its count ("       5"), so the string compare
[[ "$COUNT" == "5" ]] failed even though the distinct-file count was correct.
Count lines with awk 'END{print NR}' instead, which emits a clean unpadded
integer on both GNU and BSD userlands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pinkhasn pinkhasn merged commit 05e51bf into main Jun 6, 2026
3 checks passed
@pinkhasn pinkhasn deleted the macos-build-support branch June 6, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant