123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #!/bin/sh
- set -euC
- vimgodir=$(cd -P "$(dirname "$0")/.." > /dev/null && pwd)
- cd "$vimgodir"
- vim=${1:-}
- case "$vim" in
- "vim-7.4")
-
- tag="v7.4.1689"
- giturl="https://github.com/vim/vim"
- ;;
- "vim-8.0")
-
-
-
- tag="v8.0.1176"
- giturl="https://github.com/vim/vim"
- ;;
- "nvim")
-
- tag="v0.2.0"
- giturl="https://github.com/neovim/neovim"
- ;;
- *)
- echo "unknown version: '${1:-}'"
- echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
- exit 1
- ;;
- esac
- srcdir="/tmp/vim-go-test/$1-src"
- installdir="/tmp/vim-go-test/$1-install"
- if [ -d "$installdir" ]; then
- echo "$installdir exists; skipping build."
-
- echo "installed to: $installdir"
- exit 0
- fi
- mkdir -p "$srcdir"
- cd "$srcdir"
- if [ "$1" = "nvim" ]; then
-
- curl -Ls https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz |
- tar xzf - -C /tmp/vim-go-test/
- mv /tmp/vim-go-test/nvim-linux64 /tmp/vim-go-test/nvim-install
- mkdir -p "$installdir/share/nvim/runtime/pack/vim-go/start"
- ln -s "$vimgodir" "$installdir/share/nvim/runtime/pack/vim-go/start/vim-go"
-
- mv "$installdir/bin/nvim" "$installdir/bin/vim"
- mkdir -p "$installdir/share/vim/vimgo/pack"
- ln -s "$installdir/share/nvim/runtime/pack/vim-go" "$installdir/share/vim/vimgo/pack/vim-go"
- else
- if [ -d "$srcdir/.git" ]; then
- echo "Skipping clone as $srcdir/.git exists"
- else
- echo "Cloning $tag from $giturl"
- git clone --branch "$tag" --depth 1 "$giturl" "$srcdir"
- fi
- ./configure --prefix="$installdir" --with-features=huge --disable-gui
- make install
- mkdir -p "$installdir/share/vim/vimgo/pack/vim-go/start"
- ln -s "$vimgodir" "$installdir/share/vim/vimgo/pack/vim-go/start/vim-go"
- fi
- echo "Installing Go binaries"
- export GOPATH=$installdir
- export PATH=${GOPATH}/bin:$PATH
- "$vimgodir/scripts/run-vim" $vim +':silent :GoUpdateBinaries' +':qa'
- echo "Installing lint tools"
- (
- mkdir -p "$installdir/share/vim/vimgo/pack/vim-go/start/"
- cd "$installdir/share/vim/vimgo/pack/vim-go/start/"
- [ -d "vim-vimhelplint" ] || git clone --depth 1 --quiet https://github.com/machakann/vim-vimhelplint
- [ -d "vim-vimlparser" ] || git clone --depth 1 --quiet https://github.com/ynkdir/vim-vimlparser
- [ -d "vim-vimlint" ] || git clone --depth 1 --quiet https://github.com/syngan/vim-vimlint
- )
- rm -rf "$srcdir"
- echo "installed to: $installdir"
|