From 38f969dd7b830da2d6f43c7d4baa5daed320cfae Mon Sep 17 00:00:00 2001 From: Radim Date: Thu, 16 Jan 2025 15:39:00 +0900 Subject: [PATCH] Keep opt profile Based on the suggestion from archseer, the release build will use opt. The release profile will be separate for testing purposes. --- .github/workflows/release.yml | 10 +++++----- Cargo.toml | 4 ++++ book/src/building-from-source.md | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6783f3e8b56b..de0a25f67721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -148,7 +148,7 @@ jobs: run: ${{ env.CARGO }} test --release --locked --target ${{ matrix.target }} --workspace - name: Build release binary - run: ${{ env.CARGO }} build --release --locked --target ${{ matrix.target }} + run: ${{ env.CARGO }} build --profile opt --locked --target ${{ matrix.target }} - name: Build AppImage shell: bash @@ -175,7 +175,7 @@ jobs: mkdir -p "$APP.AppDir"/usr/{bin,lib/helix} - cp "target/${{ matrix.target }}/release/hx" "$APP.AppDir/usr/bin/hx" + cp "target/${{ matrix.target }}/opt/hx" "$APP.AppDir/usr/bin/hx" rm -rf runtime/grammars/sources cp -r runtime "$APP.AppDir/usr/lib/helix/runtime" @@ -204,7 +204,7 @@ jobs: run: | cargo install cargo-deb mkdir -p target/release - cp target/${{ matrix.target }}/release/hx target/release/ + cp target/${{ matrix.target }}/opt/hx target/release/ cargo deb --no-build mkdir -p dist mv target/debian/*.deb dist/ @@ -214,9 +214,9 @@ jobs: run: | mkdir -p dist if [ "${{ matrix.os }}" = "windows-2019" ]; then - cp "target/${{ matrix.target }}/release/hx.exe" "dist/" + cp "target/${{ matrix.target }}/opt/hx.exe" "dist/" else - cp "target/${{ matrix.target }}/release/hx" "dist/" + cp "target/${{ matrix.target }}/opt/hx" "dist/" fi if [ -d runtime/grammars/sources ]; then rm -rf runtime/grammars/sources diff --git a/Cargo.toml b/Cargo.toml index a109fb815436..1d361fcac35f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,10 @@ default-members = [ ] [profile.release] +lto = "thin" + +[profile.opt] +inherits = "release" lto = "fat" codegen-units = 1 strip = true diff --git a/book/src/building-from-source.md b/book/src/building-from-source.md index 688313aa0026..b422f4bf0b5b 100644 --- a/book/src/building-from-source.md +++ b/book/src/building-from-source.md @@ -118,7 +118,7 @@ to package the runtime into `/usr/lib/helix/runtime`. The rough steps a build script could follow are: 1. `export HELIX_DEFAULT_RUNTIME=/usr/lib/helix/runtime` -1. `cargo build --release --locked` +1. `cargo build --profile opt --locked` 1. `cp -r runtime $BUILD_DIR/usr/lib/helix/` 1. `cp target/opt/hx $BUILD_DIR/usr/bin/hx`