summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 118f7cf613bdb181c47174c1a068d0039340d49c (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
# Maintainer: Alexander Lyon <arlyon@me.com>
pkgname=instantly
pkgver=0.1.0
pkgrel=2
pkgdesc="Download instagram photos instantly"
url="https://github.com/arlyon/instantly"
license=("MIT")
source=("git+$url#tag=v$pkgver")
md5sums=("SKIP")
arch=("x86_64")
makedepends=("cargo" "git")

pkgver() {
    cd $pkgname
    ( set -o pipefail
        (cat Cargo.toml | grep "version =" | cut -d "\"" -f2 | head -n1) ||                             # Try to parse Cargo.toml
        (git describe --abbrev=0 --tags || echo "$pkgver") | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' || # Try to use latest tag
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"                  # use git revision
    )
}

build() {
    cd $pkgname
    cargo build --release
}

package() {
    cd $pkgname
    usrdir="$pkgdir/usr"
    mkdir -p $usrdir
    install -Dm 755 "target/release/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
    install -Dm 755 "license" "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"
}