Skip to content

build: Makefile wrappers for macOS/Linux/Windows/Android/iOS, Nix bootstrap, BOM checks and docs - #1482

Closed
parasew wants to merge 107 commits into
cypherstack:stagingfrom
parasew:feat/makefile-macos-build
Closed

parasew wants to merge 107 commits into
cypherstack:stagingfrom
parasew:feat/makefile-macos-build

Conversation

@parasew

@parasew parasew commented Nov 1, 2026 •

Copy link
Copy Markdown

Summary

A local developer build interface for Stack Wallet: a Makefile over the existing scripts/build_app.sh, a Nix/direnv dev shell as the primary toolchain, Homebrew and manual fallbacks, a small toolchain BOM, and docs. The Make targets run the same build steps as the staging CI workflows; this PR does not add a second CI build matrix.

What it adds

  • Make targets: build-macos, build-linux, build-windows (Git Bash), build-android, build-ios, plus bootstrap, bootstrap-macos, bootstrap-xcode, check-reqs*, clean*, verify-bom, verify-bom-plugins, toolchain, diagnose-env-macos and opt-in sccache helpers.
  • Nix dev shell: flake.nix + tracked .envrc (use flake). direnv activates the same shell as nix develop; Homebrew/manual installs remain supported fallbacks.
  • dnix defaults: source builds only through the Nix/direnv toolchain: the default on Apple Silicon macOS and Linux inside nix develop/direnv. Homebrew, manual and host toolchains, Intel macOS, CI, Windows and unsupported Android hosts use verified prebuilts. PREBUILTS / ANDROID_PREBUILTS / SYSTEM_DEPS control the rest.
  • BOM: stack-bom.toml pins Flutter, Dart, Rust, DNSSEC Rust, Go and Xcode; make verify-bom checks the machine and the native plugin pins against pubspec.lock, and make verify-bom-plugins checks only the plugin pins for the Windows/Android targets. The Windows/macOS/iOS release jobs read the same BOM; the CI container images mirror the same Flutter/Go pins.
  • CI: the existing staging build.yaml is the build source. A cheap make-check job in test.yaml validates the BOM, dry-runs the five build targets and asserts that brew/host source mode and Android source on unsupported hosts fail, so a broken Makefile or a policy regression fails before merge. The test job runs the full BOM check after installing both Rust toolchains from the BOM.
  • Docs: docs/building/make.md, make-flow.md, and updates to the host guides and README.

