Skip to content
Open
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
12 changes: 12 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Linux builds link with mold through scripts/link-mold.sh, which stops the build with an
# install hint when mold is missing. The wrapper is set as the linker rather than through
# `rustflags`, because an environment RUSTFLAGS (`-D warnings`, the `-C target-cpu` tiers
# set by `just build`) replaces config rustflags and would silently drop the linker choice.
# Cargo resolves this relative path against the repository root. Cargo reads this file only
# when it runs inside the repository (cwd, not --manifest-path, decides), so run it from here;
# `just`, build-deb.sh and the harnesses do. macOS keeps Apple's linker.
[target.x86_64-unknown-linux-gnu]
linker = "scripts/link-mold.sh"

[target.aarch64-unknown-linux-gnu]
linker = "scripts/link-mold.sh"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ docker/config
!/.gitignore
!/.gitattributes
!/.vale.ini
!/.cargo/
!.github/
!.github/**

Expand Down
2 changes: 1 addition & 1 deletion linux/pkg/deb-rustyget/build-deb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# Build the side-by-side `rustyget` .deb on a Debian/Ubuntu host of the target arch.
# Needs: build-essential pkg-config libssl-dev python3 just dpkg-dev, rustup.
# Needs: build-essential pkg-config libssl-dev mold python3 just dpkg-dev, rustup.
# Usage: linux/pkg/deb-rustyget/build-deb.sh [jobs] -> build/deb/rustyget_<ver>_<arch>.deb
set -eu

Expand Down
5 changes: 5 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,10 @@ codegen-units = 1
panic = "abort"
debug = 1

# Debug and test builds (the test profile inherits this) keep file:line in panics,
# backtraces and gdb/lldb `bt`, but no variable debug info: 4-9 s less per
# `cargo build --tests` on the build farm (benchmark LB-1). For a debugger session
# with variables, build with CARGO_PROFILE_DEV_DEBUG=true.
[profile.dev]
panic = "abort"
debug = "line-tables-only"
15 changes: 15 additions & 0 deletions scripts/link-mold.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Cargo's linker for Linux builds (see .cargo/config.toml): the system C compiler
# driver, told to link with mold. mold links the test binaries and the daemon several
# times faster than GNU ld, and faster than the rust-lld Rust uses on x86_64 by default.
#
# A missing mold is an error, never a silent fallback to another linker, so a build
# host without it is noticed and fixed instead of quietly building slower.
if ! command -v ld.mold >/dev/null 2>&1; then
echo "error: RustyGet links Linux builds with mold, which is not installed." >&2
echo " Debian/Ubuntu: sudo apt install mold Fedora: sudo dnf install mold" >&2
echo " Arch: sudo pacman -S mold (see site/content/install.md)" >&2
exit 1
Comment on lines +8 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Install mold in Linux CI before making it mandatory

On Linux CI runners without ld.mold, this new guard terminates linking, but .github/workflows/build.yml still installs only build-essential pkg-config libssl-dev just python3 par2 before running cargo test. The required Linux x86_64 and arm64 build jobs therefore fail instead of testing the change. .github/workflows/nativeness.yml also omits mold before its Clippy invocation. Add the dependency to both workflows in the same change rather than leaving CI provisioning as a follow-up. This also conflicts with AGENTS.md's requirement that “A change must also build and pass on Linux.”

AGENTS.md reference: AGENTS.md:L65-L69

Useful? React with 👍 / 👎.

fi
# -fuse-ld comes last so it overrides the -fuse-ld=lld rustc passes on x86_64.
exec "${RUSTYGET_LINK_CC:-cc}" "$@" -fuse-ld=mold
3 changes: 2 additions & 1 deletion site/content/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ lede = "RustyGet runs on Linux and macOS, and builds from source with Just and R
|---|---|---|
| `just` | any current | Command runner used for building, testing, and packaging (`justfile`). |
| C compiler and linker | any current GCC or Clang | Rust links with it, and the `zstd` crate builds the C zstd library with it. No C++ is compiled. |
| `mold` | any current (Linux only) | The linker for Linux builds, set in `.cargo/config.toml`. A Linux build without `mold` stops with an install hint. macOS uses Apple's linker. |
| Rust | 1.99.0 | Pinned in `rust/rust-toolchain.toml`. With rustup, the right toolchain installs itself on the first build. |
| OpenSSL | any current | For encrypted news-server and HTTPS connections |

Expand All @@ -24,7 +25,7 @@ RustyGet needs no `par2`, `unrar`, or `7z` program: par2 repair and archive extr
Debian 13 and Ubuntu 24.04:

```bash
sudo apt install just build-essential pkg-config libssl-dev
sudo apt install just build-essential pkg-config libssl-dev mold
```

macOS with Homebrew:
Expand Down
Loading