Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ AWS_LC_SYS_CFLAGS = "-fno-lto"
# ---

[alias]
build-dist-appimage = "--config .cargo/dist.toml build -Z build-std=std,panic_abort --release --no-default-features --features dist-appimage"
build-dist-windows = "--config .cargo/dist.toml build -Z build-std=std,panic_abort --release --no-default-features --features dist-windows"
build-dist-macos = "--config .cargo/dist.toml build -Z build-std=std,panic_abort --release --no-default-features --features dist-macos"
build-dist-appimage = "--config .cargo/dist.toml --config .cargo/vendor.toml build -Z build-std=std,panic_abort --release --frozen --no-default-features --features dist-appimage"
build-dist-flatpak = "--config .cargo/vendor.toml build --release --frozen --no-default-features --features dist-flatpak"
build-dist-windows = "--config .cargo/dist.toml --config .cargo/vendor.toml build -Z build-std=std,panic_abort --release --frozen --no-default-features --features dist-windows"
build-dist-macos = "--config .cargo/dist.toml --config .cargo/vendor.toml build -Z build-std=std,panic_abort --release --frozen --no-default-features --features dist-macos"
4 changes: 2 additions & 2 deletions .cargo/dist.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -- Environment variables (mainly for C dependencies) -- #
[env]
AWS_LC_SYS_NO_JITTER_ENTROPY = "1"
AWS_LC_SYS_CFLAGS = "-fno-lto"
Expand Down Expand Up @@ -53,8 +54,7 @@ AR_aarch64_apple_darwin = "llvm-ar"
CFLAGS_aarch64_apple_darwin = "-O3 -flto"
CXXFLAGS_aarch64_apple_darwin = "-O3 -flto"

# ---

# -- Linker config -- #
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "linker-plugin-lto", "-C", "link-arg=-fuse-ld=lld"]
Expand Down
10 changes: 10 additions & 0 deletions .cargo/vendor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[source.crates-io]
replace-with = "vendored-sources"

[source."git+https://github.com/wiidev/nod.git?branch=fix-block-handling"]
git = "https://github.com/wiidev/nod.git"
branch = "fix-block-handling"
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
73 changes: 68 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,50 @@ env:
VERSION_NAME: ${{ github.ref_type == 'tag' && github.ref_name || github.sha }}

jobs:
cargo-vendor:
name: Vendor dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 1

- name: Install just
uses: extractions/setup-just@v4

- name: Cache vendor tarball
id: cache-vendor-tarball
uses: actions/cache@v6
with:
path: vendor.tar.zst
key: cargo-vendor-${{ hashFiles('Cargo.lock') }}
enableCrossOsArchive: true

- name: Install Rust
if: steps.cache-vendor-tarball.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@1.99
with:
components: rust-src

- name: Make vendor tarball
if: steps.cache-vendor-tarball.outputs.cache-hit != 'true'
run: just make-vendor-tarball

- name: Upload vendor tarball artifact
uses: actions/upload-artifact@v7
with:
name: dist-vendor
path: vendor.tar.zst
compression-level: 0

# ==================================================================================
# Build & Bundle Jobs
# ==================================================================================
build-linux:
name: Build for Linux
runs-on: ${{ matrix.runner }}
needs: [cargo-vendor]
strategy:
fail-fast: false
matrix:
Expand All @@ -52,12 +90,18 @@ jobs:
- name: Build docker image
run: docker build -f dockerfiles/Dockerfile.${{ matrix.arch }} -t builder .

- name: Download vendor tarball
uses: actions/download-artifact@v8
with:
name: dist-vendor

- name: Extract vendor tarball
run: tar xf vendor.tar.zst

- name: Build and package binary
run: |
docker run -v ${{ github.workspace }}:/work -w /work -e VERSION_NAME builder /bin/bash -c "\
just build-linux-${{ matrix.arch }} && \
just package-linux-${{ matrix.arch }}
"
docker run -v ${{ github.workspace }}:/work -w /work -e VERSION_NAME builder /bin/bash -c \
"just build-linux-${{ matrix.arch }} && just package-linux-${{ matrix.arch }}"

- name: Upload Linux distributables
uses: actions/upload-artifact@v7
Expand All @@ -68,6 +112,7 @@ jobs:
build-windows:
name: Build for Windows
runs-on: windows-2022
needs: [cargo-vendor]
strategy:
fail-fast: false
matrix:
Expand All @@ -93,6 +138,15 @@ jobs:
- name: Install LLVM
run: choco install llvm --version 23.1.3 -y --no-progress

- name: Download vendor tarball
uses: actions/download-artifact@v8
with:
name: dist-vendor

- name: Extract vendor tarball
shell: bash
run: tar xf vendor.tar.zst

- name: Build binary
run: just build-windows-${{ matrix.arch }}

Expand All @@ -108,6 +162,7 @@ jobs:
build-macos:
name: Build for macOS
runs-on: macos-26
needs: [cargo-vendor]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -135,6 +190,14 @@ jobs:
echo "$(brew --prefix llvm@23)/bin" >> "$GITHUB_PATH"
echo "$(brew --prefix lld@23)/bin" >> "$GITHUB_PATH"

- name: Download vendor tarball
uses: actions/download-artifact@v8
with:
name: dist-vendor

- name: Extract vendor tarball
run: tar xf vendor.tar.zst

- name: Build binary
run: just build-macos-${{ matrix.arch }}

Expand Down Expand Up @@ -184,7 +247,7 @@ jobs:
name: Create GitHub Release
if: github.ref_type == 'tag'
runs-on: ubuntu-slim
needs: [build-linux, build-windows, build-macos, build-macos-universal]
needs: [build-linux, build-windows, build-macos-universal, cargo-vendor]
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ target/

.DS_Store

vendor/
dist/
out/
VC-LTL-Binary.7z
Expand Down
14 changes: 13 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
set lazy

[windows]
set shell := ["pwsh", "-NoLogo", "-NoProfile", "-Command"]

export RUSTC_BOOTSTRAP := "1"
export VERSION := replace_regex(read("Cargo.toml"), '(?s).*?\nversion\s*=\s*"([^"]+)".*', "$1")
version_name := env("VERSION_NAME", "dev")

sysroot := `rustc --print sysroot`

default:
@just --list


# cargo-vendor
# ------------

make-vendor-dir:
cargo vendor --locked --sync "{{ sysroot }}/lib/rustlib/src/rust/library/Cargo.toml"

make-vendor-tarball: make-vendor-dir
tar caf vendor.tar.zst vendor


# Linux
# -----

Expand Down
Loading