Portability and preflight fixes

  • App configuration uses sed -i.bak instead of macOS-only sed -i '', because the Nix shell puts GNU sed on PATH; iOS, Android and Campfire configuration previously failed there.
  • check-sdk-macos honours DEVELOPER_DIR; build-ios checks the iOS SDK and runs the same prerequisite checks as macOS.
  • Android defaults to verified prebuilts on hosts that cannot build dnix source (anything other than x86_64 Linux in Nix/direnv), and ANDROID_PREBUILTS is validated. make build-android now requires an explicit make android-dev-key; it never silently signs a release APK with a public test key.
  • Child scripts use the Flutter/Dart binaries the Makefile checked; tool paths are quoted.
  • Windows asset copies remove an old junction as a link and fail closed if it cannot be removed, instead of letting rm -rf follow it into asset_sources.
  • BOM values are validated as plain versions before they reach the release toolchain actions, and verify_bom accepts/refuses [plugins] tables consistently (including header comments and duplicates).
  • PREBUILTS=0 is rejected unless TOOLCHAIN=nix|direnv and the host supports dnix source; brew/manual/host use PREBUILTS=1. ANDROID_PREBUILTS=0 requires x86_64 Linux in nix develop/direnv. Empty or multi-word APP_NAME/PREBUILTS/ANDROID_PREBUILTS/SYSTEM_DEPS values and an empty UNAME_M are rejected instead of silently selecting a mode.
  • make check-reqs requires Go only for Stack Wallet's MWEB build; Stack Duo and Campfire no longer fail on a machine without Go.
  • build_app.sh's wallet-data warning stays interactive; CONFIRM=1 is the explicit non-interactive bypass, and EOF no longer loops forever.
  • Xcode license/first-launch checks only run after changing the selected Xcode, so repeat bootstraps do not ask for sudo again.
  • The Linux dev shell puts the clang wrapper ahead of the unwrapped clang (Flutter's Linux CMake build forces CC=clang), uses patchelf 0.18 for --clear-execstack, and restores the libsecp256k1 copy that the coinlib CMake install step expects. Its PATH prepends are idempotent, and the shell provides git and nix so nix develop -i can run the Makefile and source builds.

Out of scope

  • The bm/ benchmark suite and the archive.org Xcode downloader were moved out of this PR (preserved on a local backup branch) rather than reviewed here.
  • The duplicate make-build.yaml workflow was deleted: staging build.yaml already builds every platform.

Verification

  • macOS source: real make build-macos VERSION=9.9.9 BUILD_NUM=400 CONFIRM=1 inside nix develop with PREBUILTS=0 (the default): pass, Stack Wallet.app built (320.0 MB). All four dnix packages built from source with Xcode 27.0 (27A266a): frostdart, flutter_libepiccash, flutter_libmwc and tor_ffi_plugin. The prebuilt path also passed earlier with PREBUILTS=1.
  • Linux/NixOS x86_64: make verify-bom 0 failures, 0 warnings; real make build-linux VERSION=9.9.9 BUILD_NUM=400 PREBUILTS=0 CONFIRM=1 inside nix develop built the 271 MB bundle and the executable-stack validation passed.
  • Android on x86_64 Linux: a debug APK (410 MB) and, after excluding the dev-only integration_test plugin, a release APK (329 MB) were built. The NixOS host needed the SDK's generic NDK/CMake binaries patched for its loader (the equivalent of programs.nix-ld.enable); this is documented in docs/building/linux.md.
  • CI: make-check (8s), test (24m27s), linux-release-bundle (20s) and windows-build-scripts (18s) all pass on this head (15d0e12d3), after rebasing onto the latest staging and with the full BOM check in test.
  • make -n for all five targets, the negative source-mode guards, make verify-bom (0 failures, 1 warning: host Xcode 27.2 vs the recommended 27.1) and make verify-bom-plugins (0 failures, 0 warnings) pass; nix flake check --no-build --all-systems, bash -n, shellcheck -S warning, workflow YAML parsing, relative-link and Mermaid checks, and git diff --check are clean.
  • The macOS verification above used PREBUILTS=1; the Apple Silicon source default is covered by dry run and by the Linux source build, not by a second full macOS source build.
  • The underlying build steps are the ones already exercised by staging build.yaml; the Make targets add local preflight and dnix mode selection.

Known limitations

  • Android on NixOS needs programs.nix-ld.enable and a writable Flutter SDK for Gradle's integration_test project; the CI image or a writable Flutter install avoids both.
  • The Windows/iOS targets were verified by dry run and by the staging CI steps they wrap, not on physical devices in this change.
  • macOS/Linux/iOS make outputs are not release-signed. Android APKs are signed with android/key.properties; keys created by make android-dev-key are for local testing only. Without lib/external_api_keys.dart the swap-provider keys are empty stubs.

@parasew parasew changed the title build: Makefile wrapper, macOS/Linux bootstrap, opt-in Xcode download and docs build: Makefile wrappers for macOS/Linux/Windows/Android/iOS, bootstrap, opt-in Xcode download, BOM check and docs Nov 2, 2026
@parasew

parasew commented Nov 11, 2026 •

Copy link
Copy Markdown
Author

@julian-CStack thanks — I worked through the review items and the follow-ups.

  • The MWC FFI suite is out of this PR. It lives in cypherstack/flutter_libmwc#16 now: wallet create/open, address validation, slatepack round-trip with a real MWC fixture, encrypted-slatepack wallet requirement, and malformed-input handling. The plugin suite passes locally (9 tests); its CI needs workflow approval because it comes from a fork.
  • Must-fix items are addressed: Linux bundle preparation runs from make build-linux; APP_NAME is honored; Windows copy mode now copies instead of relying on mklink; the tracked libsecret pc file is generated/ignored; the duplicate Docker secp256k1 step is gone; the pub cache is Linux-only; the BOM check, bootstrap/Xcode scripts and benchmark scripts are fixed.
  • Upstream checks on 5d9489551: test pass and linux-release-bundle pass.
  • Fork Make build: Windows and Linux pass. iOS is running. macOS was cancelled twice by the hosted-runner queue before starting; I’ll retry when capacity is available.
  • Compatibility with your Repro dnix packages #1505: a throw-away merge has only a docs/building.md conflict; all make -n targets still parse; make verify-bom needs the plugin pins refreshed after Repro dnix packages #1505 changes pubspec.lock. I did not merge your draft into this PR — it should stay independent until Repro dnix packages #1505 is ready.
  • PR description is updated.

@parasew
parasew marked this pull request as ready for review November 11, 2026 18:16
@parasew

parasew commented Nov 11, 2026

Copy link
Copy Markdown
Author

Runner follow-up: the macOS cancellations were caused by the fork's single hosted macOS concurrency slot, with macos and ios started together. One job held the slot while the other waited 15 minutes and was cancelled.

Commit 2b0a0e21e serialises them: macOS first, iOS after. A fresh run is queued at https://github.com/parasew/stack_wallet/actions/runs/43081040312; Windows and Linux are already running. As a fallback I also ran make build-macos locally in nix develop (macOS 27.2, Xcode 27.2, Flutter 3.47.4): it passed and produced Stack Wallet.app (318.8 MB). The upstream test check is re-running on the new head.

@parasew

parasew commented Nov 12, 2026

Copy link
Copy Markdown
Author

All checks are green on b82bc47da:

  • Upstream test: pass (24m44s)
  • Upstream linux-release-bundle: pass
  • Fork Make build: Windows, macOS, Linux and iOS all pass

The macOS runner issue is resolved by serialising the two macOS jobs. The PR is up to date with staging and ready for review.

@parasew parasew mentioned this pull request Nov 12, 2026
@parasew

parasew commented Nov 12, 2026

Copy link
Copy Markdown
Author

Clean-room follow-up: the two remaining platform gaps are now actually validated.

macOS VM (Tart, macOS 26.6.2 arm64; Homebrew present, no Xcode/Flutter/Rust):

  • make bootstrap-xcode-download ARGS=-y: real Xcode 27.1 download, SHA-1 and Apple signature verification, extraction and install.
  • make bootstrap-macos: Homebrew packages, Flutter 3.47.2, Rust 1.99.1, PATH/zshrc.
  • make build-macos: Stack Wallet.app 319.5 MB.

Android (x86_64 Linux host, ghcr.io/cypherstack/stackwallet-ci:android):

  • make build-android: arm 183.5 MB, arm64 218.8 MB, x86_64 235.4 MB.

Xcode resume harness: a partial .part was resumed with curl -C -, a relative cache path resolved correctly, and signature/install/-y selection passed.

The remaining limitations are now only physical-Windows hardware, real Android release signing, and iOS simulator/signing. The PR is still green and ready for review.

@parasew
parasew force-pushed the feat/makefile-macos-build branch from b82bc47 to 4481c00 Compare November 12, 2026 07:51
@parasew

parasew commented Nov 12, 2026

Copy link
Copy Markdown
Author

Author metadata update: all commits on this branch are now authored and committed by parasew <9727+parasew@users.noreply.github.com>. The content tree is unchanged from the validated b82bc47da runs; GitHub is re-running the checks on the rewritten head 4481c00d.

@parasew parasew changed the title build: Makefile wrappers for macOS/Linux/Windows/Android/iOS, bootstrap, opt-in Xcode download, BOM check and docs build: Makefile wrappers for macOS/Linux/Windows/Android/iOS, Nix bootstrap, BOM checks and docs Nov 17, 2026
Adds a Makefile that wraps scripts/build_app.sh:
- make build-macos runs the same steps as CI (build_app.sh, pub get,
  prebuild.sh, flutter build macos). PREBUILTS=0 compiles native assets
  from source (the generated pubspec.yaml is removed first so an earlier
  -d run does not stick). Produces the same app as upstream
  (Stack Wallet.app, com.cypherstack.stack_wallet).
- make bootstrap-macos (Homebrew; pins Flutter 3.47.2), nix develop via
  flake.nix/.envrc (sets FLUTTER_ROOT so `dart run` works), make
  bootstrap-xcode, and an opt-in make bootstrap-xcode-download
  (archive.org; SHA-1 and Apple signature are both checked).
- make sccache-setup (opt-in): sccache for native-asset hook builds via
  ~/.cargo/config.toml.
- make build-linux; writes a git-ignored .cargo/config.toml with PROTOC so
  crates that ship a generic-Linux protoc build on NixOS.
- bm/ benchmark scripts and MWC integration tests.

Docs: new "Building with make" section in docs/building.md.

Verified (one machine each, one run):
- macOS 27.2 / Xcode 27.1: make build-macos from a clean checkout
  (946 s cold, 319.0 MB), PREBUILTS=0 (596 s), and inside nix develop
  (Flutter 3.47.4, 261 s).
- Linux: NixOS x86_64, nix develop, Rust 1.99.1, make build-linux
  produced build/linux/x64/release/bundle/stack_wallet (291 MB).
- Xcode 27.1 download from archive.org: SHA-1 and pkgutil signature
  check pass (install step not run).
Not tested: Ubuntu, Windows, Android, iOS, bootstrap-macos on a fresh Mac.
download_xcode.sh used sudo for rm/mv/xattr unconditionally. It now checks whether the parent of the target
directory is writable and only then uses sudo, so Xcode can be installed into ~/Applications without a password.
Verified on macOS 27.2: -d ~/Applications/Xcode_27.1_test.app installed Xcode 27.1 (27A9275), the extracted app
has no quarantine attribute, and free space dropped by about 4 GB; hash and signature checks passed before it.
The install-time prompt text now says about 20 GB free are needed.
…ptional

install_macos_build_tools.sh aborted at the first brew failure. On a machine where weasyprint was installed another way,
brew could not link it, set -e stopped the script, and the Flutter step was never reached. It also upgraded formulae that
were already installed (cmake, go), changing the build machine under the user.
- export HOMEBREW_NO_INSTALL_UPGRADE=1 for the required packages
- install pandoc/weasyprint/toilet/figlet (only used by the bm/ report rendering) in a separate, non-fatal step

Verified on macOS 27.2: first run failed as described; after the change the installer ended with rc=0, cloned Flutter 3.47.4
into a temporary FLUTTER_DIR, left the existing Flutter 3.47.2 untouched, and only appended the brew shellenv and Flutter PATH
lines to ~/.zshrc (restored afterwards).
…lock

make build-macos now runs ./build_app.sh from the scripts directory (as the CI jobs and the other targets do), so
scripts/build_app.sh stays exactly as in staging; the earlier path-resolution and variable-rename edits are reverted.
make build-linux no longer recreates lib/external_api_keys.dart: prebuild.sh already creates it, and the block never
ran in any of the Linux builds I did.

Verified on macOS 27.2: make build-macos OK, Stack Wallet.app with the unchanged bundle ID. The Linux target was only
checked with make -n after this change.
archive.org sometimes resets the connection (curl exit 56) a minute into the transfer, which aborted the script even
though the download can be resumed. curl now retries up to 8 times (--retry-all-errors) and resumes with -C -.

Seen in a fresh macOS 27.2 VM; the retry itself is exercised in the next VM run.
…e, docs

make build-linux now passes -d (PREBUILTS=1, the default, like make build-macos and the CI job) and -s with SYSTEM_DEPS=1.
With -s the Makefile sets only USE_SYSTEM_SECURE_STORAGE_DEPS=1 for the app build; the local libsecret pkg-config override
is kept for the default path (it is needed where libsecret is built from source, for example on NixOS).
download_xcode.sh accepts XCODE_XIP_URL to download from another mirror; the SHA-1 and the Apple signature are still checked.
docs: a second Xcode via DEVELOPER_DIR, and what reaches the hooks for sccache (exported RUSTC_WRAPPER does not, the cargo
config file does).

Verified: NixOS (nix develop) make build-linux with -d builds the bundle; Ubuntu 24.04 container make build-linux
SYSTEM_DEPS=1 (-d -s, the CI flags) builds the bundle; make -n and bash -n pass for all targets and scripts.
… bm/bench.sh

clean-app removes build/ and the Pods but keeps .dart_tool/hooks_runner, so the next build does not rebuild the
native assets; clean-native removes only the native-asset outputs. bm/bench.sh zeroes the sccache statistics
before the build and stores 'sccache hits/executed requests' in the comment column of the CSV.
stack-bom.toml records the expected toolchain (Flutter, Dart, Rust, Go, Xcode)
and the git revisions of the pinned native plugins. make verify-bom
(dart tool/verify_bom.dart, no packages needed) checks the local machine and
pubspec.lock against it: a mismatch in Rust, Dart, minimum Flutter/Go or a
plugin pin fails, a different recommended Flutter or Xcode only warns.
dart tool/verify_bom.dart --update regenerates the [plugins] section from
pubspec.lock.

Verified on macOS 27.2: passes with 1 warning (Flutter 3.47.2 vs. recommended
3.47.4); a wrong Rust version and a wrong plugin pin both exit 1.
…targets

make build-windows wraps the steps of the build-windows CI job (prebuild.sh, build_app.sh -p windows -d -s,
pub get, coinlib:build_windows, flutter build windows). WINDOWS_COPY_ASSETS=1 replaces the asset links with
copies for runners that cannot create symlinks.
.github/workflows/make-build.yaml runs make build-windows and make build-macos on hosted runners
(manual dispatch or pushes to ci/make-* branches).
…ing key exists

The release build fails at packageRelease without android/key.properties (SigningConfig release is missing
storeFile). android-dev-key creates a debug keystore and key.properties for local builds only; both files are
git-ignored and the APKs are not for distribution.
…deps and bm

- build-windows: with WINDOWS_COPY_ASSETS=1 remove the asset copies of an earlier run before
  build_app.sh runs link_assets.sh, whose `rm -f` cannot delete real directories (second run failed)
- bootstrap-macos: skip the Homebrew installer in a Nix shell with one conditional recipe instead of
  `exit 0`, which only ended that line's shell; failures of the Xcode step now propagate
- build_secure_storage_deps.sh: stop when cmake, make, meson or ninja fails, before writing the
  pkg-config file; reconfigure an existing meson build directory instead of failing on it
- install_macos_build_tools.sh: put rustup on PATH after `brew install` (resolved with
  `brew --prefix rustup`), not only if its directory existed before
- install_xcode.sh: keep any valid selected Xcode (Xcode_27.1.app, ~/Applications, ...) and only
  pick one from /Applications when the selection is missing or the Command Line Tools
- mwc_ffi_test_service: the invalid-slatepack assertion no longer sits inside its own catch
- bm/compare.py: pair measurements by label and host instead of the first row of each file
- bm/bench.sh: record failed builds and return make's exit status
- Remove the MWC FFI integration tests; they belong in flutter_libmwc.
- Run prepare_release_bundle.py from make build-linux.
- Honor APP_NAME on macOS and make WINDOWS_COPY_ASSETS copy in link_assets.sh.
- Stop rewriting the tracked libsecret pkg-config file and drop duplicate toolchain steps.
- Harden verify_bom.dart for Windows and missing plugin pins.
- Fix bootstrap/Xcode selection, download resume, and benchmark script edge cases.
The fork has a single hosted macOS concurrency slot. Running the two jobs together leaves one queued until GitHub's 15-minute timeout cancels it. Run macOS first, then iOS, so each waits for the runner instead of competing.
…used secp copy

- bootstrap-macos invoked $(MAKE) bootstrap-xcode; a recipe line containing
  $(MAKE) is executed even under `make -n`, so a dry run accepted the Xcode
  license and ran first-launch setup for real (observed: sudo prompt and
  exit 2 under make -n). Call scripts/install_xcode.sh directly instead --
  exactly what the bootstrap-xcode target runs.
- verify-bom with no dart on PATH expanded $(DART) to empty and /bin/sh
  tried to execute tool/verify_bom.dart as a command ("Permission denied",
  exit 126). Guard it the same way check-reqs guards Flutter/Dart.
- scripts/linux/build_secp256k1.sh copied the library to
  build/linux/x64/release/secp256k1/lib ("Location expected by
  Flutter/CMake install step"). No consumer exists in this tree or in cypherstack#1505
  (coinlib_flutter, pinned f0e12dac, builds its own secp256k1 via CMake
  ExternalProject into its own CMAKE_BINARY_DIR), and the path hardcoded x64
  instead of deriving the arch. Drop it; keep the legacy
  build/libsecp256k1.so copy consumed by coinlib:build_linux and
  test/utilities/electrum_seed_utils_test.dart.
- The workflow declared no permissions and would inherit the repo default.
  Add top-level permissions: contents: read (the jobs only check out code
  and build; no artifacts are uploaded, no registry images pulled).
- Drop libopencv-dev from the Linux apt list: staging removed it in
  9a02aa2 ("Use the build-hook camera_linux, drop libopencv-dev"), the CI
  image installs no OpenCV, and this PR's own docs/building.md apt line does
  not list it. Keep ocl-icd-opencl-dev/opencl-headers/libtss2-dev, which the
  staging image still ships.
…sing rust toolchains (S10)

The host-runner gate failed on the real ubuntu-24.04 CI runner: it ships
rustup with Rust 1.99.1 (the BOM rust) but NOT the pinned 1.90.0 (DNSSEC),
so the 'rustup present, pinned toolchain absent' branch hard-failed both
the Rust and DNSSEC checks — defeating the warn-pre-image/fail-in-image
design. --toolchains now downgrades a present-but-missing pinned toolchain
to a warning; a plain run still hard-requires it. Reproduced (exit 1, 2
FAILs) before the fix; exit 0 / 0 FAILs after, plain run unchanged (exit 1).
…(audit)

From an adversarial audit of the S10/S22 work:
- test.yaml: run the two new BOM test files (bom_values_test,
  verify_bom_parser_test); they had no CI regression gate.
- verify_bom.dart _update(): wrap the early readBom in try/catch so a
  malformed BOM exits 2 (was an uncaught FormatException -> exit 255).
- bom_parser.dart lockRefs(): strip a trailing CR so a CRLF pubspec.lock
  still matches the anchored ^  (\w+):$ header; add a CRLF regression test.
…h change

The CI image reads the BOM at build time (Dockerfile COPYs + bom_values.sh
--get), but the rebuild was triggered only by Dockerfile/workflow changes.
A BOM Flutter/Go bump merged without rebuilding the image, so Linux/Android
kept the stale baked-in toolchains. Add stack-bom.toml and scripts/bom_values.sh
to the push paths trigger.
…rt keyring (audit)

The S10 host-runner steps used step-level `container: false`, which is not
valid GitHub Actions syntax — actionlint rejects it as "unexpected key
'container' for step". Split the pre-image toolchain check into its own
`verify-toolchain` job (runs-on host, no container) that build-linux needs.
Also `sudo gpg --dearmor` the Dart signing key so the hosted runner (runs as
`runner`) can write /etc/apt/keyrings.

Fixes ci-docs-audit B1 (invalid step-level container) + B4 (unsudoed gpg).
…udit)

Fixes the ci-docs-audit blockers in the new make-smoke workflow:
- B1: step-level `container: false` is invalid GitHub syntax; split the
  pre-image toolchain check into its own `verify-toolchain` job that
  make-smoke-linux needs.
- B2: `make build-linux` runs verify-bom + check-reqs, which hard-require the
  BOM-pinned rust toolchains; the CI image installs rustup --default-toolchain
  none, so install rust + dnssec_rust (read from stack-bom.toml) before the build.
- B3: build_app.sh's confirmDisclaimer aborts on EOF in CI; pass CONFIRM=1 so
  the Makefile pipes the prompts.
- B4: `sudo gpg --dearmor` the Dart signing key for the hosted runner.

Validated with actionlint: 0 syntax errors.
- Decision 1 (Nix-only): source builds now require a Nix/direnv shell.
- Delete scripts/install_macos_build_tools.sh (Homebrew tool installer).
- Makefile: bootstrap-macos now only checks/selects Xcode; drop the
  install_macos_build_tools.sh branch, the rustup target add line, and the
  bootstrap-brew alias; remove brew from TOOLCHAIN allowed values and
  toolchain-check; host/manual remain for the prebuilt (PREBUILTS=1) path.
- Reframe living docs (README, docs/building/*) from a Homebrew source-build
  fallback to the prebuilt path.
- Record the outcome in PR-1482-build-strategy-decision.md.
The Homebrew source-build fallback is gone (Nix-only for source builds,
see d89d826). This script installed the Homebrew toolchain, which is
no longer referenced by bootstrap-macos or any doc.
- Fixes the makefile-build-audit blocker: PREBUILTS=0 guarded only on
  NIX_BIN (nix on PATH), never on TOOLCHAIN_EFFECTIVE, so a non-Nix
  toolchain with nix on PATH could build from source without a shell.
- SOURCE_TOOLCHAIN now set only inside an active nix/direnv shell
  (filter nix direnv on TOOLCHAIN_EFFECTIVE), not merely nix-on-PATH.
- PREBUILTS=0 error now requires TOOLCHAIN=nix or direnv.
- Android source guard inherits the fix via SOURCE_TOOLCHAIN.
- New scripts/install_nix.sh: checks for nix on PATH, installs the
  official multi-user (daemon) Nix from nixos.org when missing.
  Idempotent; like install_xcode.sh it fails with clear instructions
  rather than guessing (Nix has an official signature-checked installer,
  unlike Xcode, so auto-install is appropriate here).
- bootstrap-macos now runs install_nix.sh then install_xcode.sh.
- Docs: bootstrap-macos described as installing Nix + selecting Xcode.
- bench.sh/collect.sh/compare.py/render.sh/run_all.sh/report.css from
  build/native-assets-harness, plus bm/README.md.
- Runs make build-macos/build-linux, so it inherits the Nix-only
  source-build rules; README documents running it in a Nix shell.
- bm/results/ git-ignored (per-machine CSVs).
- README notes the two stale no-ops: SCCACHE=0/1 is labeling only
  (sccache toggled by make sccache-setup), SKIP_NATIVE is a no-op
  through make (use make clean-native).
The 6 harness scripts from build/native-assets-harness. bench.sh runs
make build-macos/build-linux and records wall seconds + disk delta to
bm/results/<host>.csv; compare.py renders them, render.sh makes a PDF,
run_all.sh runs the full cold->warm suite, collect.sh snapshots sizes.
See bm/README.md and .gitignore (aba33e8).
- nix eval on rev b1b87598: go_1_24 MISSING; go_1_23/1_25 removed (EOL);
  only go_1_26=1.26.7; bare pkgs.go=1.26.7 (already drifts from BOM 1.24.13).
- B1-Go needs a nixpkgs-rev change + mandatory build gate; cannot ship a
  partial flake edit here without silently changing the dnix toolchain.
- Option B stays planned/EDITED-UNPROVEN until done on a full nix-env host.
My earlier 'blocked on a nixpkgs-rev change' was wrong. The Dockerfile
(Option A) already pins exact Go/Flutter from the BOM by fetching from
go.dev + cloning the flutter git tag, with no nixpkgs selectors. The
flake fix is the same pattern (fetch exact versions), not a rev bump.
The real blocker is only the mandatory build-gate verification, which
this host cannot run (no Flutter in the Nix shell).
Adversarial-audit fix. All 15 'Decode secrets' steps decoded
${{ secrets.CHANGE_NOW }} with a bare 'echo "$CHANGE_NOW" | base64 --decode
> lib/external_api_keys.dart'. When the secret is unset (fork dispatch, or a
repo without the secret) that writes an EMPTY external_api_keys.dart missing
the Dart API-key constants, breaking the downstream flutter build. Mirror the
already-correct test.yaml pattern: guard on a non-empty secret and fall back to
a stub file of empty-string constants.

Also add the contents:read / packages:read permissions block to build-windows
for parity with the other build jobs (it previously relied on the implicit
default).
…egrity, Dart logic

Follows round-1 audits A-F with new angles: our own CI surface, pipeline security, native-lib integrity, and Dart logic in the changed files.
Verdict: no new merge blockers. Changed Dart code is correct and fail-closed (dart analyze clean; verify_bom.dart compiles standalone).
CI: test.yaml runs the full Dart suite + flutter test only on pull_request, not on push to staging (coverage gap, maintainer decision). Makefile (the PR's deliverable) is not exercised by automated CI (make-smoke is manual).
Security-reviewer's two headline claims (CHANGE_NOW 'BLOCKER', dnix.lock 'missing') are both false positives; verified against ground truth.
dnix uses distributed per-plugin lockfiles; pubspec.lock (committed) pins all 4 native libs by git revision.
The three PR-1482-*.md notes (build-strategy decision, optionB flake
consolidation, round-2 audit) were self-generated working notes that
leaked into the PR diff; they do not belong in the upstream repo.
Content is preserved in Hindsight memory and the session record.
SCCACHE=0 was only a label; sccache is enabled via rustc-wrapper in the
cargo config, so a 'no-sccache' run still used sccache and could not
prove caching improves build time. bench.sh now temporarily strips the
rustc-wrapper line from the active cargo config for that one build, with
a trap that restores the config afterward (even on crash). SCCACHE unset
or =1 leaves sccache as configured. README caveat updated to match.
The BUILD_NUM check used a single '$' in the grep pattern ('^[0-9]+$').
Make does not escape a lone $, so the shell received an unterminated
single-quoted string ('^[0-9]+ || { ...), aborting require-version with
'unexpected EOF looking for matching ' . Every real build target
(build-macos/linux/windows/android/ios) depends on require-version, so
all of them failed before doing anything. 'make -n' dry-runs masked it
because dry-run never executes recipes.

Fix: escape the anchor as '$$' like the VERSION check already does, so
the shell sees the literal $ end-of-line anchor. Verified: valid
VERSION/BUILD_NUM pass; invalid values are still rejected.
…heck

make -n dry-runs never run recipes, so they cannot catch a broken recipe
that aborts at shell-parse time. Added a make-check step that actually
runs require-version with a valid VERSION/BUILD_NUM (must pass) and two
invalid inputs (must be rejected). This would have caught the require-
version unescaped-\$ parse error that broke every real build target.
GitHub Actions parses run: blocks and requires $$ for a literal shell
$. Align the valid-case make invocation with the invalid-case lines so
all references expand correctly at runtime.
check-reqs (the cross-platform path used by build-linux/build-android)
hardcoded rustup toolchains 1.90.0 and 1.99.1, while check-reqs-macos
used the BOM-driven RUST_VERSION. On a version bump the two paths would
diverge, breaking the single-source-of-truth goal. Add BOM_DNSSEC_RUST /
DNSSEC_RUST_VERSION (sourced like BOM_RUST) and use them in check-reqs.
Verified: both rustup run checks resolve to the BOM values (1.99.1 /
1.90.0) and pass.
- Format tool/bom_parser.dart, tool/verify_bom.dart and
  scripts/tests/verify_bom_parser_test.dart (the `test` job failed on
  `dart format --set-exit-if-changed` before running any test).
- test.yaml: the require-version step used Make's `$$` in a bash step, where
  `$$` is the PID; use plain `$`, fetch tags so the BUILD_NUM guard is
  actually exercised, and drop the duplicated comment block.
- Makefile: `bootstrap` had a stray `@` inside a shell continuation line
  (`@echo: command not found`); remove the unused verify-bom-toolchains
  target.
- build.yaml: fail when the CHANGE_NOW secret is missing instead of silently
  building with empty API-key stubs (15 copies of the stub heredoc removed).
- build.yaml, make-smoke.yaml: remove the verify-toolchain job. It checked the
  host runner, not the CI image it was meant to guard, downgraded missing
  tools to warnings, and used `${{ env.PATH }}` which does not carry the
  runner PATH. Pass workflow_dispatch inputs through env, not the script.
- verify_bom.dart: drop the now-unused --toolchains mode; correct the header
  (plugin pins live in pubspec.lock, `--plugins` checks only a legacy
  [plugins] table).
- install_nix.sh: ask before piping the installer into a root shell, correct
  the "signature-checked" claim, remove a no-op block.
- link_assets.sh, bm/: remove an unused variable and fix shellcheck warnings.
…ine exit code

- Makefile: require-version interpolated VERSION and BUILD_NUM into the
  recipe text, so a value such as `1.0.0'; cmd; echo '`, one containing
  backticks, or `$(shell ...)` ran as code during validation. The values now
  reach the shell through the environment (read with $(value ...), and
  VERSION/BUILD_NUM are no longer exported). BUILD_NUM must be a plain number
  without leading zeros and at most 9 digits.
- build_app.sh: declining the wallet-data warning exits 0 again, as
  scripts/tests/build_input_test.dart expects (the previous exit 1 failed six
  of its tests, hidden behind the earlier format failure). The Makefile sets
  BUILD_APP_DECLINE_EXIT=1 so `make` still stops instead of building an
  unconfigured project.
- docs: the manual/Homebrew prebuilt path does not need bootstrap-macos (which
  installs Nix); mention the new Nix installer prompt.
- flake.nix: drop a stale comment about the removed Homebrew helper.
… overwriting it

035dd9d removed the copy into build/linux/<arch>/release/secp256k1/lib.
On a clean checkout nothing else creates that file, so `make build-linux`
(Nix, PREBUILTS=0) failed in coinlib's CMake install step with
"file INSTALL cannot find .../secp256k1/lib/libsecp256k1.so".

Copy the library there again, but only when it is missing, so a rebuild keeps
shipping the same library (the concern behind 035dd9d).

Verified on NixOS x86_64 from a fresh clone: clean build and rebuild both
succeed, the bundled libsecp256k1.so has an identical sha256 after the
rebuild, and the executable-stack validation passes.

docs: the Nix shell currently provides Flutter 3.47.4, not 3.47.2, so
verify-bom prints a warning there; say so.
…PREBUILTS docs

- test.yaml: the "brew source mode must fail" check failed because
  TOOLCHAIN=brew is not a valid value, not because of the source-mode policy,
  so a policy regression would have gone unnoticed. Each negative case now has
  to fail with the message of the rule under test, and the default mode
  (source in a Nix shell, prebuilt on host/Intel/Windows) is asserted
  positively. Mutating the Makefile policy now fails this step.
- docs: PREBUILTS=0 needs an active Nix/direnv shell (nix on PATH is not
  enough, and host/manual toolchains are rejected); TOOLCHAIN=brew does not
  exist. Calling scripts/build_app.sh directly still only needs nix on PATH.
…op installing packages

- bench.sh: the README call (no VERSION/BUILD_NUM) failed in require-version,
  and build_app.sh would have asked its interactive question. Default to
  VERSION=0.0.0, the latest release tag as BUILD_NUM and CONFIRM=1 unless the
  caller passes their own; the CSV flags column keeps only the caller's flags.
- bench.sh: `make ... | tail; RC=$?` recorded tail's status and `set -e`
  aborted before any row was written, so a failed build never reached the CSV
  and the "Build FAILED" branch was unreachable. Take make's status from
  PIPESTATUS and always write the row (success=0).
- bench.sh, run_all.sh: toilet/figlet were hard, undocumented dependencies
  (the script died with "command not found"); fall back to plain text.
- render.sh: stop running `pip3 install --break-system-packages weasyprint`
  behind the user's back, use mktemp instead of a fixed /tmp file, and only
  open the report when --open is given (the `&& ... ||` chain opened the HTML
  file regardless).
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