summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: edebcd80e423a354ada064585c79d0e5b1b47a5e (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Maintainer: Victor <victor@xirion.net>
# Contributor: Jan-Tarek Butt <tarek AT ring0 DOT de>
# Contributor: Erik Beran <eberan AT gmail DOT com>
# Contributor: Thor K. H. <thor at roht dot no>
# Contributor: Babken Vardanyan <483ken 4tgma1l
# Contributor: mikezackles
# Contributor: z33ky
# Contributor: stykr
# Contributor: Svenstaro
# Contributor: KaiSforza
# Contributor: Simon Gomizelj <simongmzlj@gmail.com>
# Contributor: Daniel Micay <danielmicay@gmail.com>
# Contributor: shmilee
# Contributor: foobster
# Contributor: archdria
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

###########################################################################################################
#                                          Build Options
###########################################################################################################
_omnisharp="y"

_gocode="y"

_rust="y"

_tern="y"

_completer="ON"

###########################################################################################################

pkgname=vim-youcompleteme-git
pkgver=2068.ba779aff
pkgver() {
  cd "YouCompleteMe" || exit
  echo "$(git rev-list --count master).$(git rev-parse --short master)"
}
pkgrel=1
pkgdesc="A code-completion engine for Vim"

arch=('i686' 'x86_64')
url='http://valloric.github.com/YouCompleteMe/'
license=('GPL3')
groups=('vim-plugins')
depends=('boost' 'boost-libs' 'ncurses5-compat-libs' 'mono' 'nodejs' 'python' 'python2' 'rust' 'vim' 'clang')
makedepends=('cargo' 'cmake' 'git' 'go' 'make' 'mono' 'npm')
source=('git+https://github.com/Valloric/YouCompleteMe.git' #ycm
        'git+https://github.com/ross/requests-futures.git'  #ycm
        'git+https://github.com/Valloric/ycmd.git'          #ycm
        'git+https://github.com/kennethreitz/requests.git'  #ycmd
        'git+https://github.com/bewest/argparse.git'        #ycmd
        'git+https://github.com/bottlepy/bottle.git'        #ycmd
        'git+https://github.com/slezica/python-frozendict.git'    #ycmd
        'git+https://github.com/PythonCharmers/python-future.git' #ycmd
        'git+https://github.com/vheon/JediHTTP.git'               #ycmd
        'git+https://github.com/davidhalter/jedi.git'             #jediHTTP
        'git+https://github.com/Pylons/waitress.git'              #ycmd,jediHTTP
        'git+https://github.com/nsf/gocode.git'                   #ycmd
        'git+https://github.com/Manishearth/godef.git'            #ycmd
        'git+https://github.com/nosami/OmniSharpServer.git'       #ycmd
        'git+https://github.com/icsharpcode/NRefactory.git'       #OmniSharpServer
        'git+https://github.com/jbevain/cecil.git'                #OmniSharpServer
        'git+https://github.com/jwilm/racerd.git'                 #ycmd
        )
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP'
            'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
install=install

prepare() {
  msg2 'Setting up Git submodules...'

  YouCompleteMe=("requests-futures" "ycmd")
  gitprepare "YouCompleteMe" "third_party/" "${YouCompleteMe[@]}"

  ycmd=("argparse" "bottle" "python-frozendict" "python-future" "JediHTTP" "waitress" "gocode" "godef" "OmniSharpServer" "requests" "racerd")
  gitprepare "YouCompleteMe/third_party/ycmd" "third_party/" "${ycmd[@]}"

  JediHTTP=("argparse" "waitress" "jedi" "bottle")
  gitprepare "YouCompleteMe/third_party/ycmd/third_party/JediHTTP" "vendor/" "${JediHTTP[@]}"

  OmniSharpServer=("NRefactory" "cecil")
  gitprepare "YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer" "" "${OmniSharpServer[@]}"
}

gitprepare() {
  CD_DIR=$1
  GIT_PREFIX=$2
  c=0
  for val in "$@" ; do
    if [ $c -gt 1 ]; then
      FEED[$c]=$val
    fi
    c=$(( c + 1 ))
  done
  cd "$srcdir/$CD_DIR" || exit
  git submodule init
  for GITSUBVAR in "${FEED[@]}" ; do
    git config submodule."$GIT_PREFIX$GITSUBVAR".url "$srcdir/$GITSUBVAR"
  done
  git submodule update
  unset -v FEED
}

build() {
  msg2 'Building ycmd...' # BuildYcmdLibs()
  mkdir -p "$srcdir/ycmd_build"
  cd "$srcdir/ycmd_build" || exit
  cmake -G "Unix Makefiles" -DUSE_SYSTEM_LIBCLANG="$_completer" . "$srcdir/YouCompleteMe/third_party/ycmd/cpp"
  make ycm_core

  if [ "$_omnisharp" = "y" ]; then
    msg2 'Building OmniSharp completer...' # BuildOmniSharp()
    cd "$srcdir/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer" || exit
    pwd
    xbuild /property:Configuration=Release
  else
    msg2 'Skipping OmniSharp completer...'
  fi

  if [ "$_gocode" = "y" ]; then
    msg2 'Building Gocode completer...' # BuildGoCode()
    cd "$srcdir/YouCompleteMe/third_party/ycmd/third_party/gocode" || exit
    pwd
    go build
    cd "$srcdir/YouCompleteMe/third_party/ycmd/third_party/godef" || exit
    pwd
    go build
  else
    msg2 'Skipping Gocode completer...'
  fi

  if [ "$_rust" = "y" ]; then
    msg2 'Building Rust completer...' # BuildRacerd()
    cd "$srcdir/YouCompleteMe/third_party/ycmd/third_party/racerd" || exit
    pwd
    cargo build --release
  else
    msg2 'Skipping Rust completer...'
  fi

  if [ "$_tern" = "y" ]; then
    msg2 'Building Tern completer...' # SetUpTern()
    cd "$srcdir/YouCompleteMe/third_party/ycmd/third_party/tern_runtime" || exit
    pwd
    npm install --production --python=python2
  else
    msg2 'Skipping Tern completer...'
  fi
}

package() {
  mkdir -p "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party"

  cp -r "$srcdir/YouCompleteMe/"{autoload,doc,plugin,python} \
    "$pkgdir/usr/share/vim/vimfiles"
  cp -r "$srcdir/YouCompleteMe/third_party/"{pythonfutures,requests-futures} \
    "$pkgdir/usr/share/vim/vimfiles/third_party"
  cp -r "$srcdir/YouCompleteMe/third_party/ycmd/"{ycmd,ycm_core.so,CORE_VERSION,cpp,clang_includes} \
    "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd"
  cp -r "$srcdir/YouCompleteMe/third_party/ycmd/third_party/"{argparse,bottle,frozendict,JediHTTP,python-future,requests,waitress} \
    "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party"

  if [ "$_omnisharp" = "y" ]; then
    mkdir -p "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/OmniSharpServer/OmniSharp/bin/Release"
    cp -r "$srcdir/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp/bin/Release" \
      "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/OmniSharpServer/OmniSharp/bin"
  fi

  if [ "$_gocode" = "y" ]; then
    mkdir -p "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/gocode"
    mkdir -p "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/godef"
    cp    "$srcdir/YouCompleteMe/third_party/ycmd/third_party/gocode/gocode" \
      "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/gocode/gocode"
    cp    "$srcdir/YouCompleteMe/third_party/ycmd/third_party/godef/godef" \
      "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/godef/godef"
  fi

  if [ "$_rust" = "y" ]; then
    mkdir -p "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/racerd/target/release"
    cp    "$srcdir/YouCompleteMe/third_party/ycmd/third_party/racerd/target/release/racerd" \
      "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party/racerd/target/release/racerd"
  fi

  if [ "$_tern" = "y" ]; then
    cp -r "$srcdir/YouCompleteMe/third_party/ycmd/third_party/tern_runtime" \
      "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/third_party"
  fi

  find "$pkgdir" -name .git -exec rm -fr {} +
  rm -rf "$pkgdir/usr/share/vim/vimfiles/third_party/ycmd/ycmd/tests"
}