From 01c84cec6f260b84f98fef2961dd66e293fa5b0f Mon Sep 17 00:00:00 2001 From: Felitendo Date: Fri, 18 Sep 2026 00:13:34 +0200 Subject: [PATCH] build: add a fast local build mode --- README.md | 3 +++ scripts/build.sh | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index fb2fd0f..f65f79f 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,9 @@ scripts/check.sh # assert the patches still do what they claim scripts/build.sh # build installers into build/artifacts ``` +`FAST=1 scripts/build.sh` builds with thin link-time optimization instead of the full one, which +roughly halves the Rust build at the cost of a few megabytes. Releases are built without it. + `build/` is scratch space and is never committed. ## Working on the patches diff --git a/scripts/build.sh b/scripts/build.sh index 8f617da..4f106b2 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -97,6 +97,15 @@ fi # v1.2.3-2 from v1.2.3, since the app's own version cannot carry it. export MODRINTH_ENHANCED_REVISION="${MODRINTH_ENHANCED_REVISION:-1}" +# A local build to try something out does not need the last few percent of the +# release profile. Thin LTO across several cores takes well under half the time +# of the full one, for an installer some megabytes larger. +if [ -n "${FAST:-}" ]; then + export CARGO_PROFILE_RELEASE_LTO=thin + export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 + warn "FAST is set, so this build is optimized less than a release" +fi + # Emptied before the build, not after it: a build that fails halfway would # otherwise leave the previous run's installers sitting here, where # scripts/check.sh would happily pass them off as this build's output.