Files
chromebrew/packages/vim_runtime.rb
Ed Reel eb27d5d180 Install Mako via pip3
Reduce i686 drivers

Add glproto dependency to xorg_server

Bump mesa version

Add pre-built binaries

Add twm, xclock and xterm dependencies to xinit
2019-01-08 09:29:44 -06:00

125 lines
4.8 KiB
Ruby

require 'package'
class Vim_runtime < Package
description 'Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. (shared runtime)'
homepage 'http://www.vim.org/'
version '8.1.0648'
source_url 'https://github.com/vim/vim/archive/v8.1.0648.tar.gz'
source_sha256 '7e6ad44dbb8fda0aca91c22fa0dcaed2d845cf00c26d6d3df3bfaa38c9da222a'
binary_url ({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/vim_runtime-8.1.0648-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/vim_runtime-8.1.0648-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/vim_runtime-8.1.0648-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/vim_runtime-8.1.0648-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: '68534f604cec1223f0de74c964fde11d15313967f33a485be03f0bda09e1b87b',
armv7l: '68534f604cec1223f0de74c964fde11d15313967f33a485be03f0bda09e1b87b',
i686: 'e0acbd72d697053d891f9dddc3d1b6325370af50d115c70a983ab959d7d5d230',
x86_64: '1eaf66995f199d6360391a9aacb0d5ab997954c21862c36502991544c08a4efc',
})
depends_on 'python27' => :build
depends_on 'python3' => :build
def self.patch
# set the system-wide vimrc path
FileUtils.cd('src') do
system "sed", "-i", "s|^.*#define SYS_VIMRC_FILE.*$|#define SYS_VIMRC_FILE \"#{CREW_PREFIX}/etc/vimrc\"|", "feature.h"
system "sed", "-i", "s|^.*#define SYS_GVIMRC_FILE.*$|#define SYS_GVIMRC_FILE \"#{CREW_PREFIX}/etc/gvimrc\"|", "feature.h"
system "autoconf"
end
end
def self.build
system "./configure",
"--prefix=#{CREW_PREFIX}",
"--localstatedir=#{CREW_PREFIX}/var/lib/vim",
"--with-features=huge",
"--with-compiledby='Chromebrew'",
"--with-x=no",
"--disable-gui",
"--enable-multibyte",
"--enable-cscope",
"--enable-fontset",
"--enable-perlinterp=dynamic",
"--enable-pythoninterp=dynamic",
"--enable-python3interp=dynamic",
"--enable-rubyinterp=dynamic",
"--disable-selinux"
system "make"
end
def self.install
system "make", "VIMRCLOC=#{CREW_PREFIX}/etc", "DESTDIR=#{CREW_DEST_DIR}", "install"
# bin and man will be provided by the 'vim' packages
system "rm", "-r", "#{CREW_DEST_PREFIX}/bin"
system "rm", "-r", "#{CREW_DEST_PREFIX}/share/man"
# remove desktop and icon files for the terminal package
system "rm", "-r", "#{CREW_DEST_PREFIX}/share/applications"
system "rm", "-r", "#{CREW_DEST_PREFIX}/share/icons"
# add sane defaults and simulate some XDG support
FileUtils.mkdir_p("#{CREW_DEST_PREFIX}/share/vim/vimfiles")
File.write("#{CREW_DEST_PREFIX}/share/vim/vimfiles/chromebrew.vim", <<~EOF)
" Global vimrc - setting some sane defaults
"
" DO NOT EDIT THIS FILE. IT'S OVERWRITTEN UPON UPGRADES.
"
" Use #{CREW_PREFIX}/etc/vimrc for system-wide and ~/.vimrc for personal
" configuration.
" Use Vim defaults instead of 100% vi compatibility
" Avoid side-effects when nocompatible has already been set.
if &compatible
set nocompatible
endif
set backspace=indent,eol,start
set ruler
set suffixes+=.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc
set suffixes-=.h
set suffixes-=.obj
" Move temporary files to a secure location to protect against CVE-2017-1000382
if exists('$XDG_CACHE_HOME')
let &g:directory=$XDG_CACHE_HOME
else
let &g:directory=$HOME . '/.cache'
endif
let &g:undodir=&g:directory . '/vim/undo//'
let &g:backupdir=&g:directory . '/vim/backup//'
let &g:directory.='/vim/swap//'
" Create directories if they doesn't exist
if ! isdirectory(expand(&g:directory))
silent! call mkdir(expand(&g:directory), 'p', 0700)
endif
if ! isdirectory(expand(&g:backupdir))
silent! call mkdir(expand(&g:backupdir), 'p', 0700)
endif
if ! isdirectory(expand(&g:undodir))
silent! call mkdir(expand(&g:undodir), 'p', 0700)
endif
EOF
end
def self.postinstall
vimrc = "#{CREW_PREFIX}/etc/vimrc"
# keep user changes by writing to a new file
vimrc += ".new" if File.exists?(vimrc)
# by default we will load the global config
File.write(vimrc, <<~EOF)
" System-wide defaults are in #{CREW_PREFIX}/share/vim/vimfiles/chromebrew.vim
" and sourced by this file. If you wish to change any of those settings, you
" should do so at the end of this file or in your user-specific (~/.vimrc) file.
" If you do not wish to use the bundled defaults, remove the next line.
runtime! chromebrew.vim
EOF
end
end