summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8868cc86625a9fcf8f127322e1d51141f4ad5367 (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
# Maintainer: zer0-x < Matrix: "@zer0-x:kde.org" >

pkgname="git-cm-git"
_pkgname=${pkgname%-git}
pkgver=0.2.3
pkgrel=1
pkgdesc="Easily create conventional-commits friendly commit messages for git"
arch=("x86_64")
url="https://github.com/mainrs/git-cm"
license=("APACHE" "MIT")
depends=("git")
makedepends=("git" "cargo")
provides=(${_pkgname})
conflicts=(${_pkgname})
source=("${pkgname}::git+${url}#branch=main")
sha512sums=("SKIP")

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

prepare() {
    cd "${pkgname}"

    git reset --hard "$(git describe --tags --abbrev=0 --match 'v*')"

    cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
    cd "${pkgname}"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cargo build --frozen --release --all-features
}

package() {
    cd "${pkgname}"

    install -Dm755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"

    install -Dm755 "license-mit" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE-MIT"
    install -Dm755 "license-apache" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE-APACHE"
    install -Dm644 "readme.md" "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
}