Allow Arch package builds with a rustup toolchain.
When pacman rust/cargo are missing but cargo is on PATH, run makepkg --nodeps so local builds work without installing the distro Rust packages. Co-authored-by: Cursor <cursoragent@cursor.com>
@@ -48,6 +48,8 @@ chmod +x scripts/build-arch.sh
48
48
./scripts/build-arch.sh --install # build and install with pacman
49
49
```
50
50
51
`build-arch.sh` accepts a **rustup** toolchain on `PATH`. If the pacman `rust`/`cargo` packages are not installed, it runs `makepkg --nodeps` after verifying `rustc`/`cargo` work (the PKGBUILD still lists those packages for AUR/CI).
52
51
53
After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.
52
54
53
55
Outputs:
@@ -48,6 +48,8 @@ chmod +x scripts/build-arch.sh48
./scripts/build-arch.sh --install # build and install with pacman48
./scripts/build-arch.sh --install # build and install with pacman49
```49
```50
50
51
`build-arch.sh` accepts a **rustup** toolchain on `PATH`. If the pacman `rust`/`cargo` packages are not installed, it runs `makepkg --nodeps` after verifying `rustc`/`cargo` work (the PKGBUILD still lists those packages for AUR/CI).52
51
After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.53
After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.52
54
53
Outputs:55
Outputs:@@ -19,6 +19,7 @@ for arg in "$@"; do
19
19
echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"
20
20
echo " --install install the package with pacman after building"
21
21
echo "Without --install, prompts interactively when stdin is a TTY."
22
echo "Uses rustup/cargo on PATH; runs makepkg --nodeps if pacman rust/cargo are absent."
22
23
exit 0
23
24
;;
24
25
*) echo "Unknown option: $arg"; exit 1 ;;
@@ -42,6 +43,26 @@ if ! command -v makepkg &>/dev/null; then
42
43
exit 1
43
44
fi
44
45
46
# Ensure rustup toolchains are visible to makepkg's build().
47
if [[ -f "$HOME/.cargo/env" ]]; then
48
# shellcheck source=/dev/null
49
source "$HOME/.cargo/env"
50
fi
51
52
if ! command -v cargo &>/dev/null || ! command -v rustc &>/dev/null; then
53
echo "cargo/rustc not found. Install via rustup (https://rustup.rs) or: sudo pacman -S rust"
54
exit 1
55
fi
56
57
# PKGBUILD lists pacman rust/cargo as makedepends. rustup installs don't register
58
# those packages, so skip dep resolution when the toolchain is already on PATH.
59
MAKEPKG_NODEPS=false
60
if ! pacman -Q rust &>/dev/null || ! pacman -Q cargo &>/dev/null; then
61
echo "Note: pacman rust/cargo not installed; using toolchain on PATH ($(rustc --version))."
62
echo " makepkg will run with --nodeps."
63
MAKEPKG_NODEPS=true
64
fi
65
45
66
if [[ "$SKIP_TESTS" != "true" ]]; then
46
67
cargo test
47
68
fi
@@ -55,6 +76,9 @@ MAKEPKG_FLAGS=(-f --noconfirm)
55
76
if [[ "$AS_ROOT" == "true" ]]; then
56
77
MAKEPKG_FLAGS+=(--asroot)
57
78
fi
79
if [[ "$MAKEPKG_NODEPS" == "true" ]]; then
80
MAKEPKG_FLAGS+=(--nodeps)
81
fi
58
82
makepkg "${MAKEPKG_FLAGS[@]}"
59
83
60
84
shopt -s nullglob
@@ -19,6 +19,7 @@ for arg in "$@"; do19
echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"19
echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"20
echo " --install install the package with pacman after building"20
echo " --install install the package with pacman after building"21
echo "Without --install, prompts interactively when stdin is a TTY."21
echo "Without --install, prompts interactively when stdin is a TTY."22
echo "Uses rustup/cargo on PATH; runs makepkg --nodeps if pacman rust/cargo are absent."22
exit 023
exit 023
;;24
;;24
*) echo "Unknown option: $arg"; exit 1 ;;25
*) echo "Unknown option: $arg"; exit 1 ;;@@ -42,6 +43,26 @@ if ! command -v makepkg &>/dev/null; then42
exit 143
exit 143
fi44
fi44
45
46
# Ensure rustup toolchains are visible to makepkg's build().47
if [[ -f "$HOME/.cargo/env" ]]; then48
# shellcheck source=/dev/null49
source "$HOME/.cargo/env"50
fi51
52
if ! command -v cargo &>/dev/null || ! command -v rustc &>/dev/null; then53
echo "cargo/rustc not found. Install via rustup (https://rustup.rs) or: sudo pacman -S rust"54
exit 155
fi56
57
# PKGBUILD lists pacman rust/cargo as makedepends. rustup installs don't register58
# those packages, so skip dep resolution when the toolchain is already on PATH.59
MAKEPKG_NODEPS=false60
if ! pacman -Q rust &>/dev/null || ! pacman -Q cargo &>/dev/null; then61
echo "Note: pacman rust/cargo not installed; using toolchain on PATH ($(rustc --version))."62
echo " makepkg will run with --nodeps."63
MAKEPKG_NODEPS=true64
fi65
45
if [[ "$SKIP_TESTS" != "true" ]]; then66
if [[ "$SKIP_TESTS" != "true" ]]; then46
cargo test67
cargo test47
fi68
fi@@ -55,6 +76,9 @@ MAKEPKG_FLAGS=(-f --noconfirm)55
if [[ "$AS_ROOT" == "true" ]]; then76
if [[ "$AS_ROOT" == "true" ]]; then56
MAKEPKG_FLAGS+=(--asroot)77
MAKEPKG_FLAGS+=(--asroot)57
fi78
fi79
if [[ "$MAKEPKG_NODEPS" == "true" ]]; then80
MAKEPKG_FLAGS+=(--nodeps)81
fi58
makepkg "${MAKEPKG_FLAGS[@]}"82
makepkg "${MAKEPKG_FLAGS[@]}"59
83
60
shopt -s nullglob84
shopt -s nullglob