summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: edb268a2593d85f304977cceada3bbed09c9dd85 (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: Zhiwei Chen <condy0919@gmail.com>

_pkgname=ocaml-lsp
pkgname=ocaml-lsp-git
pkgver=r297.5e864ab
pkgrel=1
pkgdesc="OCaml Language Server Protocol implementation"
arch=('x86_64')
depends=('ocaml' 'ocaml-yojson' 'ocaml-ppx_yojson_conv_lib')
makedepends=('git' 'dune>=1.11')
url="https://github.com/ocaml/ocaml-lsp"
license=('ISC')
source=("${_pkgname}"::'git+https://github.com/ocaml/ocaml-lsp.git')
sha256sums=('SKIP')
options=('!strip')
provides=('ocaml-lsp')
conflicts=('ocaml-lsp')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/${_pkgname}"
  git submodule update --init --recursive
}

build() {
  cd "${srcdir}/${_pkgname}"

  dune build
}

package() {
  cd "${srcdir}/${_pkgname}"

  DESTDIR="${pkgdir}" dune install --prefix "/usr" --libdir "lib/ocaml"

  # Dune installs documentation in /usr/doc, fix that.
  install -dm755 "${pkgdir}/usr/share/"
  mv "${pkgdir}/usr/doc" "${pkgdir}/usr/share/"

  rm "${pkgdir}"/usr/lib/ocaml/ocaml-lsp-server/dune-package
  rm "${pkgdir}"/usr/lib/ocaml/lsp/dune-package
}