Skip to content

Start to build using Makefiles#1336

Draft
danrmiller wants to merge 120 commits into
stagingfrom
feat/make
Draft

Start to build using Makefiles#1336
danrmiller wants to merge 120 commits into
stagingfrom
feat/make

Conversation

@danrmiller
Copy link
Copy Markdown
Collaborator

@danrmiller danrmiller commented May 13, 2026

Courtesy of ongoing work by @parasew this introduces Nix flake + Makefile towards eventual reproducible builds.

  • Adds a flake.nix dev shell with pinned nixpkgs for reproducible Flutter/Rust toolchain
  • Adds a comprehensive Makefile as the single build entry point for all platforms
  • Adds macOS build patches for Nix+Xcode interop (lipo/xcrun wrappers)
  • Adds an MWC FFI integration test suite (~1000 lines)
  • Pins Rust toolchains to stable + 1.85.1 (drops 1.81.0 and 1.89.0)
  • Bumps macos deployment target from 10.15 to 11.0
  • Adds a macos smoke-build CI job

Lunar Dev and others added 30 commits May 11, 2026 22:29
…r icons

Co-authored-by: sneurlax <sneurlax@gmail.com>
Co-authored-by: sneurlax <sneurlax@gmail.com>
Co-authored-by: sneurlax <sneurlax@gmail.com>
…stack.stackduo (fixes invalid bundle-id chars)
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 4.93%. Comparing base (cf7251b) to head (8b0e24c).
⚠️ Report is 1 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging    #1336   +/-   ##
========================================
  Coverage     4.93%    4.93%           
========================================
  Files         1064     1064           
  Lines       107980   107980           
========================================
+ Hits          5328     5330    +2     
+ Misses      102652   102650    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danrmiller danrmiller marked this pull request as ready for review May 13, 2026 21:11
@danrmiller danrmiller marked this pull request as ready for review May 13, 2026 21:11
@danrmiller danrmiller requested a review from julian-CStack May 13, 2026 21:12
Copy link
Copy Markdown
Collaborator Author

@danrmiller danrmiller left a comment

Choose a reason for hiding this comment

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

Will discuss on call with @parasew

"\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"",
/usr/lib/swift,
);
PRODUCT_MODULE_NAME = stack_wallet;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Per @julian-CStack since its a template, stack_wallet should not be found in this file. If thats an updated requirement for newer macos or general macos builds we'll need to update the template to actual gen scripts to update it on copy

export NEW_APP_ID="com.cypherstack.stackduo"
export NEW_APP_ID_CAMEL="com.cypherstack.stackDuo"
export NEW_APP_ID_SNAKE="com.cypherstack.stack_duo"
export NEW_APP_ID_SNAKE="com.cypherstack.stackduo"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@julian-CStack is unsure about the purpose of this change as the bash var is specifically called snake case id.

…job to Makefile

make build-macos now drives the full macOS release build via the Makefile,
replacing the old build_app.sh -d -s download path with source compilation.

build.yaml: remove redundant Configure/GetDeps/GitVersions/Build steps now
handled by make build-macos. Add dtolnay/rust-toolchain@stable + 1.85.1 install
so check-reqs passes.

Makefile: test-mwc now ensures local stable rustup toolchain is installed and
defaulted before flutter test -d macos, fixing missing flutter_libsparkmobile
framework linker error when Cargokit rebuilds for Debug mode.
Copy link
Copy Markdown
Collaborator

@julian-CStack julian-CStack left a comment

Choose a reason for hiding this comment

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

I know this is still a WIP and I've just done a rough scan of things and haven't fully gone over the main Makefile yet either

In general I do not like patching dependencies if it can be helped and since we control many of the deps I think it would be better to change those and simplify this build process if possible

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.

This should be reverted.
flutter pub run was replaced by dart run quite a while ago.

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Always install into the local build bundle. On NixOS and other constrained
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.

I'm not 100% sure but I don't think this should get changed. I've seen permission to install failures when running projects locally sometimes but that is generally some kind of cache issue or config issue. I don't remember the details as it was a while ago when I ran into this last

"\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"",
/usr/lib/swift,
);
PRODUCT_MODULE_NAME = stack_wallet;
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.


if [[ ! -f "${PUBSPEC_FILE}" ]]; then
echo "Error: pubspec.yaml not found at ${PUBSPEC_FILE}" >&2
echo "Run from repo root and restore it with: git checkout -- pubspec.yaml" >&2
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.

This is wrong. The pubspec.yaml is generated, not pulled form git.

else
sed -i "s/name: PLACEHOLDER/name: ${NEW_PUBSPEC_NAME}/g" "${PUBSPEC_FILE}"
sed -i "s/description: PLACEHOLDER/description: ${NEW_NAME}/g" "${PUBSPEC_FILE}"
if [[ ! -f "${PUBSPEC_FILE}" ]]; then
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.

This is wrong. The pubspec.yaml is generated, not pulled form git.

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.

Any reason these changes could not be directly PR'd to flutter_libmwc?

Comment thread scripts/build_app.sh
fi

# Keep macOS stack_wallet builds on the Makefile path so setup steps stay in one place.
if [ "$APP_BUILD_PLATFORM" = "macos" ] && [ "$APP_NAMED_ID" = "stack_wallet" ]; then
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.

Any reason this only applies to stack_wallet and not others?

Comment thread Makefile
$(FLUTTER) config --enable-macos-desktop >/dev/null
@# Reassert macOS platform metadata in the same local HOME used for the final build.
@env HOME="$(PROJECT_HOME)" XDG_CACHE_HOME="$(PROJECT_CACHE)" TMPDIR="$(PROJECT_TMP)" PUB_CACHE="$(PUB_CACHE)" \
$(FLUTTER) create --platforms=macos . --no-pub >/dev/null
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.

I don't think flutter create --platforms=macos should be called on build

Comment thread Makefile
@echo "--- Building app..."
@if [ ! -f lib/external_api_keys.dart ]; then \
echo "[WARN] lib/external_api_keys.dart missing; recreating template."; \
printf 'const kChangeNowApiKey = "";\nconst kSimpleSwapApiKey = "";\nconst kNanswapApiKey = "";\nconst kNanoSwapRpcApiKey = "";\nconst kWizSwapApiKey = "";\n' > lib/external_api_keys.dart; \
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.

This is redundant as the prebuild.sh script will generate this here https://github.com/cypherstack/stack_wallet/pull/1336/changes#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R399

If a check must be done here, better to fail with an error to check that prebuild.sh worked correctly

Comment thread Makefile
@cp scripts/patches/flutter_libmwc_macos_build_all.sh crypto_plugins/flutter_libmwc/scripts/macos/build_all.sh
@chmod +x crypto_plugins/flutter_libmwc/scripts/macos/build_all.sh
@# Ensure Frostdart macOS build script uses sed -i.bak form (GNU/BSD compatibility).
@perl -0777 -i.bak -pe 's/_run\("sed",\s*\["-i"\s*,\s*"\.bak"\s*,\s*"s\/frostdart\/hrf-api\/",\s*"cargo\.toml"\]\);/_run("sed", ["-i.bak", "s\/frostdart\/hrf-api\/", "cargo.toml"]);/g' crypto_plugins/frostdart/scripts/macos/build_macos.dart 2>/dev/null || true
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.

better to fix at source rather than patch

@julian-CStack julian-CStack marked this pull request as draft May 14, 2026 14:21
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.

3 participants