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

pkgname=ghcup-hs-static-git
_pkgname="${pkgname%-static-git}"
pkgver=0.1.30.0.r127.g6477a30
pkgrel=1
pkgdesc='GHC toolchain installer'
arch=('x86_64' 'aarch64' 'armv7h' 'i686')
url="https://www.haskell.org/ghcup/"
license=('LGPL-3.0-only')
makedepends=(git stack yq)
depends=(gmp bzip2 zlib)
optdepends=('curl'
            'wget'
            'ncurses: for the TUI'
            "ncurses5-compat-libs: using older ghc's linking against libtinfo.so.5")
provides=("$_pkgname" "$_pkgname"-bin)
conflicts=("$_pkgname" "$_pkgname"-bin)
source=($pkgname::git+https://github.com/haskell/ghcup-hs)
sha256sums=('SKIP')
install="$_pkgname.install"

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

prepare() {
    cd "$pkgname"

    # enable tests
    yq -i --yaml-output \
        '.build."test-arguments"."no-run-tests" = false' stack.yaml
}

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

check() {
    cd "${pkgname}"
    stack test
}

package() {
    cd "${pkgname}"
    stack install --local-bin-path "${pkgdir}/usr/bin"

    _install_completion_script bash bash-completion/completions/ghcup
    _install_completion_script zsh zsh/site-functions/_ghcup
    _install_completion_script fish fish/vendor_completions.d/ghcup.fish
}

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