summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 499299d1c319464eccba774f5c6d07a391a43485 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Maintainer: Max <ulidtko@gmail.com>

pkgname=(haskell-trial haskell-trial-tomland haskell-trial-optparse-applicative)
pkgver=0.0.0.0
pkgrel=1
pkgdesc="Trial Data Structure"
url="https://github.com/kowainik/trial"
license=("MPL2")
arch=('x86_64')
depends=(ghc-libs haskell-colourista haskell-dlist)
makedepends=(cabal-install ghc
             haskell-doctest haskell-hedgehog haskell-hspec haskell-hspec-hedgehog haskell-splitmix
             uusi)
# NOTE: source taken from GH so that all 3 subpackages get built in one go
_commit=5f67d4ad805ec4efb4e53805ff728dc73cb503e8
source=("https://github.com/kowainik/trial/archive/${_commit}.tar.gz")
sha256sums=(1d8760b4cbef4e29fd9895bfdbf1a6a4cf5a31a5fe3e46ee50119ef4912b7d07)

build() {
  cd trial-${_commit}
  build_haskell-trial
  build_haskell-trial-tomland
  build_haskell-trial-optparse-applicative
}

build_haskell-trial() {
  _subpkg=trial
  pushd ${_subpkg}
  gen-setup && uusi --all $_subpkg.cabal

  runhaskell Setup configure -O \
    --enable-shared --enable-executable-dynamic --disable-library-vanilla \
    --prefix=/usr --docdir=/usr/share/doc/haskell-$_subpkg --enable-tests \
    --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid \
    --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
    --ghc-option='-pie' \
    ; # --verbose=1

  runhaskell Setup build
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
  popd
}

build_haskell-trial-tomland() {
  _subpkg=trial-tomland
  pushd ${_subpkg}
  gen-setup && uusi --all $_subpkg.cabal

  runhaskell Setup configure -O \
    --enable-shared --enable-executable-dynamic --disable-library-vanilla \
    --prefix=/usr --docdir=/usr/share/doc/haskell-$_subpkg --enable-tests \
    --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid \
    --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
    --ghc-option='-pie' \
    --package-db="../trial/dist/package.conf.inplace" \
    ; # --verbose=3

  runhaskell Setup build
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
  popd
}
build_haskell-trial-optparse-applicative() {
  _subpkg=trial-optparse-applicative
  pushd ${_subpkg}
  gen-setup && uusi --all $_subpkg.cabal

  runhaskell Setup configure -O \
    --enable-shared --enable-executable-dynamic --disable-library-vanilla \
    --prefix=/usr --docdir=/usr/share/doc/haskell-$_subpkg --enable-tests \
    --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid \
    --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
    --ghc-option='-pie' \
    --package-db="../trial/dist/package.conf.inplace" \
    ; # --verbose=1

  runhaskell Setup build
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
  popd
}

check() {
  #-- tests only exist at the main library subpackage
  cd trial-${_commit}/trial
  runhaskell Setup test
}

package_haskell-trial() {
  cd trial-${_commit}/trial

  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}

package_haskell-trial-tomland() {
  depends=(ghc-libs haskell-tomland haskell-trial)
  pkgdesc="Trial helper functions for tomland"

  cd trial-${_commit}/trial-tomland
  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}

package_haskell-trial-optparse-applicative() {
  depends=(ghc-libs haskell-optparse-applicative haskell-trial)
  pkgdesc="Trial helper functions for optparse-applicative"

  cd trial-${_commit}/trial-optparse-applicative
  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}