summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 819fa02acee488441a3a32abe07bbd3a491f73d6 (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: Luke Arms <luke@arms.to>

pkgname=pretty-php
pkgver=0.4.19
pkgrel=1
pkgdesc="The opinionated formatter for modern, expressive PHP"
arch=('any')
license=('MIT')
url='https://github.com/lkrms/pretty-php'
depends=('php' 'composer')
makedepends=('git' 'jq')
source=("${pkgname}::git+https://github.com/lkrms/pretty-php.git#tag=v${pkgver}")
sha256sums=('SKIP')

prepare() {
    cd "${srcdir}/${pkgname}"
    composer install --no-plugins --no-interaction
}

build() {
    cd "${srcdir}/${pkgname}"
    scripts/build.sh "v$pkgver"
}

check() {
    cd "${srcdir}/${pkgname}"
    local phar
    phar=$(_phar)
    echo "Checking output of \`$phar --version\`"
    "$phar" --version 2>&1 | grep -Fq "pretty-php v${pkgver}-"
}

package() {
    cd "${srcdir}/${pkgname}"
    local phar
    phar=$(_phar)
    install -Dm755 "$phar" "${pkgdir}/usr/bin/pretty-php"
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

_phar() {
    local phar
    phar=$(jq -r \
        '.assets[] | select(.type == "phar") | .path' \
        build/dist/manifest.json)
    printf 'build/dist/%s' "$phar"
}