# Maintainer: Trent Palmer trenttdually at gmail # Contributor: Victor # Contributor: Jan-Tarek Butt # Contributor: Erik Beran # Contributor: Thor K. H. # Contributor: Babken Vardanyan <483ken 4tgma1l # Contributor: mikezackles # Contributor: z33ky # Contributor: stykr # Contributor: Svenstaro # Contributor: KaiSforza # Contributor: Simon Gomizelj # Contributor: Daniel Micay # Contributor: shmilee # Contributor: foobster # Contributor: archdria # Contributor: Andy Weidenbaum ########################################################################################################### # Build Options ########################################################################################################### # change all build options to no by default _omnisharp="n" _gocode="n" _rust="n" _tern="n" _completer="ON" ########################################################################################################### pkgname=vim-youcompleteme-git pkgver=2373.15362d9c 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' 'armv7h') url='https://github.com/Valloric/YouCompleteMe' license=('GPL3') groups=('vim-plugins') provides=('vim-youcompleteme') conflicts=('') depends=('boost' 'boost-libs' 'ncurses5-compat-libs' 'python' 'python2' 'vim' 'clang') [[ "$_omnisharp" = "y" ]] && depends+=('mono') [[ "$_rust" = "y" ]] && depends+=('rust') [[ "$_tern" = "y" ]] && depends+=('nodejs') makedepends=('cmake' 'git' 'make') [[ "$_omnisharp" = "y" ]] && makedepends+=('mono') [[ "$_rust" = "y" ]] && makedepends+=('cargo') [[ "$_tern" = "y" ]] && makedepends+=('npm') [[ "$_gocode" = "y" ]] && makedepends+=('go') # source=('git+https://github.com/Valloric/YouCompleteMe.git#commit=1080a310274b546a6e7a6ae87aa6c7ea2fa646e7' #ycm 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/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/davidhalter/jedi.git' #ycmd 'git+https://github.com/davidhalter/parso.git' #ycmd 'git+https://github.com/Pylons/waitress.git' #ycmd 'git+https://github.com/micbou/regex.git' #ycmd ) [[ "$_omnisharp" = "y" ]] && source+=('git+https://github.com/icsharpcode/NRefactory.git' #OmniSharpServer 'git+https://github.com/jbevain/cecil.git' #OmniSharpServer 'git+https://github.com/nosami/OmniSharpServer.git' #ycmd ) [[ "$_rust" = "y" ]] && source+=('git+https://github.com/jwilm/racerd.git' #ycmd ) [[ "$_gocode" = "y" ]] && source+=('git+https://github.com/nsf/gocode.git' #ycmd 'git+https://github.com/Manishearth/godef.git' #ycmd ) sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP') [[ "$_omnisharp" = "y" ]] && sha256sums+=('SKIP' 'SKIP' 'SKIP') [[ "$_rust" = "y" ]] && sha256sums+=('SKIP') [[ "$_gocode" = "y" ]] && sha256sums+=('SKIP' 'SKIP') install=install prepare() { msg2 'Setting up Git submodules...' YouCompleteMe=("requests-futures" "ycmd") gitprepare "YouCompleteMe" "third_party/" "${YouCompleteMe[@]}" ycmd=("bottle" "python-frozendict" "python-future" "waitress" "requests" "jedi" "parso" "regex") [[ "$_omnisharp" = "y" ]] && ycmd+=("OmniSharpServer") [[ "$_rust" = "y" ]] && ycmd+=("racerd") [[ "$_gocode" = "y" ]] && ycmd+=("gocode" "godef") gitprepare "YouCompleteMe/third_party/ycmd" "third_party/" "${ycmd[@]}" if [ "$_omnisharp" = "y" ]; then OmniSharpServer=("NRefactory" "cecil") gitprepare "YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer" "" "${OmniSharpServer[@]}" fi } 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/"{bottle,parso,frozendict,jedi,python-future,requests,waitress,cregex} \ "$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 {} + find "$pkgdir" -name .gitignore -exec rm -fr {} + find "$pkgdir" -name tests -exec rm -fr {} + }