Commit 6a48bc3c authored by Chris Thurber's avatar Chris Thurber Committed by GitHub

Merge pull request #2560 from uberhacker/update-vim-package

Update vim and add xdg_base support
parents 74c15b77 674beefd
......@@ -8,22 +8,38 @@ class Vim < Package
source_sha256 '8b69fbd01c877dd8ecbbeca1dc66e5e927228d631ac4c2174b9307eb5c827c86'
binary_url ({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/vim-8.1-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/vim-8.1-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/vim-8.1-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/vim-8.1-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: 'b8a982519a4f0b01410e42a5bb5ed915fca1847d10aca1d17cd7c85c9ef1f8d8',
armv7l: 'b8a982519a4f0b01410e42a5bb5ed915fca1847d10aca1d17cd7c85c9ef1f8d8',
i686: '18fa5898517801da4307f60e4e8ed1e74cd6ee46820f49a8c2cac0ee0458e1c9',
x86_64: '89c090299914ffe373e3d25f42be5e85b888696da4bdb0d21256157cc00cf9ee',
})
depends_on 'compressdoc' => :build
depends_on 'ncurses'
# vim uses shared library of following languages, so need them isntalled at run-time
depends_on 'perl'
depends_on 'python3'
depends_on 'ruby'
depends_on 'xdg_base'
def self.preinstall
configdir = "#{CREW_PREFIX}/.config"
# Save any previous configuration, if it exists.
if Dir.exists? "$HOME/.vim"
system "cp -r $HOME/.vim #{configdir}"
system "mv #{configdir}/.vim #{configdir}/vim"
system "rm -rf $HOME/.vim"
end
if File.exists? "$HOME/.vimrc"
system "cp $HOME/.vimrc #{configdir}/vim/vimrc"
end
end
def self.build
system "./configure \
--prefix=#{CREW_PREFIX} \
--enable-gui=no \
--with-features=huge \
--without-x \
--disable-nls \
--enable-multibyte \
......@@ -31,22 +47,37 @@ class Vim < Package
--enable-perlinterp \
--enable-python3interp \
--enable-rubyinterp \
--with-python3-command=#{CREW_PREFIX}/bin/python3 \
--with-ruby-command=#{CREW_PREFIX}/bin/ruby \
--with-vimdiff \
--with-features=huge \
--disable-selinux"
system "make"
system 'make'
end
def self.install
configdir = "#{CREW_PREFIX}/.config/vim"
configdestdir = "#{CREW_DEST_PREFIX}/.config/vim"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
system "compressdoc --gzip -9 #{CREW_DEST_PREFIX}/share/man/man1"
system "cp #{CREW_DEST_PREFIX}/share/vim/vim81/vimrc_example.vim #{CREW_DEST_PREFIX}/share/vim/vim81/vimrc"
FileUtils.mkdir_p "#{configdestdir}"
system "cp -r #{CREW_DEST_PREFIX}/share/vim/vim81/* #{configdestdir}"
FileUtils.mkdir_p "#{CREW_DEST_HOME}"
FileUtils.mkdir_p "#{configdir}" unless Dir.exists? "#{configdir}"
system "ln -s #{configdir} #{CREW_DEST_HOME}/.vim"
system "ln -s #{configdir}/vimrc #{CREW_DEST_HOME}/.vimrc"
system "ln -sf #{configdir} $HOME/.vim"
system "touch #{configdir}/vimrc #{configdestdir}/vimrc"
system "ln -sf #{configdir}/vimrc $HOME/.vimrc"
end
def self.postinstall
puts "\nMake sure to put your .vim directory in a subdirectory of #{CREW_PREFIX} so it has execute permissions.".lightblue
puts "You can then symlink to your home directory so vim can see it as follows:".lightblue
puts "ln -s #{CREW_PREFIX}/share/vim/vim81 ~/.vim".lightblue
puts "ln -s ~/.vim/vimrc ~/.vimrc\n".lightblue
configdir = "#{CREW_PREFIX}/.config/vim"
system "cp #{CREW_PREFIX}/share/vim/vim81/vimrc_example.vim #{configdir}/vimrc" unless File.size? "#{configdir}/vimrc"
puts
puts "To finish the installation, execute the following:".lightblue
puts "echo 'export VIMRUNTIME=$HOME/.vim' >> ~/.bashrc && . ~/.bashrc".lightblue
puts
puts "The config files are located in $HOME/.vim".lightblue
puts
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment