summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 783e0ca3f23912cdfd7ca25960ad6208fe3005a4 (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
52
53
54
55
56
57
58
59
60
61
62
# Maintainer: Robert L Box <robertbox514@gmail.com>
# Contributor: JokerBoy <jokerboy at punctweb dot com>

pkgname=ls++-git
pkgver=0.62.8.567ff82
pkgrel=1
epoch=1
pkgdesc='Colorized LS on steroids'
url='https://github.com/trapd00r/ls--/'
arch=('any')
license=('GPL2')
depends=('perl-term-extendedcolor') # File::LsColor must be installed manually from CPAN
makedepends=('git' 'cpanminus')
backup=('etc/ls++.conf')
options=('!emptydirs')
provides=('ls++')
conflicts=('ls++')
source=("git+https://github.com/trapd00r/ls--.git#commit=567ff82bfedd345ac3feb89d61b22f3d24726145")
sha256sums=('SKIP')

# Notes for users:
# File::LsColor is required but not in official repos:
#   sudo pacman -S cpanminus
#   sudo cpanm File::LsColor
# This ensures ls++ runs properly.

pkgver() {
    cd "$srcdir/ls--"

    # Get latest tag or fallback
    local _tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0")
    _tag=${_tag#v}

    # Number of commits since tag
    local _commits=$(git rev-list "${_tag}"..HEAD --count 2>/dev/null || git rev-list HEAD --count)

    # Short hash of HEAD
    local _hash=$(git rev-parse --short HEAD)

    echo "${_tag}.${_commits}.${_hash}"
}

build() {
    cd "$srcdir/ls--"
    PERL_MM_USE_DEFAULT=1 \
    PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='${pkgdir}'" \
    PERL_MB_OPT="--installdirs vendor --destdir '${pkgdir}'" \
    MODULEBUILDRC=/dev/null \
    perl Makefile.PL
    make
}

package() {
    cd "$srcdir/ls--"
    make PREFIX=/ DESTDIR="${pkgdir}" install

    # Install default config for backup
    install -Dm644 ls++.conf "${pkgdir}/etc/ls++.conf"
}

# vim: ts=2 sw=2 et: