@@ -16,6 +16,9 @@ export LC_ALL=C
1616export TZ=UTC
1717umask 0022
1818
19+ # Force single codegen unit in Rust release builds for deterministic output.
20+ export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
21+
1922# Disable Dart/Flutter analytics and telemetry.
2023export CI=true
2124export FLUTTER_SUPPRESS_ANALYTICS=true
@@ -52,9 +55,17 @@ APP_NAME_ID="${APP_NAME_ID:?APP_NAME_ID not set}"
5255APP_VERSION=" ${APP_VERSION:? APP_VERSION not set} "
5356APP_BUILD_NUMBER=" ${APP_BUILD_NUMBER:? APP_BUILD_NUMBER not set} "
5457
58+ # Go: offline builds for flutter_mwebd.
59+ export GOMODCACHE=" /sw/go-cache"
60+ export GOFLAGS=" -buildvcs=false"
61+ export GONOSUMCHECK=" *"
62+ export GONOSUMDB=" *"
63+ export GOPROXY=off
64+
5565RUST_VERSION_DEFAULT=" ${RUST_VERSION_DEFAULT:- 1.89.0} "
5666RUST_VERSION_MWC=" ${RUST_VERSION_MWC:- 1.85.1} "
5767RUST_VERSION_FROSTDART=" ${RUST_VERSION_FROSTDART:- 1.71.0} "
68+ RUST_VERSION_XELIS=" ${RUST_VERSION_XELIS:- 1.91.0} "
5869
5970echo " --- [build] Host: ${HOST} "
6071echo " --- [build] App: ${APP_NAME_ID} v${APP_VERSION} +${APP_BUILD_NUMBER} "
@@ -75,6 +86,10 @@ set_rust_version() {
7586 export CARGO_HOME=" ${CARGO_CACHE_MOUNT} "
7687 export RUSTUP_HOME=" /tmp/fake-rustup"
7788
89+ # Rust 1.91+ build scripts need libgcc_s.so.1 which lives at /lib/ in the
90+ # Guix FHS emulation. Set LD_LIBRARY_PATH so the linker can find it.
91+ export LD_LIBRARY_PATH=" /lib:/lib64:/usr/lib"
92+
7893 echo " --- [build] Rust version: $( rustc --version) "
7994}
8095
@@ -146,7 +161,7 @@ case "\$*" in
146161 echo "${BUILT_COMMIT_HASH:- 0000000000000000000000000000000000000000} "
147162 exit 0
148163 ;;
149- *pull*)
164+ *pull*|*fetch* )
150165 exit 0
151166 ;;
152167 *clone*)
@@ -346,6 +361,11 @@ source "$BUILD_DIR/scripts/app_config/configure_${APP_NAME_ID}.sh" linux
346361# Step 5: Linux platform config.
347362source " $BUILD_DIR /scripts/app_config/platforms/linux/platform_config.sh"
348363
364+ # Step 6: Run prebuild.sh to create stub external_api_keys.dart etc.
365+ pushd " $BUILD_DIR /scripts" > /dev/null
366+ bash prebuild.sh
367+ popd > /dev/null
368+
349369# ###############
350370# GCC compat #
351371# ###############
@@ -428,6 +448,10 @@ case "$APP_NAME_ID" in
428448 setup_cargo_vendor " epiccash" " ${CRYPTO_DIR} /flutter_libepiccash/rust"
429449 (
430450 cd " ${CRYPTO_DIR} /flutter_libepiccash/scripts/linux"
451+ # GCC 15 in Guix: libstdc++ was built without C99 fenv support,
452+ # so <cfenv> never exposes fesetround/fegetround. Force the
453+ # config macros so the C++ wrapper actually includes <fenv.h>.
454+ export CXXFLAGS=" ${CXXFLAGS:- } -D_GLIBCXX_HAVE_FENV_H=1 -D_GLIBCXX_USE_C99_FENV=1"
431455 bash build_all.sh
432456 )
433457
@@ -479,16 +503,55 @@ set_rust_version "$RUST_VERSION_DEFAULT"
479503# Cargokit prep #
480504# ###############
481505
482- # Set up cargo vendoring for the tor_ffi_plugin. Cargokit builds tor's Rust
483- # code during `flutter build linux` via cmake. The vendor config must be in
484- # place before cmake runs.
485- for _tor_rust in " ${PUB_CACHE_MOUNT} " /git/tor-* /rust; do
486- if [ -f " $_tor_rust /Cargo.toml" ]; then
487- echo " --- [build] Setting up cargo vendor for tor_ffi_plugin ..."
488- setup_cargo_vendor " tor" " $_tor_rust "
506+ # Cargokit plugins (tor_ffi_plugin, xelis_flutter) build Rust code during
507+ # `flutter build linux` via cmake. Cargokit's run_build_tool.sh changes
508+ # directory to a temp folder before invoking cargo. Cargo searches for
509+ # .cargo/config.toml from CWD upwards, so per-workspace configs are not
510+ # found. Solution: give each Cargokit plugin its own CARGO_HOME with the
511+ # correct vendor config. We patch each plugin's run_build_tool.sh to
512+ # export CARGO_HOME before running the Dart build tool.
513+
514+ echo " --- [build] Setting up Cargokit vendor configs for offline Rust builds ..."
515+
516+ # Helper: create a per-plugin CARGO_HOME with vendor config.
517+ setup_cargokit_plugin () {
518+ local plugin_name=" $1 "
519+ local plugin_dir=" $2 " # root of the plugin (contains cargokit/, rust/, linux/)
520+ local rust_dir=" $plugin_dir /rust"
521+
522+ # Set up workspace-level vendor config (for any direct cargo invocations).
523+ setup_cargo_vendor " $plugin_name " " $rust_dir "
524+
525+ # Create a per-plugin CARGO_HOME with the same config.
526+ local cargo_home=" /tmp/cargo-home-${plugin_name} "
527+ mkdir -p " $cargo_home "
528+ cp " $rust_dir /.cargo/config.toml" " $cargo_home /config.toml"
529+
530+ # Patch run_build_tool.sh to export this CARGO_HOME before running Dart.
531+ local rbt=" $plugin_dir /cargokit/run_build_tool.sh"
532+ if [ -f " $rbt " ]; then
533+ sed -i " 2i export CARGO_HOME=\" ${cargo_home} \" " " $rbt "
534+ fi
535+ }
536+
537+ for _tor_dir in " ${PUB_CACHE_MOUNT} " /git/tor-* /; do
538+ if [ -f " $_tor_dir /rust/Cargo.toml" ]; then
539+ setup_cargokit_plugin " tor" " $_tor_dir "
489540 break
490541 fi
491542done
543+ for _xelis_dir in " ${PUB_CACHE_MOUNT} " /git/xelis-flutter-ffi-* / " ${PUB_CACHE_MOUNT} " /git/xelis_flutter-* / " ${PUB_CACHE_MOUNT} " /git/xelis-flutter-* /; do
544+ if [ -f " $_xelis_dir /rust/Cargo.toml" ]; then
545+ setup_cargokit_plugin " xelis" " $_xelis_dir "
546+ break
547+ fi
548+ done
549+
550+ # Use the highest Rust version for the flutter build phase.
551+ # Cargokit plugins (tor, xelis) build via cmake during `flutter build linux`.
552+ # Our rustup shim ignores rust-toolchain.toml, so we must set PATH to a
553+ # version that satisfies all plugins. 1.91.0 >= all requirements.
554+ set_rust_version " $RUST_VERSION_XELIS "
492555
493556# ###############
494557# Flutter build #
0 commit comments