summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02ccab8c2479e3a07546191c68770938c58e4483 (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
pkgname="opts-bash"
pkgver=${PKGVER:-autogenerated}
pkgrel=${PKGREL:-1}
pkgdesc="Simple-to-use option parser for bash scripts"
groups=(
    ""
)
arch=("i686" "x86_64")
license=("GPL")
depends=()
makedepends=(
    "git"
)

source=(
    "$pkgname::git+https://github.com/reconquest/opts.bash"
)

md5sums=("SKIP")

pkgver() {
    cd "$srcdir/$pkgname"
    local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
    local count=$(git rev-list --count HEAD)
    local commit=$(git rev-parse --short HEAD)
    echo "$date.${count}_$commit"
}

build() {
    cd "$srcdir/$pkgname"

    git submodule init
    git submodule update

    bash opts.bash
}

package() {
    root=/usr/share/bash/opts/

    cd "$srcdir/$pkgname"

    find \
        -type f -name '*.bash' \
        -not '(' -path '*/.git/*' -o -path '*/tests/*' ')' \
            | xargs -n1 -I{} install -DT "{}" "$pkgdir/$root/{}"
}