-
-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PKGBUILD that prioritises the settings in ~/.cargo/config.toml Support for musl-targeted static links.
- Loading branch information
1 parent
439c0d0
commit c86a822
Showing
1 changed file
with
29 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,60 @@ | ||
# $Id$ | ||
# Maintainer: Morgan <[email protected]> | ||
# Contributor: Masato TOYOSHIMA <[email protected]> | ||
pkgname=paru-static | ||
_pkgname=paru | ||
pkgname=paru | ||
pkgver=2.0.1 | ||
pkgrel=5 | ||
pkgrel=2 | ||
pkgdesc='Feature packed AUR helper' | ||
url='https://github.com/morganamilo/paru' | ||
source=("$_pkgname-$pkgver.tar.gz::https://github.com/Morganamilo/paru/archive/v$pkgver.tar.gz") | ||
source=("$pkgname-$pkgver.tar.gz::https://github.com/Morganamilo/paru/archive/v$pkgver.tar.gz") | ||
backup=("etc/paru.conf") | ||
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64') | ||
license=('GPL3') | ||
makedepends=('rustup' 'cargo' 'musl') | ||
depends=('git' 'pacman' 'paru') | ||
makedepends=('cargo') | ||
depends=('git' 'pacman') | ||
optdepends=('bat: colored pkgbuild printing' 'devtools: build in chroot and downloading pkgbuilds') | ||
sha256sums=('47cae94d227cc08f86706408d234444af6dda192ba24309c251a0b43a8aa7980') | ||
|
||
# musl | ||
TARGET="$CARCH-unknown-linux-musl" | ||
# musl build for openssl-sys | ||
export PKG_CONFIG_ALLOW_CROSS=1 | ||
export RUSTUP_TOOLCHAIN=stable | ||
_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 "${srcdir}/$_pkgname-$pkgver" | ||
# target add musl | ||
rustup target add $TARGET | ||
_srcenv | ||
cargo fetch --locked --target $TARGET | ||
} | ||
|
||
build () { | ||
cd "$srcdir/$_pkgname-$pkgver" | ||
|
||
# static link | ||
if [[ $TARGET =~ musl ]]; then | ||
_features+="static," | ||
fi | ||
_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 --target $TARGET | ||
#./scripts/mkmo locale/ | ||
./scripts/mkmo locale/ | ||
} | ||
|
||
package() { | ||
cd "$srcdir/$_pkgname-$pkgver" | ||
|
||
install -Dm755 target/$TARGET/release/paru "${pkgdir}/usr/bin/paru-static" | ||
#install -Dm644 paru.conf "${pkgdir}/etc/paru.conf" | ||
_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" | ||
#install -Dm644 man/paru.conf.5 "$pkgdir/usr/share/man/man5/paru.conf.5" | ||
install -Dm644 man/paru.8 "$pkgdir/usr/share/man/man8/paru.8" | ||
install -Dm644 man/paru.conf.5 "$pkgdir/usr/share/man/man5/paru.conf.5" | ||
|
||
#install -Dm644 completions/bash "${pkgdir}/usr/share/bash-completion/completions/paru.bash" | ||
#install -Dm644 completions/fish "${pkgdir}/usr/share/fish/vendor_completions.d/paru.fish" | ||
#install -Dm644 completions/zsh "${pkgdir}/usr/share/zsh/site-functions/_paru" | ||
install -Dm644 completions/bash "${pkgdir}/usr/share/bash-completion/completions/paru.bash" | ||
install -Dm644 completions/fish "${pkgdir}/usr/share/fish/vendor_completions.d/paru.fish" | ||
install -Dm644 completions/zsh "${pkgdir}/usr/share/zsh/site-functions/_paru" | ||
|
||
#install -d "$pkgdir/usr/share/" | ||
#cp -r locale "$pkgdir/usr/share/" | ||
install -d "$pkgdir/usr/share/" | ||
cp -r locale "$pkgdir/usr/share/" | ||
} |