Ⅰ. 插件描述
build in chroots from vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'sashang/vim-chroot-build'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'sashang/vim-chroot-build'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'sashang/vim-chroot-build'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/sashang/vim-chroot-build
Ⅳ. 文档说明
# vim-chroot-build
Build in chroots from vim.
Requirements
What on earth is this schroot/chroot thing
Basically if you want to build for a distribution that is different from the one you use, what you
can do is make a filesystem image of the target distribution, install the build tools you need on
this filesystem and then run it in a chroot. So for example if I'm using Arch as my desktop
environment but I want to compile my programs for SLES11 or Ubuntu12 or Centos5 I can make
filesystem images for those distributions and use schroot to manage them. schroot will automount my
home directory inside the chroot. This is very useful. Using a container you will have to configure
this yourself. You can think of a chroot as something that virtualizes the filesystem only, as
opposed to a container which virtualizes everything above the kernel (filesystem, network resources,
processes etc...). This plugin just runs the build steps in the chrooted environment so you don't
have to manually do it.
Installation
Install using Vundle by adding this to your .vimrc in your Vundle section:
Plugin 'sashang/vim-chroot-build'
or source it:
:source vim-chroot-build.vim
Features and Usage
By default this uses schroot to execute commands within the chroot.
- Vim's working directory should be the one with
configure.acpresent or a subdir. - The variable
g:vcb_chroot_nameis the name of the chroot. schroot -l will list the chroots on
your system. Set it to one of these names. For examplelet g:vcb_chroot_name=sles12. - The variable
g:vcb_useris the user name used to login to the chroot. For example, `let
g:vcb_user=joe`
Once those variables are set you can run the following functions to perform common operations in the
chrooted build environment. For the examples below assume that the following configuration is true:
let g:vcb_chroot_name=sles12
let g:vcb_user=joe
:SConfigure. This will execute ../configure in the path/home/joe/my-secret-project/build-sles12:SMake. This will run make in the path/home/joe/my-secret-project/build-sles12:SAutoreconf. This will run autoreconf inside the chroot.:SStop. Stop any command currently executing.
You can change the compiler by setting the following global variables:
let g:vcb_cc='ccache\ gcc'
let g:vcb_cxx='ccache\ g++'