summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2ad3bc5833c64e3202f34644949a699c36a903c3 (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
# Maintainer: Andrea Manenti <andrea [dot] manenti [at] yahoo [dot] com>

pkgname=ihaskell-git
pkgver=2129.e0c1a8d
pkgrel=2
pkgdesc="A Haskell backend kernel for the IPython project"
arch=('x86_64')
url="https://github.com/gibiansky/IHaskell"
license=('MIT')
depends=('ghc-libs' 'haskell-aeson' 'haskell-base64-bytestring' 'haskell-cmdargs' 'haskell-ghc'
         'haskell-ghc-parser' 'haskell-ghc-paths' 'hlint' 'haskell-http-client' 'haskell-http-client-tls'
         'haskell-ipython-kernel' 'haskell-random' 'haskell-shelly' 'haskell-split' 'haskell-strict'
         'haskell-unordered-containers' 'haskell-utf8-string' 'haskell-vector' 'jupyterlab')
makedepends=('git' 'ghc' 'haskell-hunit' 'haskell-here' 'haskell-hspec' 'haskell-hspec-contrib'
             'haskell-raw-strings-qq' 'haskell-setenv' 'ghc-static')
conflicts=()
source=("git+https://github.com/gibiansky/IHaskell")
sha256sums=('SKIP')

build() {
  cd IHaskell

  runhaskell Setup configure --ghc-option='-dynamic' --prefix=/usr --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --enable-tests

  runhaskell Setup build
}

 check() {
   cd IHaskell
   export PATH=$PWD/dist/build/ihaskell:$PATH
   export GHC_PACKAGE_PATH=$PWD/dist/package.conf.inplace/:$GHC_PACKAGE_PATH
   runhaskell Setup test
}

package() {
  cd IHaskell

  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/

  _ghc_ver=$(ghc -V | sed -e 's/[A-Za-z, ]\+\([0-9.]\+\)$/\1/')
  _kernel_json_content='{"argv":["/usr/bin/ihaskell","kernel","{connection_file}","--ghclib","/usr/lib/ghc-'$_ghc_ver'","+RTS","-M3g","-N2","-RTS"],"display_name":"Haskell","language":"haskell"}'

  msg2 "Generating kernel.json"
  echo $_kernel_json_content > html/kernel.json

  msg2 "Copying labextension and kernel in jupyter share folder"
  for _file in $(ls jupyterlab-ihaskell/labextension/static)
  do
    install -D -m644 jupyterlab-ihaskell/labextension/static/$_file "$pkgdir"/usr/share/jupyter/labextension/jupyterlab-ihaskell/static/$_file
  done

  install -D -m644 jupyterlab-ihaskell/labextension/package.json "$pkgdir"/usr/share/jupyter/labextension/jupyterlab-ihaskell/package.json

  for _file in $(ls html)
  do
    install -D -m644 html/$_file "$pkgdir"/usr/share/jupyter/kernels/haskell/$_file
  done

}