summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 103a9d113ce5524f4958394e1451b2de0e9f178c (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
# Maintainer: Gesh <gesh@gesh.uni.cx>
# Contributor: amesgen <amesgen AT amesgen DOT de>
# Based on ormolu and ormolu-bin by amesgen

pkgname=ormolu-static-git
_pkgname="${pkgname%-static-git}"
pkgver=0.7.3.0.r6.g05647fd
pkgrel=2
pkgdesc="A formatter for Haskell source code"
arch=('i686' 'x86_64')
url="https://github.com/tweag/${_pkgname}"
license=('LicenseRef-BSD-3-Clause')
provides=("$_pkgname")
depends=('gmp')
makedepends=('git' 'stack')
source=("${pkgname}::git+${url}")
sha256sums=('SKIP')

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

prepare() {
    cd "$pkgname"
    stack config set resolver lts-22.19 # ghc-9.6.4
    echo 'compiler: ghc-9.6.5' >> stack.yaml
}

build() {
    cd "${pkgname}"
    stack build
}

package() {
    cd "${pkgname}"
    stack install --local-bin-path "${pkgdir}/usr/bin"
    install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"

    _install_completion_script bash bash-completion/completions/ormolu
    _install_completion_script zsh zsh/site-functions/_ormolu
    _install_completion_script fish fish/vendor_completions.d/ormolu.fish
}

_install_completion_script() {
    install -Dm644 \
        <("$pkgdir/usr/bin/ormolu" --$1-completion-script /usr/bin/ormolu) \
        "$pkgdir/usr/share/$2"
}