summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cc30e7bd56e05f2882bd3d41653d0350f2f03ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Maintainer: Mahor Foruzesh <mahor1221@gmail.com>

pkgname=cargo-limit-git
_pkgname="${pkgname%-git}"
pkgver=0.0.10.r51.g53fc019
_pkgsrc="$_pkgname"
pkgrel=1
pkgdesc="Cargo with less noise"
arch=(x86_64)
url="https://github.com/cargo-limit/cargo-limit"
license=(MIT Apache-2.0)
depends=(cargo gcc-libs glibc)
makedepends=(rust)
source=("git+$url")
sha256sums=('SKIP')

pkgver() {
    cd "$_pkgsrc"
    git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd "$_pkgsrc"
    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "$_pkgsrc"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --frozen --release --all-features
}

check() {
    cd "$_pkgsrc"
    export RUSTUP_TOOLCHAIN=stable
    cargo test --frozen --all-features
}

package() {
    cd "$_pkgsrc"
    install -vDm644 LICENSE-MIT -t "$pkgdir/usr/share/licenses/$_pkgname/"
    install -vDm644 LICENSE-APACHE -t "$pkgdir/usr/share/licenses/$_pkgname/"
    install -vDm644 README.md -t "$pkgdir/usr/share/doc/$_pkgname/"
    find target/release \
        -maxdepth 1 \
        -executable \
        -type f \
        -exec install -Dm0755 -t "$pkgdir/usr/bin/" {} +
}