If the .cargo/config setting is preferred
diff --git a/PKGBUILD b/PKGBUILD
index 0c6d370..d576559 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -13,30 +13,39 @@ depends=('git' 'pacman')
optdepends=('bat: colored pkgbuild printing' 'devtools: build in chroot and downloading pkgbuilds')
sha256sums=('47cae94d227cc08f86706408d234444af6dda192ba24309c251a0b43a8aa7980')
+_srcenv() {
+ cd "$srcdir/$pkgname-$pkgver"
+ export PKG_CONFIG_ALLOW_CROSS=1
+ export RUSTUP_TOOLCHAIN=stable
+ source <(cargo +nightly -Z unstable-options rustc --print cfg|grep -E "target_(arch|vendor|os|env)")
+ TARGET="${target_arch}-${target_vendor}-${target_os}-${target_env}"
+}
+
prepare() {
- cd "$pkgname-$pkgver"
- cargo fetch --locked --target "$(rustc -vV | sed -n 's|host: ||p')"
+ _srcenv
+ cargo fetch --locked --target $TARGET
}
build () {
- cd "$srcdir/$pkgname-$pkgver"
-
+ _srcenv
if pacman -T pacman-git > /dev/null; then
_features+="git,"
fi
+ if [[ $target_env=="musl" ]]; then
+ _features+="static,"
+ fi
if [[ $CARCH != x86_64 ]]; then
export CARGO_PROFILE_RELEASE_LTO=off
fi
- cargo build --frozen --features "${_features:-}" --release --target-dir target
+ cargo build --frozen --features "${_features:-}" --release --target-dir target --target $TARGET
./scripts/mkmo locale/
}
package() {
- cd "$srcdir/$pkgname-$pkgver"
-
- install -Dm755 target/release/paru "${pkgdir}/usr/bin/paru"
+ _srcenv
+ install -Dm755 target/$TARGET/release/paru "${pkgdir}/usr/bin/paru"
install -Dm644 paru.conf "${pkgdir}/etc/paru.conf"
install -Dm644 man/paru.8 "$pkgdir/usr/share/man/man8/paru.8"
Pinned Comments
haxie commented on 2023-05-26 17:45 (UTC)
you're better off contacting her via the github, this comments section is 90% "it's out of date" from people who didn't scroll down before posting