summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f67d983fa100c203cc99f9328241c656347d02ac (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
# Maintainer: Chih-Hsuan Yen <yan12125@gmail.com>
# Contributor: Alexander 'z33ky' Hirsch <1zeeky@gmail.com>
# The following contributors are from the vim-youcompleteme-git AUR package
# Contributor: Babken Vardanyan <483ken 4tgma1l
# Contributor: stykr
# Contributor: Svenstaro
# Contributor: KaiSforza
# Contributor: Simon Gomizelj <simongmzlj@gmail.com>
# Contributor: Daniel Micay <danielmicay@gmail.com>

pkgname=neovim-youcompleteme-core-git
pkgver=r2532.d556a43c
pkgrel=2
pkgdesc='A code-completion engine for Vim'
arch=(i686 x86_64)
url='https://valloric.github.io/YouCompleteMe/'
license=('GPL3')
depends=('neovim' 'boost-libs' 'python>=3.2' 'clang>=6.0'
         'python-bottle' 'python-waitress' 'python-frozendict'
         'python-requests-futures' 'python-future' 'python-neovim')
makedepends=('git' 'cmake' 'boost' 'pybind11')
optdepends=(
  'gocode-git: Go semantic completion'
  'godef-git: Go semantic completion'
  'nodejs-tern: JavaScript semantic completion'
  'racerd-git: Rust semantic completion'
  'typescript: Typescript semantic completion'
  'python-jedi: Python semantic completion'
  'python-regex: improved error handling during startup')
# https://github.com/ycm-core/ycmd/pull/885
#'omnisharp-roslyn: C# semantic completion'

source=(git+https://github.com/ycm-core/YouCompleteMe.git
        git+https://github.com/ycm-core/ycmd.git
        clang_rsrc_dir.patch)
sha256sums=('SKIP'
            'SKIP'
            'b1cb4e247e23954ddc02b11b8f9e61b822f544425b51f12f4ac569ce1c8de405')

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


prepare() {
  mkdir -p ycmd_build

  cd YouCompleteMe

  git submodule init third_party/ycmd
  git config submodule.third_party/ycmd.url "$srcdir/ycmd"
  git submodule update

  cd third_party/ycmd
  patch -Np1 -i ../../../clang_rsrc_dir.patch

  # Force system headers/libs
  cd cpp
  rm -rf BoostParts llvm pybind11
}

build() {
  cd ycmd_build

  cmake \
    -DUSE_PYTHON2=OFF \
    -DUSE_SYSTEM_BOOST=ON \
    -DUSE_CLANG_COMPLETER=ON \
    -DUSE_SYSTEM_LIBCLANG=ON \
    ../YouCompleteMe/third_party/ycmd/cpp

  make ycm_core
}

package() {
  pkg_ycmd_dir="$pkgdir/usr/share/nvim/runtime/third_party/ycmd"

  cd YouCompleteMe
  install -Ddm755 "$pkg_ycmd_dir"

  cp -dr --no-preserve=ownership autoload doc plugin python "$pkgdir/usr/share/nvim/runtime"
  cp -dr --no-preserve=ownership third_party/ycmd/{ycmd,ycm_core.so,CORE_VERSION} "$pkg_ycmd_dir"
  install -Ddm755 "$pkg_ycmd_dir/third_party/clang/lib/"
  ln -s /usr/lib/libclang.so "$pkg_ycmd_dir/third_party/clang/lib/libclang.so"
  ln -s /usr/lib/clang "$pkg_ycmd_dir/third_party/clang/lib/clang"
  install -Ddm755 "$pkg_ycmd_dir/third_party/clangd/output/bin"
  ln -s /usr/bin/clangd "$pkg_ycmd_dir/third_party/clangd/output/bin/clangd"

  install -Ddm755 "$pkg_ycmd_dir/third_party/tern_runtime/node_modules/"
  install -Ddm755 "$pkg_ycmd_dir/third_party/gocode/"
  install -Ddm755 "$pkg_ycmd_dir/third_party/godef/"
  ln -s /usr/lib/node_modules/tern "$pkg_ycmd_dir/third_party/tern_runtime/node_modules/"
  ln -s /usr/bin/gocode "$pkg_ycmd_dir/third_party/gocode/"
  ln -s /usr/bin/godef "$pkg_ycmd_dir/third_party/godef/"

  find "$pkgdir" \( -name .git -or -name 'test*' -or -name 'run_tests.py' \) -exec rm -fr {} +

  python -m compileall -d /usr/share/nvim/runtime "$pkgdir/usr/share/nvim/runtime"
  python -O -m compileall -d /usr/share/nvim/runtime "$pkgdir/usr/share/nvim/runtime"
}